Skip to content

The Unified and Autonomous Development Platform

Cleanup to prepare layout redesign.

robin shineb9974b296c9e
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonPage.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonPage.java
index a7638c2fd7..c442c8109d 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonPage.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonPage.java
@@ -1,31 +1,18 @@
package com.pmease.commons.wicket;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
-import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method;
-import org.apache.wicket.ajax.attributes.CallbackParameter;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.head.PriorityHeaderItem;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.time.Duration;
import org.eclipse.jetty.server.SessionManager;
import com.pmease.commons.loader.AppLoader;
-import com.pmease.commons.wicket.component.history.HistoryAwarePanel;
-import com.pmease.commons.wicket.component.history.HistoryState;
import com.pmease.commons.wicket.websocket.WebSocketRenderBehavior;
@SuppressWarnings("serial")
@@ -55,49 +42,6 @@ public abstract class CommonPage extends WebPage {
int sessionTimeout = AppLoader.getInstance(SessionManager.class).getMaxInactiveInterval();
add(new WebMarkupContainer("keepSessionAlive").add(
new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(sessionTimeout*500L))));
-
- add(new AbstractDefaultAjaxBehavior() {
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- super.updateAjaxAttributes(attributes);
- attributes.setMethod(Method.POST);
- }
-
- @Override
- protected void respond(AjaxRequestTarget target) {
- String encodedHistoryState = RequestCycle.get().getRequest().getPostParameters()
- .getParameterValue("state").toOptionalString();
- if (StringUtils.isNotBlank(encodedHistoryState)) {
- byte[] bytes = Base64.decodeBase64(encodedHistoryState.getBytes());
- HistoryState historyState = (HistoryState) SerializationUtils.deserialize(bytes);
- HistoryAwarePanel historyAwarePanel = (HistoryAwarePanel) getPage().get(historyState.getComponentPath());
- if (historyAwarePanel != null)
- historyAwarePanel.onPopState(target, historyState.getCustomObj());
- }
- }
-
- @Override
- public void renderHead(Component component, IHeaderResponse response) {
- super.renderHead(component, response);
-
- // Use history.js instead of native history API to solve the problem that Safari
- // (and previous versions of Chrome) fires event "onpopstate" on initial page load
- // and this causes the page to reload infinitely with below code
- String script = String.format(""
- + "History.Adapter.bind(window, 'statechange', function() {"
- + " if (History.getState().data.state != null) {"
- + " %s"
- + " } else {"
- + " location.reload();"
- + " }"
- + "});",
- getCallbackFunctionBody(CallbackParameter.resolved("state", "History.getState().data.state")));
- response.render(OnDomReadyHeaderItem.forScript(script));
- }
-
- });
-
}
public FeedbackPanel getSessionFeedback() {
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonResourceReference.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonResourceReference.java
index f03f70b23a..c1a9589200 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonResourceReference.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/CommonResourceReference.java
@@ -15,7 +15,6 @@ import com.pmease.commons.wicket.assets.Assets;
import de.agilecoders.wicket.core.Bootstrap;
import de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference;
-import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
/**
* Common resource is intended to provide a common look&feel for all products using
@@ -80,8 +79,6 @@ public class CommonResourceReference extends JavaScriptResourceReference {
dependencies.add(JavaScriptHeaderItem.forReference(Bootstrap.getSettings().getModernizrResourceReference()));
dependencies.addAll(bootstrapHeaderItems);
- dependencies.add(JavaScriptHeaderItem.forReference(
- new WebjarsJavaScriptResourceReference("historyjs/current/scripts/bundled/html5/jquery.history.js")));
dependencies.add(CssHeaderItem.forReference(
new WebjarsCssResourceReference("font-awesome/current/css/font-awesome.min.css")));
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/HistoryBehavior.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/HistoryBehavior.java
new file mode 100644
index 0000000000..6a0be0a335
--- /dev/null
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/HistoryBehavior.java
@@ -0,0 +1,74 @@
+package com.pmease.commons.wicket.behavior;
+
+import java.io.Serializable;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method;
+import org.apache.wicket.ajax.attributes.CallbackParameter;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.request.cycle.RequestCycle;
+
+import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference;
+
+@SuppressWarnings("serial")
+public abstract class HistoryBehavior extends AbstractDefaultAjaxBehavior {
+
+ @Override
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+ super.updateAjaxAttributes(attributes);
+ attributes.setMethod(Method.POST);
+ }
+
+ @Override
+ protected void respond(AjaxRequestTarget target) {
+ String encodedState = RequestCycle.get().getRequest().getPostParameters()
+ .getParameterValue("state").toOptionalString();
+ byte[] bytes = Base64.decodeBase64(encodedState.getBytes());
+ Serializable state = (Serializable) SerializationUtils.deserialize(bytes);
+ onPopState(target, state);
+ }
+
+ protected abstract void onPopState(AjaxRequestTarget target, Serializable state);
+
+ @Override
+ public void renderHead(Component component, IHeaderResponse response) {
+ super.renderHead(component, response);
+
+ response.render(JavaScriptHeaderItem.forReference(
+ new WebjarsJavaScriptResourceReference("historyjs/current/scripts/bundled/html5/jquery.history.js")));
+
+ // Use history.js instead of native history API to solve the problem that Safari
+ // (and previous versions of Chrome) fires event "onpopstate" on initial page load
+ // and this causes the page to reload infinitely with below code
+ String script = String.format(""
+ + "History.Adapter.bind(window, 'statechange', function() {"
+ + " if (History.getState().data.component == null)"
+ + " location.reload();"
+ + "});");
+ response.render(JavaScriptHeaderItem.forScript(script, "reload_on_state_change"));
+
+ script = String.format(""
+ + "History.Adapter.bind(window, 'statechange', function() {"
+ + " if (History.getState().data.component === '%s') {"
+ + " %s"
+ + " }"
+ + "});",
+ getComponent().getPageRelativePath(),
+ getCallbackFunctionBody(CallbackParameter.resolved("state", "History.getState().data.state")));
+ response.render(OnDomReadyHeaderItem.forScript(script));
+ }
+
+ public void pushState(AjaxRequestTarget target, String url, Serializable state) {
+ String encodedState = new String(Base64.encodeBase64(SerializationUtils.serialize(state)));
+ target.appendJavaScript(String.format("History.pushState({state:'%s', component:'%s'}, '', '%s');",
+ encodedState, getComponent().getPageRelativePath(), url));
+ }
+
+}
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryAwarePanel.html b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryAwarePanel.html
deleted file mode 100644
index d64b7f8c5c..0000000000
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryAwarePanel.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<wicket:panel>
- <div wicket:id="content"></div>
-</wicket:panel>
\ No newline at end of file
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryAwarePanel.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryAwarePanel.java
deleted file mode 100644
index 323ce6c7a0..0000000000
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryAwarePanel.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.pmease.commons.wicket.component.history;
-
-import java.io.Serializable;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-@SuppressWarnings("serial")
-public abstract class HistoryAwarePanel extends Panel {
-
- public HistoryAwarePanel(String id) {
- super(id);
- }
-
- public HistoryAwarePanel(String id, IModel<?> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(newContent("content"));
-
- setRenderBodyOnly(true);
- }
-
- protected abstract Component newContent(String id);
-
- public abstract void onPopState(AjaxRequestTarget target, Serializable state);
-
- public void pushState(AjaxRequestTarget target, String url, Serializable state) {
- HistoryState historyState = new HistoryState(getPageRelativePath(), state);
- String encodedHistoryState = new String(Base64.encodeBase64(SerializationUtils.serialize(historyState)));
- target.appendJavaScript(String.format("History.pushState({state:'%s'}, '', '%s');", encodedHistoryState, url));
- }
-
-}
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryState.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryState.java
deleted file mode 100644
index 30f5a60264..0000000000
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/history/HistoryState.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.pmease.commons.wicket.component.history;
-
-import java.io.Serializable;
-
-@SuppressWarnings("serial")
-public class HistoryState implements Serializable {
-
- private final String componentPath;
-
- private final Serializable customObj;
-
- public HistoryState(String componentPath, Serializable customObj) {
- this.componentPath = componentPath;
- this.customObj = customObj;
- }
-
- public String getComponentPath() {
- return componentPath;
- }
-
- public Serializable getCustomObj() {
- return customObj;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/Constants.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/Constants.java
index 6cf5148b62..3ed7bf26cf 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/Constants.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/Constants.java
@@ -1,28 +1,11 @@
package com.pmease.gitplex.web;
-import java.util.Date;
-
public class Constants {
- public static final Date NULL_DATE = new Date(0);
public static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
- public static final String DATETIME_FULL_FORMAT = "EEEEE, MMM dd, yyyy, HH:mm:ss Z";
+
public static final String DATE_FORMAT = "yyyy-MM-dd";
- public static final String TIME_FORMAT = "HH:mm:ss";
- public static final String TIMEZONE_FORMAT = "Z";
-
- public static final String INPUT_DATE_FORMAT = "yyyy-MM-dd";
- public static final String INPUT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm";
- public static final String INPUT_TIME_FORMAT = "HH:mm";
-
- public static final String INPUT_DATE_FORMAT_WITH_ZONE = "yyyy-MM-dd Z";
- public static final String INPUT_DATETIME_FORMAT_WITH_ZONE = "yyyy-MM-dd HH:mm Z";
- public static final String INPUT_TIME_FORMAT_WITH_ZONE = "HH:mm Z";
- public static final String SYSTEM_LOG_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss,SSS";
-
- public static final String UTF8 = "UTF-8";
-
public static final int DEFAULT_PAGE_SIZE = 25;
public static final int DEFAULT_SELECT2_PAGE_SIZE = 25;
@@ -30,7 +13,5 @@ public class Constants {
public static final String COOKIE_CREDENTIAL = "gitplex.login";
public static final int DEFAULT_CONTEXT_LINES = 3;
- public static final int MAX_RENDERABLE_BLOBS = 300;
- public static final int MAX_RENDERABLE_COMMITS = 300;
- public static final int MAX_RENDERABLE_DIFF_LINES = 10000;
+
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/GitPlexMounting.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/GitPlexMounting.java
index 05841a7b6b..336514d05b 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/GitPlexMounting.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/GitPlexMounting.java
@@ -1,21 +1,16 @@
package com.pmease.gitplex.web;
-import java.util.List;
-
import org.apache.wicket.Page;
import org.apache.wicket.core.request.mapper.MountedMapper;
-import org.apache.wicket.core.request.mapper.ResourceMapper;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.Url;
import org.apache.wicket.request.mapper.CompoundRequestMapper;
-import org.apache.wicket.request.resource.ResourceReference;
import com.pmease.gitplex.core.validation.RepositoryNameValidator;
import com.pmease.gitplex.core.validation.UserNameValidator;
-import com.pmease.gitplex.web.common.wicket.mapper.PageParameterAwareMountedMapper;
-import com.pmease.gitplex.web.common.wicket.mapper.PatternMountedMapper;
-import com.pmease.gitplex.web.page.RunModePage;
-import com.pmease.gitplex.web.page.TestPage;
+import com.pmease.gitplex.web.mapper.PageParameterAwareMountedMapper;
+import com.pmease.gitplex.web.mapper.PatternMountedMapper;
+import com.pmease.gitplex.web.page.ServerInitPage;
import com.pmease.gitplex.web.page.account.AccountHomePage;
import com.pmease.gitplex.web.page.account.AccountNotificationsPage;
import com.pmease.gitplex.web.page.account.AccountProfilePage;
@@ -24,15 +19,9 @@ import com.pmease.gitplex.web.page.account.RegisterPage;
import com.pmease.gitplex.web.page.account.repository.NewRepositoryPage;
import com.pmease.gitplex.web.page.account.repository.RepositoriesPage;
import com.pmease.gitplex.web.page.account.team.AccountTeamsPage;
-import com.pmease.gitplex.web.page.account.team.AddTeamPage;
-import com.pmease.gitplex.web.page.account.team.EditTeamPage;
import com.pmease.gitplex.web.page.admin.MailSettingPage;
import com.pmease.gitplex.web.page.admin.QosSettingPage;
import com.pmease.gitplex.web.page.admin.SystemSettingPage;
-import com.pmease.gitplex.web.page.error.AccessDeniedPage;
-import com.pmease.gitplex.web.page.error.InternalServerErrorPage;
-import com.pmease.gitplex.web.page.error.PageNotFoundPage;
-import com.pmease.gitplex.web.page.init.ServerInitPage;
import com.pmease.gitplex.web.page.repository.NoCommitsPage;
import com.pmease.gitplex.web.page.repository.RepositoryHomePage;
import com.pmease.gitplex.web.page.repository.admin.GeneralSettingPage;
@@ -40,30 +29,26 @@ import com.pmease.gitplex.web.page.repository.admin.PermissionSettingPage;
import com.pmease.gitplex.web.page.repository.admin.gatekeeper.GateKeeperPage;
import com.pmease.gitplex.web.page.repository.admin.integrationpolicy.IntegrationPolicyPage;
import com.pmease.gitplex.web.page.repository.code.blob.RepoBlobPage;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.RawBlobResourceReference;
import com.pmease.gitplex.web.page.repository.code.branches.BranchComparePage;
import com.pmease.gitplex.web.page.repository.code.branches.RepoBranchesPage;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
-import com.pmease.gitplex.web.page.repository.code.commits.RepoCommitsPage;
-import com.pmease.gitplex.web.page.repository.code.contributors.ContributorsPage;
-import com.pmease.gitplex.web.page.repository.code.tags.GitArchiveResourceReference;
import com.pmease.gitplex.web.page.repository.code.tree.RepoTreePage;
+import com.pmease.gitplex.web.page.repository.commit.RepoCommitPage;
+import com.pmease.gitplex.web.page.repository.commit.RepoCommitsPage;
import com.pmease.gitplex.web.page.repository.pullrequest.ClosedRequestsPage;
import com.pmease.gitplex.web.page.repository.pullrequest.NewRequestPage;
import com.pmease.gitplex.web.page.repository.pullrequest.OpenRequestsPage;
import com.pmease.gitplex.web.page.repository.pullrequest.RequestComparePage;
import com.pmease.gitplex.web.page.repository.pullrequest.RequestOverviewPage;
import com.pmease.gitplex.web.page.repository.pullrequest.RequestUpdatesPage;
-import com.pmease.gitplex.web.util.UrlUtils;
+import com.pmease.gitplex.web.page.test.RunModePage;
+import com.pmease.gitplex.web.page.test.TestPage;
public class GitPlexMounting extends CompoundRequestMapper {
public GitPlexMounting(WebApplication app) {
- addErrorPages();
addAdministrationPages();
addAccountPages();
addRepositoryPages();
- addResources();
addPage("init", ServerInitPage.class);
addPage("register", RegisterPage.class);
@@ -71,12 +56,6 @@ public class GitPlexMounting extends CompoundRequestMapper {
addPage("run-mode", RunModePage.class);
}
- private void addErrorPages() {
- addPage("404", PageNotFoundPage.class);
- addPage("403", AccessDeniedPage.class);
- addPage("501", InternalServerErrorPage.class);
- }
-
private void addAdministrationPages() {
addPage("administration/mail-settings", MailSettingPage.class);
addPage("administration/system-settings", SystemSettingPage.class);
@@ -88,11 +67,10 @@ public class GitPlexMounting extends CompoundRequestMapper {
@Override
protected boolean urlStartsWith(Url url, String... segments) {
- List<String> normalizedSegments = UrlUtils
- .normalizeUrlSegments(url.getSegments());
- if (normalizedSegments.size() < 1)
+ if (segments.length < 1)
return false;
- String userName = normalizedSegments.get(0);
+ String userName = segments[0];
+
return !UserNameValidator.getReservedNames().contains(userName);
}
@@ -105,8 +83,6 @@ public class GitPlexMounting extends CompoundRequestMapper {
addPage("${user}/settings/repositories", RepositoriesPage.class);
addPage("${user}/settings/members", MemberSettingPage.class);
addPage("${user}/settings/teams", AccountTeamsPage.class);
- addPage("${user}/settings/teams/new", AddTeamPage.class);
- addPage("${user}/settings/teams/${teamId}", EditTeamPage.class);
}
private void addRepositoryPages() {
@@ -114,15 +90,13 @@ public class GitPlexMounting extends CompoundRequestMapper {
@Override
protected boolean urlStartsWith(Url url, String... segments) {
- List<String> normalizedSegments = UrlUtils
- .normalizeUrlSegments(url.getSegments());
- if (normalizedSegments.size() < 2)
+ if (segments.length < 2)
return false;
- String userName = normalizedSegments.get(0);
+ String userName = segments[0];
if (UserNameValidator.getReservedNames().contains(userName))
return false;
- String repositoryName = normalizedSegments.get(1);
+ String repositoryName = segments[1];
return !RepositoryNameValidator.getReservedNames().contains(
repositoryName);
}
@@ -162,9 +136,6 @@ public class GitPlexMounting extends CompoundRequestMapper {
add(new PageParameterAwareMountedMapper(
"${user}/${repo}/pull-requests/${request}/compare", RequestComparePage.class));
- add(new PageParameterAwareMountedMapper("${user}/${repo}/contributors",
- ContributorsPage.class));
-
add(new PageParameterAwareMountedMapper("${user}/${repo}/settings",
GeneralSettingPage.class));
add(new PageParameterAwareMountedMapper(
@@ -181,19 +152,8 @@ public class GitPlexMounting extends CompoundRequestMapper {
"${user}/${repo}/no-commits", NoCommitsPage.class));
}
- private void addResources() {
- // --------------------------------------------------------------------
- // system shared resources
- // --------------------------------------------------------------------
- addResource("raw/${user}/${repo}", new RawBlobResourceReference());
- addResource("archive/${user}/${repo}",new GitArchiveResourceReference());
- }
-
private void addPage(String path, Class<? extends Page> page) {
add(new PatternMountedMapper(path, page).setExact(true));
}
- private void addResource(String path, ResourceReference resource) {
- add(new ResourceMapper(path, resource));
- }
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/WebModule.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/WebModule.java
index 5c9c9b3e95..891251dac1 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/WebModule.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/WebModule.java
@@ -5,14 +5,12 @@ import java.util.Collection;
import org.apache.tika.mime.MediaType;
import org.apache.wicket.Application;
import org.apache.wicket.protocol.http.WebApplication;
-import org.glassfish.jersey.server.ResourceConfig;
import org.pegdown.Parser;
import org.pegdown.plugins.ToHtmlSerializerPlugin;
import com.google.common.collect.Lists;
import com.pmease.commons.git.extensionpoint.TextConverter;
import com.pmease.commons.git.extensionpoint.TextConverterProvider;
-import com.pmease.commons.jersey.JerseyConfigurator;
import com.pmease.commons.jetty.ServletConfigurator;
import com.pmease.commons.loader.AbstractPluginModule;
import com.pmease.commons.markdown.extensionpoint.HtmlTransformer;
@@ -30,11 +28,7 @@ import com.pmease.gitplex.web.extensionpoint.DiffRenderer;
import com.pmease.gitplex.web.extensionpoint.DiffRendererProvider;
import com.pmease.gitplex.web.extensionpoint.MediaRenderer;
import com.pmease.gitplex.web.extensionpoint.MediaRendererProvider;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.BlobRendererFactory;
import com.pmease.gitplex.web.page.repository.pullrequest.RequestDetailPage;
-import com.pmease.gitplex.web.resource.ResourceLocator;
-import com.pmease.gitplex.web.service.FileBlobService;
-import com.pmease.gitplex.web.service.impl.DefaultFileBlobService;
/**
* NOTE: Do not forget to rename moduleClass property defined in the pom if you've renamed this class.
@@ -51,26 +45,14 @@ public class WebModule extends AbstractPluginModule {
bind(WebApplication.class).to(WicketConfig.class);
bind(Application.class).to(WicketConfig.class);
bind(AvatarManager.class).to(DefaultAvatarManager.class);
- bind(FileBlobService.class).to(DefaultFileBlobService.class);
contribute(ServletConfigurator.class, WebServletConfigurator.class);
contribute(UserNameReservation.class, WebUserNameReservation.class);
- contribute(JerseyConfigurator.class, new JerseyConfigurator() {
-
- @Override
- public void configure(ResourceConfig resourceConfig) {
- resourceConfig.packages(true, ResourceLocator.class.getPackage().getName());
- }
-
- });
-
contributeFromPackage(EditSupport.class, EditSupportLocator.class);
contribute(PullRequestListener.class, RequestDetailPage.Updater.class);
- bind(BlobRendererFactory.class);
-
contribute(MediaRendererProvider.class, new MediaRendererProvider() {
@Override
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/WicketConfig.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/WicketConfig.java
index 5e7fbfb7bd..4a4bec4dec 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/WicketConfig.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/WicketConfig.java
@@ -6,10 +6,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.wicket.Application;
import org.apache.wicket.Page;
import org.apache.wicket.Session;
-import org.apache.wicket.bean.validation.BeanValidationConfiguration;
import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
-import org.apache.wicket.markup.html.IPackageResourceGuard;
-import org.apache.wicket.markup.html.SecurePackageResourceGuard;
import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Request;
@@ -18,21 +15,14 @@ import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.http.WebRequest;
import org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy;
import org.apache.wicket.request.resource.caching.version.LastModifiedResourceVersion;
-import org.apache.wicket.util.time.Duration;
import com.pmease.commons.wicket.AbstractWicketConfig;
+import com.pmease.gitplex.web.page.HomePage;
import com.pmease.gitplex.web.page.error.BaseErrorPage;
-import com.pmease.gitplex.web.page.error.PageExpiredPage;
-import com.pmease.gitplex.web.page.home.HomePage;
-import com.pmease.gitplex.web.shiro.LoginPage;
-import com.pmease.gitplex.web.shiro.LogoutPage;
-import com.pmease.gitplex.web.shiro.ShiroWicketPlugin;
@Singleton
public class WicketConfig extends AbstractWicketConfig {
- private static final Duration DEFAULT_TIMEOUT = Duration.minutes(10);
-
public static WicketConfig get() {
return (WicketConfig) Application.get();
}
@@ -75,40 +65,12 @@ public class WicketConfig extends AbstractWicketConfig {
protected void init() {
super.init();
- getRequestCycleSettings().setTimeout(DEFAULT_TIMEOUT);
-
getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy(new LastModifiedResourceVersion()));
- getRequestCycleListeners().add(new WicketRequestCycleListener());
-
- getApplicationSettings().setPageExpiredErrorPage(PageExpiredPage.class);
-
- // wicket bean validation
- new BeanValidationConfiguration().configure(this);
-
- new ShiroWicketPlugin()
- .mountLoginPage("login", LoginPage.class)
- .mountLogoutPage("logout", LogoutPage.class)
- .install(this);
-
- configureResources();
-
// mount all pages and resources
mount(new GitPlexMounting(this));
}
- private void configureResources() {
- final IPackageResourceGuard packageResourceGuard = getResourceSettings().getPackageResourceGuard();
-
- if (packageResourceGuard instanceof SecurePackageResourceGuard) {
- SecurePackageResourceGuard guard = (SecurePackageResourceGuard) packageResourceGuard;
- guard.addPattern("+*.woff");
- guard.addPattern("+*.eot");
- guard.addPattern("+*.svg");
- guard.addPattern("+*.ttf");
- }
- }
-
public Iterable<IRequestMapper> getRequestMappers() {
return getRootRequestMapperAsCompound();
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/WicketRequestCycleListener.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/WicketRequestCycleListener.java
deleted file mode 100644
index 6218958401..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/WicketRequestCycleListener.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.pmease.gitplex.web;
-
-import java.util.List;
-
-import javax.persistence.EntityNotFoundException;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.Page;
-import org.apache.wicket.WicketRuntimeException;
-import org.apache.wicket.authorization.AuthorizationException;
-import org.apache.wicket.core.request.handler.PageProvider;
-import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
-import org.apache.wicket.core.request.handler.RenderPageRequestHandler.RedirectPolicy;
-import org.apache.wicket.core.request.mapper.StalePageException;
-import org.apache.wicket.protocol.http.PageExpiredException;
-import org.apache.wicket.request.IRequestHandler;
-import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.http.WebRequest;
-
-import com.google.common.collect.ImmutableList;
-import com.pmease.gitplex.web.exception.AccessDeniedException;
-import com.pmease.gitplex.web.page.error.AccessDeniedPage;
-import com.pmease.gitplex.web.page.error.PageNotFoundPage;
-import com.pmease.gitplex.web.shiro.LoginPage;
-
-public class WicketRequestCycleListener extends AbstractRequestCycleListener {
-
- /**
- * Exception types we consider "recoverable", meaning we don't have to
- * log a detailed stack trace for these.
- */
- List<Class<? extends WicketRuntimeException>> RECOVERABLE_EXCEPTIONS =
- ImmutableList.of(
- StalePageException.class,
- PageExpiredException.class,
- AuthorizationException.class);
-
- @Override
- public IRequestHandler onException(RequestCycle cycle, Exception ex) {
- if (ex instanceof EntityNotFoundException) {
- return createErrorPageHandler(cycle, PageNotFoundPage.class);
- }
-
- if (ex instanceof AccessDeniedException) {
- if (SecurityUtils.getSubject() != null) {
- return createErrorPageHandler(cycle, AccessDeniedPage.class);
- } else {
- return createErrorPageHandler(cycle, LoginPage.class);
- }
- }
-
- // null means we want Wicket's default onException behavior to be used
- return null;
- }
-
- private IRequestHandler createErrorPageHandler(RequestCycle cycle, Class<? extends Page> pageClass) {
- RedirectPolicy redirectPolicy = RedirectPolicy.NEVER_REDIRECT;
- if (cycle.getRequest() instanceof WebRequest &&
- ((WebRequest) cycle.getRequest()).isAjax()) {
- redirectPolicy = RedirectPolicy.ALWAYS_REDIRECT;
- }
-
- return new RenderPageRequestHandler(new PageProvider(pageClass), redirectPolicy);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/AbstractDataType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/AbstractDataType.java
deleted file mode 100644
index 335db91a9d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/AbstractDataType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-public abstract class AbstractDataType implements DataType {
-
- @Override
- public String asString(Object from, String pattern) {
- return asString(from, pattern, Locale.getDefault());
- }
-
- @Override
- public String asString(Object from) {
- return asString(from, null);
- }
-
- @Override
- public Object fromString(String value, String pattern) {
- return fromString(value, pattern, Locale.getDefault());
- }
-
- @Override
- public Object fromString(String value) {
- return fromString(value, null);
- }
-
- @Override
- public boolean isNumericType() {
- return false;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/AbstractNumericType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/AbstractNumericType.java
deleted file mode 100644
index b6b25fbd97..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/AbstractNumericType.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.BigDecimalValidator;
-
-public abstract class AbstractNumericType extends AbstractDataType {
-
- @Override
- public boolean isNumericType() {
- return true;
- }
-
- protected Number toNumber(Object from) {
- if (from == null) {
- return 0;
- }
-
- if (from instanceof Number) {
- return (Number) from;
- }
-
- if (from instanceof String) {
- String s = (String) from;
- if ("NaN".equalsIgnoreCase(s)) {
- return Double.NaN;
- }
-
- Number n = BigDecimalValidator.getInstance().validate(s, null, Locale.getDefault());
- return n == null ? 0 : n;
- }
-
- if (from instanceof Boolean) {
- return ((Boolean) from) ? 1 : 0;
- }
-
- throw new TypeCastException(this, from);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/BooleanType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/BooleanType.java
deleted file mode 100644
index 77f319bd60..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/BooleanType.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-
-public class BooleanType extends AbstractDataType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Boolean b = (Boolean) typeCast(from);
- if (Strings.isNullOrEmpty(pattern)) {
- return b.toString();
- }
-
- String[] tokens = Iterables.toArray(Splitter.on(":").limit(2).omitEmptyStrings().split(pattern), String.class);
- return b ? tokens[0] : tokens[1];
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- if (Strings.isNullOrEmpty(value)) {
- return null;
- }
-
- if (Strings.isNullOrEmpty(pattern)) {
- if ("TRUE".equalsIgnoreCase(value)) {
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- }
-
- String[] tokens = Iterables.toArray(Splitter.on(":").limit(2).omitEmptyStrings().split(pattern), String.class);
- if (Objects.equal(value, tokens[0])) {
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Boolean.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- if (from == null){
- return Boolean.FALSE;
- }
-
- if (from instanceof Boolean) {
- return from;
- }
-
- if (from instanceof Number) {
- return ((Number) from).intValue() > 0;
- }
-
- if (from instanceof String) {
- if ("TRUE".equalsIgnoreCase((String) from)) {
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- }
-
- throw new TypeCastException(this, from);
- }
-
- @Override
- public String getTypeName() {
- return "BOOLEAN";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/ByteType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/ByteType.java
deleted file mode 100644
index 65b99b6455..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/ByteType.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.ByteValidator;
-
-public class ByteType extends AbstractNumericType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Byte b = (Byte) typeCast(from);
- return ByteValidator.getInstance().format(b, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return ByteValidator.getInstance().validate(value, pattern, locale);
- }
-
- @Override
- public Object typeCast(Object from) {
- Number number = toNumber(from);
- return number.byteValue();
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Byte.class;
- }
-
- @Override
- public String getTypeName() {
- return "BYTE";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DataType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DataType.java
deleted file mode 100644
index a4d2eb16b1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DataType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-public interface DataType {
-
- String asString(Object from, String pattern, Locale locale);
-
- String asString(Object from, String pattern);
-
- String asString(Object from);
-
- Object fromString(String value, String pattern, Locale locale);
-
- Object fromString(String value, String pattern);
-
- Object fromString(String value);
-
- Class<?> getReturnClass();
-
- boolean isNumericType();
-
- Object typeCast(Object from);
-
- String getTypeName();
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DataTypes.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DataTypes.java
deleted file mode 100644
index aeb5731878..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DataTypes.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-public class DataTypes {
-
- private static enum NULLE {
- }
-
- public static final DataType BOOLEAN = new BooleanType();
- public static final DataType BYTE = new ByteType();
- public static final DataType SHORT = new ShortType();
- public static final DataType INTEGER = new IntegerType();
- public static final DataType LONG = new LongType();
- public static final DataType FLOAT = new FloatType();
- public static final DataType DOUBLE = new DoubleType();
- public static final DataType PERCENT = new PercentType();
- public static final DataType DATE = new DateType();
- public static final DataType ENUM = new EnumType(NULLE.class);
- public static final DataType STRING = new StringType();
-
- static final DataType[] PRIMITIVES = new DataType[] {
- BOOLEAN, BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, PERCENT, ENUM, STRING
- };
-
- public static DataType getType(Class<?> clazz) {
- for (DataType each : PRIMITIVES) {
- if (each.getReturnClass().isAssignableFrom(clazz)) {
- return each;
- }
- }
-
- throw new UnsupportedOperationException("Unable to find the data type for class [" + clazz + "]");
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DateType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DateType.java
deleted file mode 100644
index 55de560d0c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DateType.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.DateValidator;
-import org.joda.time.DateTime;
-import org.joda.time.ReadableDateTime;
-import org.joda.time.format.ISODateTimeFormat;
-
-import com.google.common.base.Strings;
-
-public class DateType extends AbstractDataType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Date date = (Date) typeCast(from);
-
- if (date == null) {
- return null;
- }
-
- if (Strings.isNullOrEmpty(pattern)) {
- return ISODateTimeFormat.dateTime().withZoneUTC().print(new DateTime(date));
- }
-
- return DateValidator.getInstance().format(date, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- if (Strings.isNullOrEmpty(pattern)) {
- return ISODateTimeFormat.dateTime().withZoneUTC().parseDateTime(value).toDate();
- }
-
- return DateValidator.getInstance().validate(value, pattern, locale);
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Date.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- if (from == null || (from instanceof Date)) {
- return from;
- }
-
- if (from instanceof Long) {
- return new Date((Long) from);
- }
-
- if (from instanceof Calendar) {
- return new Date(((Calendar) from).getTimeInMillis());
- }
-
- if (from instanceof java.sql.Timestamp) {
- return new Date(((java.sql.Timestamp) from).getTime());
- }
-
- if (from instanceof ReadableDateTime) {
- return ((ReadableDateTime) from).toDateTime().toDate();
- }
-
- if (from instanceof String) {
- DateTime dt = ISODateTimeFormat.dateTime().parseDateTime((String) from);
- if (dt != null) {
- return dt.toDate();
- }
- }
-
- throw new TypeCastException(this, from);
- }
-
- @Override
- public String getTypeName() {
- return "DATE";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DoubleType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DoubleType.java
deleted file mode 100644
index 1a012b7e18..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DoubleType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.DoubleValidator;
-
-public class DoubleType extends AbstractNumericType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Double d = (Double) typeCast(from);
- return DoubleValidator.getInstance().format(d, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return DoubleValidator.getInstance().validate(value, pattern, locale);
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Double.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- return toNumber(from).doubleValue();
- }
-
- @Override
- public String getTypeName() {
- return "DOUBLE";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DurationFormatUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DurationFormatUtils.java
deleted file mode 100644
index 38e3f9714e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DurationFormatUtils.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import org.joda.time.format.ISOPeriodFormat;
-import org.joda.time.format.PeriodFormatter;
-import org.joda.time.format.PeriodFormatterBuilder;
-
-public class DurationFormatUtils {
- // public static final String ISO8601 = "yyyy-MM-dd'T'HH:mm:ssZ";
-
- public static PeriodFormatter createPeriodFormatter(String pattern) {
- PeriodFormatterBuilder builder = new PeriodFormatterBuilder();
- parsePatternTo(builder, pattern);
- return builder.toFormatter();
- }
-
- private static void parsePatternTo(PeriodFormatterBuilder builder, String pattern) {
- int length = pattern.length();
- int[] indexRef = new int[1];
-
- builder.printZeroAlways();
-
- for (int i = 0; i < length; i++) {
- indexRef[0] = i;
- String token = parseToken(pattern, indexRef);
- i = indexRef[0];
-
- int tokenLen = token.length();
- if (tokenLen == 0) {
- break;
- }
- char c = token.charAt(0);
-
- switch (c) {
- case 'y': // year (number)
- builder.appendYears();
- break;
- case 'd': // days
- builder.minimumPrintedDigits(tokenLen);
- builder.appendDays();
- break;
- case 'H': // hours
- builder.minimumPrintedDigits(tokenLen);
- builder.appendHours();
- break;
- case 'm': // minutes
- builder.minimumPrintedDigits(tokenLen);
- builder.appendMinutes();
- break;
- case 's': // seconds
- builder.minimumPrintedDigits(tokenLen);
- builder.appendSeconds();
- break;
- case 'S': // milliseconds
- builder.minimumPrintedDigits(tokenLen);
- builder.appendMillis();
- break;
- case '\'': // literal text
- String sub = token.substring(1);
- builder.appendLiteral(new String(sub));
- break;
- default:
- throw new IllegalArgumentException("Illegal pattern component: " + token);
- }
- }
- }
-
- /**
- * Parses an individual token.
- *
- * @param pattern the pattern string
- * @param indexRef a single element array, where the input is the start location and the output is
- * the location after parsing the token
- * @return the parsed token
- */
- private static String parseToken(String pattern, int[] indexRef) {
- StringBuffer buf = new StringBuffer();
-
- int i = indexRef[0];
- int length = pattern.length();
-
- char c = pattern.charAt(i);
- if (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z') {
- // Scan a run of the same character, which indicates a time
- // pattern.
- buf.append(c);
-
- while (i + 1 < length) {
- char peek = pattern.charAt(i + 1);
- if (peek == c) {
- buf.append(c);
- i++;
- } else {
- break;
- }
- }
- } else {
- // This will identify token as text.
- buf.append('\'');
-
- boolean inLiteral = false;
-
- for (; i < length; i++) {
- c = pattern.charAt(i);
-
- if (c == '\'') {
- if (i + 1 < length && pattern.charAt(i + 1) == '\'') {
- // '' is treated as escaped '
- i++;
- buf.append(c);
- } else {
- inLiteral = !inLiteral;
- }
- } else if (!inLiteral && (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z')) {
- i--;
- break;
- } else {
- buf.append(c);
- }
- }
- }
-
- indexRef[0] = i;
- return buf.toString();
- }
-
- public static PeriodFormatter isoFormatter() {
- return ISOPeriodFormat.standard();
- }
-
- static PeriodFormatter wordFormatter = new PeriodFormatterBuilder()
- .appendYears().appendSuffix(" year", " years").appendSeparator(" ")
- .appendMonths().appendSuffix(" month", " months").appendSeparator(" ")
- .appendDays().appendSuffix(" day", " days").appendSeparator(" ")
- .appendHours().appendSuffix(" hour", " hours").appendSeparator(" ")
- .appendMinutes().appendSuffix(" minute", " minutes").appendSeparator(" ")
- .appendSeconds().appendSuffix(" second", " seconds").appendSeparator(" ")
- .appendMillis3Digit()
- .toFormatter();
-
- public static PeriodFormatter wordFormatter() {
- return wordFormatter;
- }
-
- static PeriodFormatter shortWordFormatter = new PeriodFormatterBuilder()
- .appendDays().appendSuffix("d").appendSeparator(", ")
- .appendHours().appendSuffix("h").appendSeparator(":")
- .appendMinutes().appendSuffix("m").appendSeparator(":")
- .appendSeconds().appendSuffix("s").appendSeparator(", ")
- .appendMillis()
- .toFormatter();
-
- public static PeriodFormatter shortWordFormatter() {
- return shortWordFormatter;
- }
-
- static PeriodFormatter timeFormatter = new PeriodFormatterBuilder().printZeroAlways()
- .appendHours().appendSuffix(":").appendMinutes().appendSuffix(":").appendSeconds()
- .toFormatter();
-
- public static PeriodFormatter getTimeFormatter() {
- return timeFormatter;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DurationType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DurationType.java
deleted file mode 100644
index c113fe2186..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/DurationType.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.BigDecimalValidator;
-import org.joda.time.DateTimeConstants;
-import org.joda.time.Duration;
-import org.joda.time.Period;
-import org.joda.time.PeriodType;
-import org.joda.time.chrono.ISOChronology;
-import org.joda.time.format.PeriodFormatter;
-
-import com.google.common.base.Strings;
-
-public class DurationType extends LongType {
-
- public static final String FMT_WORD = "WORD";
- public static final String FMT_ISO = "ISO";
- public static final String FMT_SHORT_WORD = "SHORT";
-
- @Override
- public Object fromString(String str, String pattern, Locale locale) {
- if (Strings.isNullOrEmpty(str)) {
- return null;
- }
-
- if ("NaN".equalsIgnoreCase(str)) {
- return new Long(0);
- }
-
- if (Strings.isNullOrEmpty(pattern)) {
- try {
- return Long.valueOf(str);
- } catch (NumberFormatException e) {
- Number number = BigDecimalValidator.getInstance().validate(str, locale);
- if (number != null) {
- return number.longValue();
- } else {
- return 0;
- }
- }
- }
-
- PeriodFormatter formatter = getFormatter(pattern, locale);
-
- Period period = formatter.parsePeriod(str);
- return Long.valueOf(period.toStandardDuration().getMillis());
- }
-
- @Override
- public String asString(Object value, String pattern, Locale locale) {
- Long mills = (Long) typeCast(value);
- if (mills == null) {
- return null;
- }
-
- if (Strings.isNullOrEmpty(pattern)) {
- return mills.toString();
- }
-
- if (mills == 0) {
- return "0 mil";
- } else if (mills < DateTimeConstants.MILLIS_PER_SECOND) {
- return mills + " mils";
- }
-
- PeriodFormatter fmt = getFormatter(pattern, locale);
- Duration duration = new Duration(mills);
- return fmt.print(duration.toPeriod(PeriodType.yearMonthDayTime(),
- ISOChronology.getInstanceUTC()));
- }
-
- protected PeriodFormatter getFormatter(String pattern, Locale locale) {
- PeriodFormatter fmt = null;
- if (FMT_WORD.equalsIgnoreCase(pattern)) {
- fmt = DurationFormatUtils.wordFormatter();
- } else if (FMT_ISO.equalsIgnoreCase(pattern)) {
- fmt = DurationFormatUtils.isoFormatter();
- } else if (FMT_SHORT_WORD.equalsIgnoreCase(pattern)) {
- fmt = DurationFormatUtils.shortWordFormatter();
- } else {
- fmt = DurationFormatUtils.createPeriodFormatter(pattern);
- }
- if (locale != null) {
- fmt = fmt.withLocale(locale);
- }
- return fmt;
- }
-
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/EnumType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/EnumType.java
deleted file mode 100644
index cd3975565d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/EnumType.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-@SuppressWarnings("rawtypes")
-public class EnumType extends AbstractDataType {
-
- private final Class<? extends Enum> enumClass;
-
- public EnumType(Class<? extends Enum> enumClass) {
- this.enumClass = enumClass;
- }
-
- public static EnumType of(Class<? extends Enum> clazz) {
- return new EnumType(clazz);
- }
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Enum<?> e = (Enum<?>) typeCast(from);
- if (e == null) {
- return null;
- } else {
- return e.toString();
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return Enum.valueOf(enumClass, value);
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Enum.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- if (from == null || from instanceof Enum) {
- return from;
- }
-
- if (from instanceof String) {
- return fromString((String) from);
- }
-
- if (from instanceof Integer) {
- int i = (Integer) from;
- return enumClass.getEnumConstants()[i];
- }
-
- throw new TypeCastException(this, from);
- }
-
- @Override
- public String getTypeName() {
- return "ENUM";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/FloatType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/FloatType.java
deleted file mode 100644
index 54e6847f14..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/FloatType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.FloatValidator;
-
-public class FloatType extends AbstractNumericType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Float f = (Float) typeCast(from);
- return FloatValidator.getInstance().format(f, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return FloatValidator.getInstance().validate(value, pattern, locale);
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Float.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- return toNumber(from).floatValue();
- }
-
- @Override
- public String getTypeName() {
- return "FLOAT";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/IntegerType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/IntegerType.java
deleted file mode 100644
index 1248f11edf..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/IntegerType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.IntegerValidator;
-
-public class IntegerType extends AbstractNumericType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Integer i = (Integer) typeCast(from);
- return IntegerValidator.getInstance().format(i, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return IntegerValidator.getInstance().validate(value, pattern, locale);
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Integer.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- return toNumber(from).intValue();
- }
-
- @Override
- public String getTypeName() {
- return "INTEGER";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/LongType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/LongType.java
deleted file mode 100644
index b194bd3719..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/LongType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.LongValidator;
-
-public class LongType extends AbstractNumericType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Long l = (Long) typeCast(from);
- return LongValidator.getInstance().format(l, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return LongValidator.getInstance().validate(value, pattern, locale);
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Long.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- return toNumber(from).longValue();
- }
-
- @Override
- public String getTypeName() {
- return "LONG";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/PercentType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/PercentType.java
deleted file mode 100644
index f362ffd3cf..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/PercentType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.PercentValidator;
-
-public class PercentType extends AbstractNumericType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Double d = (Double) typeCast(from);
- return PercentValidator.getInstance().format(d, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return PercentValidator.getInstance().validate(value, pattern, locale).doubleValue();
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Double.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- return toNumber(from).doubleValue();
- }
-
- @Override
- public String getTypeName() {
- return "PERCENT";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/ShortType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/ShortType.java
deleted file mode 100644
index d1d0143b53..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/ShortType.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-import org.apache.commons.validator.routines.ShortValidator;
-
-import com.google.common.base.Strings;
-
-public class ShortType extends AbstractNumericType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- Short s = (Short) typeCast(from);
- return ShortValidator.getInstance().format(s, pattern, locale);
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- if (Strings.isNullOrEmpty(value)) {
- return 0;
- }
-
- return ShortValidator.getInstance().validate(value, pattern, locale);
- }
-
- @Override
- public Class<?> getReturnClass() {
- return Short.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- return toNumber(from).shortValue();
- }
-
- @Override
- public String getTypeName() {
- return "SHORT";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/StringType.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/StringType.java
deleted file mode 100644
index ba42ccc584..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/StringType.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-import java.util.Locale;
-
-public class StringType extends AbstractDataType {
-
- @Override
- public String asString(Object from, String pattern, Locale locale) {
- if (from == null || (from instanceof String)) {
- return (String) from;
- }
-
- return from.toString();
- }
-
- @Override
- public Object fromString(String value, String pattern, Locale locale) {
- return value;
- }
-
- @Override
- public Class<?> getReturnClass() {
- return String.class;
- }
-
- @Override
- public Object typeCast(Object from) {
- if (from == null || (from instanceof String)) {
- return from;
- }
-
- return from.toString();
- }
-
- @Override
- public String getTypeName() {
- return "STRING";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/TypeCastException.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/TypeCastException.java
deleted file mode 100644
index 951cd1697b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/datatype/TypeCastException.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.pmease.gitplex.web.common.datatype;
-
-public class TypeCastException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public TypeCastException(String msg) {
- super(msg);
- }
-
- public TypeCastException(DataType dataType, Object value) {
- this("Cannot cast object [" + value + "] to data type [" + dataType + "]");
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Amount.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Amount.java
deleted file mode 100644
index d4a5821047..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Amount.java
+++ /dev/null
@@ -1,195 +0,0 @@
-package com.pmease.gitplex.web.common.quantity;
-
-import com.google.common.base.Preconditions;
-import com.pmease.commons.util.Pair;
-
-/**
- * Represents a value in a unit system and facilitates unambiguous communication of amounts.
- * Instances are created via static factory {@code of(...)} methods.
- *
- * @param <T> the type of number the amount value is expressed in
- * @param <U> the type of unit that this amount quantifies
- *
- * @author John Sirois
- */
-public abstract class Amount<T extends Number & Comparable<T>, U extends Unit<U>>
- implements Comparable<Amount<T, U>> {
-
- /**
- * Thrown when a checked operation on an amount would overflow.
- */
-
- @SuppressWarnings("serial")
-public static class TypeOverflowException extends RuntimeException {
- public TypeOverflowException() {
- super();
- }
- }
-
- private final Pair<T, U> amount;
- private final T maxValue;
-
- private Amount(T value, U unit, T maxValue) {
- Preconditions.checkNotNull(value);
- Preconditions.checkNotNull(unit);
- this.maxValue = maxValue;
- this.amount = new Pair<T, U>(value, unit);
- }
-
- public T getValue() {
- return amount.getFirst();
- }
-
- public U getUnit() {
- return amount.getSecond();
- }
-
- public T as(U unit) {
- return asUnit(unit);
- }
-
- /**
- * Throws TypeOverflowException if an overflow occurs during scaling.
- */
- public T asChecked(U unit) {
- T retVal = asUnit(unit);
- if (retVal.equals(maxValue)) {
- throw new TypeOverflowException();
- }
- return retVal;
- }
-
- private T asUnit(Unit<?> unit) {
- return sameUnits(unit) ? getValue() : scale(getUnit().multiplier() / unit.multiplier());
- }
-
- @Override
- public int hashCode() {
- return amount.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof Amount)) {
- return false;
- }
-
- Amount<?, ?> other = (Amount<?, ?>) obj;
- return amount.equals(other.amount) || isSameAmount(other);
- }
-
- private boolean isSameAmount(Amount<?, ?> other) {
- // Equals allows Object - so we have no compile time check that other has the right value type;
- // ie: make sure they don't have Integer when we have Long.
- Number value = other.getValue();
- if (!getValue().getClass().isInstance(value)) {
- return false;
- }
-
- Unit<?> unit = other.getUnit();
- if (!getUnit().getClass().isInstance(unit)) {
- return false;
- }
-
- @SuppressWarnings("unchecked")
- U otherUnit = (U) other.getUnit();
- return isSameAmount(other, otherUnit);
- }
-
- private boolean isSameAmount(Amount<?, ?> other, U otherUnit) {
- // Compare in the more precise unit (the one with the lower multiplier).
- if (otherUnit.multiplier() > getUnit().multiplier()) {
- return getValue().equals(other.asUnit(getUnit()));
- } else {
- return as(otherUnit).equals(other.getValue());
- }
- }
-
- @Override
- public String toString() {
- return amount.toString();
- }
-
- @Override
- public int compareTo(Amount<T, U> other) {
- // Compare in the more precise unit (the one with the lower multiplier).
- if (other.getUnit().multiplier() > getUnit().multiplier()) {
- return getValue().compareTo(other.as(getUnit()));
- } else {
- return as(other.getUnit()).compareTo(other.getValue());
- }
- }
-
- private boolean sameUnits(Unit<? extends Unit<?>> unit) {
- return getUnit().equals(unit);
- }
-
- protected abstract T scale(double multiplier);
-
- /**
- * Creates an amount that uses a {@code double} value.
- *
- * @param number the number of units the returned amount should quantify
- * @param unit the unit the returned amount is expressed in terms of
- * @param <U> the type of unit that the returned amount quantifies
- * @return an amount quantifying the given {@code number} of {@code unit}s
- */
- public static <U extends Unit<U>> Amount<Double, U> of(double number, U unit) {
- return new Amount<Double, U>(number, unit, Double.MAX_VALUE) {
- @Override protected Double scale(double multiplier) {
- return getValue() * multiplier;
- }
- };
- }
-
- /**
- * Creates an amount that uses a {@code float} value.
- *
- * @param number the number of units the returned amount should quantify
- * @param unit the unit the returned amount is expressed in terms of
- * @param <U> the type of unit that the returned amount quantifies
- * @return an amount quantifying the given {@code number} of {@code unit}s
- */
- public static <U extends Unit<U>> Amount<Float, U> of(float number, U unit) {
- return new Amount<Float, U>(number, unit, Float.MAX_VALUE) {
- @Override protected Float scale(double multiplier) {
- return (float) (getValue() * multiplier);
- }
- };
- }
-
- /**
- * Creates an amount that uses a {@code long} value.
- *
- * @param number the number of units the returned amount should quantify
- * @param unit the unit the returned amount is expressed in terms of
- * @param <U> the type of unit that the returned amount quantifies
- * @return an amount quantifying the given {@code number} of {@code unit}s
- */
- public static <U extends Unit<U>> Amount<Long, U> of(long number, U unit) {
- return new Amount<Long, U>(number, unit, Long.MAX_VALUE) {
- @Override protected Long scale(double multiplier) {
- return (long) (getValue() * multiplier);
- }
- };
- }
-
- /**
- * Creates an amount that uses an {@code int} value.
- *
- * @param number the number of units the returned amount should quantify
- * @param unit the unit the returned amount is expressed in terms of
- * @param <U> the type of unit that the returned amount quantifies
- * @return an amount quantifying the given {@code number} of {@code unit}s
- */
- public static <U extends Unit<U>> Amount<Integer, U> of(int number, U unit) {
- return new Amount<Integer, U>(number, unit, Integer.MAX_VALUE) {
- @Override protected Integer scale(double multiplier) {
- return (int) (getValue() * multiplier);
- }
- };
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Data.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Data.java
deleted file mode 100644
index ded942c6fd..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Data.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.pmease.gitplex.web.common.quantity;
-
-import com.pmease.gitplex.web.common.datatype.DataTypes;
-
-
-/**
- * Provides a unit to allow conversions and unambiguous passing around of data
- * {@link Amount}s. The kilo/mega/giga/... hierarchy is built on base 2 so that
- * the hierarchy increases by a factor of 1024 instead of 1000 as typical in
- * metric units. Additionally, units are divided in 2 hierarchies one based on
- * bits and the other on bytes. Thus {@link #Kb} represents kilobits; so 1 Kb =
- * 1024 bits, and {@link #KB} represents kilobytes so 1 KB = 1024 bytes or 8192
- * bits.
- *
- * @author John Sirois
- */
-public enum Data implements Unit<Data> {
- BITS(1),
- Kb(1024, BITS),
- Mb(1024, Kb),
- Gb(1024, Mb),
- BYTES(8, BITS),
- KB(1024, BYTES),
- MB(1024, KB),
- GB(1024, MB),
- TB(1024, GB),
- PB(1024, TB);
-
- public static long ONE_KB = Amount.of(1, KB).as(BYTES);
- public static long ONE_MB = Amount.of(1, MB).as(BYTES);
- public static long ONE_GB = Amount.of(1, GB).as(BYTES);
- public static long ONE_TB = Amount.of(1, TB).as(BYTES);
- public static long ONE_PB = Amount.of(1, PB).as(BYTES);
-
-
- private final double multiplier;
-
- private Data(double multiplier) {
- this.multiplier = multiplier;
- }
-
- private Data(double multiplier, Data base) {
- this(multiplier * base.multiplier);
- }
-
- @Override
- public double multiplier() {
- return multiplier;
- }
-
- public static String formatBytes(double bytes) {
- return formatBytes(bytes, BYTES);
- }
-
- public static String formatBytes(double bytes, Data smallestUnit) {
- return formatBytes(bytes, smallestUnit, "0.000");
- }
-
- public static String formatBytes(double bytes, Data smallestUnit, String pattern) {
- Amount<Double, Data> amount = Amount.of(bytes, Data.BYTES);
- double d = 0d;
- Data unit = smallestUnit;
- for (int i = Data.values().length - 1; i >= smallestUnit.ordinal(); i--) {
- d = amount.as(Data.values()[i]);
- if (d >= 1) {
- unit = Data.values()[i];
- break;
- }
- }
-
- String p = pattern;
- if (unit == Data.BYTES) {
- p = "0";
- }
-
- return DataTypes.DOUBLE.asString(amount.as(unit), p) + " " + unit.name().toLowerCase();
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Time.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Time.java
deleted file mode 100644
index 53a52e4791..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Time.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.pmease.gitplex.web.common.quantity;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Provides a unit to allow conversions and unambiguous passing around of time {@link Amount}s.
- *
- * @author John Sirois
- */
-public enum Time implements Unit<Time> {
- NANOSECONDS(1, TimeUnit.NANOSECONDS, "ns"),
- MICROSECONDS(1000, NANOSECONDS, TimeUnit.MICROSECONDS, "us"),
- MILLISECONDS(1000, MICROSECONDS, TimeUnit.MILLISECONDS, "ms"),
- SECONDS(1000, MILLISECONDS, TimeUnit.SECONDS, "secs"),
- MINUTES(60, SECONDS, TimeUnit.MINUTES, "mins"),
- HOURS(60, MINUTES, TimeUnit.HOURS, "hrs"),
- DAYS(24, HOURS, TimeUnit.DAYS, "days");
-
- private final double multiplier;
- private final TimeUnit timeUnit;
- private final String display;
-
- private Time(double multiplier, TimeUnit timeUnit, String display) {
- this.multiplier = multiplier;
- this.timeUnit = timeUnit;
- this.display = display;
- }
-
- private Time(double multiplier, Time base, TimeUnit timeUnit, String display) {
- this(multiplier * base.multiplier, timeUnit, display);
- }
-
- @Override
- public double multiplier() {
- return multiplier;
- }
-
- /**
- * Returns the equivalent {@code TimeUnit}.
- */
- public TimeUnit getTimeUnit() {
- return timeUnit;
- }
-
- @Override
- public String toString() {
- return display;
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Unit.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Unit.java
deleted file mode 100644
index c3fa38204e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/quantity/Unit.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.pmease.gitplex.web.common.quantity;
-
-/**
- * Represents a unit hierarchy for a given unit of measure; eg: time. Instances represent specific
- * units from the hierarchy; eg: seconds.
- *
- * @param <U> the type of the concrete unit implementation
- *
- * @author John Sirois
- */
-public interface Unit<U extends Unit<U>> {
-
- /**
- * Returns the weight of this unit relative to other units in the same hierarchy. Typically the
- * smallest unit in the hierarchy returns 1, but this need not be the case. It is only required
- * that each unit of the hierarchy return a multiplier relative to a common base unit for the
- * hierarchy.
- */
- double multiplier();
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/AjaxIconLink.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/AjaxIconLink.html
deleted file mode 100644
index b55a9b8796..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/AjaxIconLink.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <a wicket:id="link" class="iconlink"><i wicket:id="icon"></i> <span wicket:id="label"></span></a>
-</wicket:panel>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/AjaxIconLink.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/AjaxIconLink.java
deleted file mode 100644
index 47d5dedeaa..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/AjaxIconLink.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.bootstrap;
-
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-
-public abstract class AjaxIconLink extends Panel {
-
- private static final long serialVersionUID = 1L;
-
- private final IModel<String> iconModel;
- private final IModel<String> labelModel;
-
- public AjaxIconLink(String id, IModel<String> iconModel) {
- this(id, iconModel, Model.of(""));
- }
-
- public AjaxIconLink(String id, IModel<String> iconModel,
- IModel<String> labelModel) {
- super(id);
- this.iconModel = iconModel;
- this.labelModel = labelModel;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- AjaxLink<?> link = createLink("link");
- add(link);
- link.add(new Icon("icon", iconModel));
- link.add(new Label("label", labelModel));
- }
-
- @Override
- protected void onDetach() {
- super.onDetach();
-
- if (iconModel != null) {
- iconModel.detach();
- }
-
- if (labelModel != null) {
- labelModel.detach();
- }
- }
-
- abstract protected AjaxLink<?> createLink(String id);
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/Alert.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/Alert.java
deleted file mode 100644
index 5858fb153f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/Alert.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.bootstrap;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-/**
- * Add html message support
- */
-@SuppressWarnings("serial")
-public class Alert extends de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Alert {
-
- private Component message;
-
- /**
- * Constructor.
- *
- * @param id the wicket component id.
- * @param message the alert message
- */
- public Alert(String id, IModel<String> message) {
- super(id, message);
- }
-
- /**
- * Constructor.
- *
- * @param id the wicket component id.
- * @param message the alert message
- * @param header the title of the alert message
- */
- public Alert(String id, IModel<String> message, IModel<String> header) {
- super(id, message, header);
- }
-
- @Override
- protected Component createMessage(final String markupId, final IModel<String> message) {
- this.message = super.createMessage(markupId, message);
- return this.message;
- }
-
- /**
- * Whether or not escape message model strings
- *
- * @param b
- * @return
- */
- public Alert withHtmlMessage(boolean b) {
- if (b) {
- this.message.setEscapeModelStrings(false);
- }
-
- return this;
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/Icon.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/Icon.java
deleted file mode 100644
index acd65ad955..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/bootstrap/Icon.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.bootstrap;
-
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-
-public class Icon extends WebMarkupContainer {
-
- private static final long serialVersionUID = 1L;
-
- public Icon(String id, final String iconClass) {
- this(id, Model.of(iconClass));
- }
-
- @SuppressWarnings("serial")
- public Icon(String id, final IModel<String> iconClass) {
- super(id);
-
- add(AttributeAppender.append("class",
- new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return "fa fa-ext " + iconClass.getObject();
- }
- }));
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/DataGrid.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/DataGrid.java
deleted file mode 100644
index 18ca90f764..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/DataGrid.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.datagrid;
-
-import java.util.List;
-
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.markup.repeater.data.IDataProvider;
-
-import com.pmease.gitplex.web.common.wicket.component.datagrid.event.PageChanged;
-
-@SuppressWarnings("serial")
-public class DataGrid<T> extends DataTable<T, String>{
-
- public DataGrid(String id, List<? extends IColumn<T, String>> columns,
- IDataProvider<T> dataProvider, long rowsPerPage) {
- super(id, columns, dataProvider, rowsPerPage);
-
- setOutputMarkupId(true);
- setVersioned(false);
- }
-
- @Override
- public void onEvent(IEvent<?> event) {
- if (event.getPayload() instanceof PageChanged) {
- PageChanged payload = (PageChanged) event.getPayload();
- setCurrentPage(payload.getPage());
- payload.getTarget().add(this);
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/event/PageChanged.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/event/PageChanged.java
deleted file mode 100644
index 9243998638..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/event/PageChanged.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.datagrid.event;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-
-import com.pmease.commons.wicket.AjaxEvent;
-
-public class PageChanged extends AjaxEvent {
-
- private final int page;
-
- public PageChanged(AjaxRequestTarget target, int page) {
- super(target);
- this.page = page;
- }
-
- public int getPage() {
- return page;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/event/SearchStringChanged.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/event/SearchStringChanged.java
deleted file mode 100644
index bfbd00a9cd..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/event/SearchStringChanged.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.datagrid.event;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-
-import com.pmease.commons.wicket.AjaxEvent;
-
-public class SearchStringChanged extends AjaxEvent {
-
- private final String pattern;
-
- public SearchStringChanged(AjaxRequestTarget target, String pattern) {
- super(target);
- this.pattern = pattern;
- }
-
- public String getPattern() {
- return pattern;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/hibernate/EntityListProvider.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/hibernate/EntityListProvider.java
deleted file mode 100644
index b4dcc2922c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/hibernate/EntityListProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.datagrid.hibernate;
-
-import java.util.List;
-
-import org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
-import org.apache.wicket.markup.repeater.data.ListDataProvider;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.util.WildcardListModel;
-
-import com.pmease.commons.hibernate.AbstractEntity;
-import com.pmease.gitplex.web.model.EntityModel;
-
-@SuppressWarnings("serial")
-public class EntityListProvider<T extends AbstractEntity> extends ListDataProvider<T> implements ISortableDataProvider<T, String> {
-
- final IModel<List<T>> listModel;
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public EntityListProvider(List<T> list) {
- this.listModel = new WildcardListModel(list);
- }
-
- public EntityListProvider(IModel<List<T>> model) {
- this.listModel = model;
- }
-
- @Override
- public IModel<T> model(T object) {
- return new EntityModel<T>(object);
- }
-
- @Override
- protected List<T> getData() {
- return listModel.getObject();
- }
-
- @Override
- public void detach() {
- if (listModel != null) {
- listModel.detach();
- }
-
- super.detach();
- }
-
- @Override
- public ISortState<String> getSortState() {
- return null;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/hibernate/HibernateDataProvider.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/hibernate/HibernateDataProvider.java
deleted file mode 100644
index dfb62d57e3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/hibernate/HibernateDataProvider.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.datagrid.hibernate;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
-import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
-import org.apache.wicket.model.IModel;
-import org.hibernate.criterion.Order;
-
-import com.google.common.base.Splitter;
-import com.pmease.commons.hibernate.AbstractEntity;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.commons.loader.AppLoader;
-import com.pmease.gitplex.web.model.EntityModel;
-
-public abstract class HibernateDataProvider<T extends AbstractEntity> extends SortableDataProvider<T, String> {
- private static final long serialVersionUID = 9007657871051510330L;
-
- abstract protected EntityCriteria<T> getCriteria();
-
- protected Dao getDao() {
- return AppLoader.getInstance(Dao.class);
- }
-
- @Override
- public Iterator<? extends T> iterator(long first, long count) {
- Dao dao = getDao();
- EntityCriteria<T> criteria = getCriteria();
-
- SortParam<String> param = getSort();
- if (param != null) {
- Iterable<String> it = Splitter.on(",").trimResults().split(param.getProperty());
- for (String each : it) {
- if (param.isAscending())
- criteria.addOrder(Order.asc(each));
- else
- criteria.addOrder(Order.desc(each));
- }
- }
-
- List<T> list = (List<T>) dao.query(criteria, (int) first, (int) count);
-
- return list.iterator();
- }
-
- @Override
- public long size() {
- Dao dao = getDao();
- return dao.count(getCriteria());
- }
-
- @Override
- public IModel<T> model(T object) {
- return new EntityModel<T>(object);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/AjaxPagingNavigator.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/AjaxPagingNavigator.html
deleted file mode 100644
index afa2dd9b76..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/AjaxPagingNavigator.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<html xmlns:wicket="http://wicket.apache.org">
-<body>
-<wicket:panel>
- <ul class="pagination pagination-sm">
- <li><a wicket:id="first" class="first"><i class="icon-double-angle-left"></i></a></li>
- <li><a wicket:id="prev"><i class="icon-angle-left"></i></a></li>
- <wicket:container wicket:id="navigation">
- <li><a wicket:id="pageLink" href="#"><span wicket:id="pageNumber">5</span></a></li>
- </wicket:container>
- <li><a wicket:id="next"><i class="icon-angle-right"></i></a></li>
- <li><a wicket:id="last" class="last"><i class="icon-double-angle-right"></i></a></li>
- </ul>
-</wicket:panel>
-</body>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/AjaxPagingNavigator.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/AjaxPagingNavigator.java
deleted file mode 100644
index 8934fd049f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/AjaxPagingNavigator.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.datagrid.toolbar;
-
-import org.apache.wicket.markup.html.navigation.paging.IPageable;
-import org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider;
-
-public class AjaxPagingNavigator extends org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator {
- private static final long serialVersionUID = 1L;
-
- public AjaxPagingNavigator(String id, IPageable pageable) {
- super(id, pageable);
- }
-
- public AjaxPagingNavigator(final String id, final IPageable pageable,
- final IPagingLabelProvider labelProvider) {
- super(id, pageable, labelProvider);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/SearchNavToolbar.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/SearchNavToolbar.html
deleted file mode 100644
index 3a21b6555d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/SearchNavToolbar.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <tr class="search-nav-tr">
- <td wicket:id="td" class="search-nav-td">
- <div class="clearfix">
- <div class="pull-left" wicket:id="search"></div>
- <div class="pull-right" wicket:id="nav"></div>
- </div>
- </td>
- </tr>
-
- <wicket:fragment wicket:id="searchFrag">
- <form class="form-inline search-form" wicket:id="searchForm">
- <input type="text" class="form-control input-sm" wicket:id="input" />
- <button type="button" class="search-icon" wicket:id="submit"><i class="icon-search"></i></button>
- </form>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="navFrag">
- <form class="form-inline navigation-form" wicket:id="form">
- <span>Show rows:</span>
- <select class="form-control input-sm" wicket:id="rowsSelector"></select>
- <span>Go to:</span>
- <input class="form-control input-sm" type="text" value="1" autocomplete="off" wicket:id="pageInput" />
- <span wicket:id="navlabel"></span>
- <div class="btn-group">
- <a class="btn btn-default btn-xs" wicket:id="previousLink"><i class="icon-chevron-left"></i></a>
- <a class="btn btn-default btn-xs" wicket:id="nextLink"><i class="icon-chevron-right"></i></a>
- </div>
-
- <input type="hidden" value="go" wicket:id="submit" />
- </form>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/SearchNavToolbar.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/SearchNavToolbar.java
deleted file mode 100644
index 92f8714516..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/datagrid/toolbar/SearchNavToolbar.java
+++ /dev/null
@@ -1,247 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.datagrid.toolbar;
-
-import java.util.List;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractToolbar;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.PropertyModel;
-
-import com.google.common.collect.ImmutableList;
-import com.pmease.gitplex.web.common.wicket.component.datagrid.event.PageChanged;
-import com.pmease.gitplex.web.common.wicket.component.datagrid.event.SearchStringChanged;
-
-public class SearchNavToolbar extends AbstractToolbar {
-
- private static final long serialVersionUID = 1L;
-
- public SearchNavToolbar(DataTable<?, ?> table) {
- super(table);
-
- setOutputMarkupId(true);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- WebMarkupContainer span = new WebMarkupContainer("td");
- add(span);
- span.add(AttributeModifier.replace("colspan",
- new AbstractReadOnlyModel<String>() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getObject() {
- return String.valueOf(getTable().getColumns().size());
- }
- }));
-
- span.add(newSearchForm("search"));
- span.add(newNavigationForm("nav"));
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- this.setVisibilityAllowed(getTable().getRowCount() > 0);
- }
-
- protected Component newSearchForm(String id) {
- Fragment frag = new Fragment(id, "searchFrag", this);
- frag.add(new SearchForm("searchForm"));
- return frag;
- }
-
- @SuppressWarnings({ "serial" })
- private class SearchForm extends Form<Void> {
-
- private String pattern;
-
- public SearchForm(String id) {
- super(id);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- TextField<String> input = new TextField<String>("input",
- new PropertyModel<String>(this, "pattern"));
- add(input);
- IndicatingAjaxButton submit = new IndicatingAjaxButton("submit",
- this) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- send(getTable(), Broadcast.BREADTH,
- new SearchStringChanged(target, pattern));
- }
- };
- add(submit);
- setDefaultButton(submit);
- }
-
- @Override
- public void onEvent(IEvent<?> event) {
- if (event.getPayload() instanceof SearchStringChanged) {
- SearchStringChanged e = (SearchStringChanged) event
- .getPayload();
- this.pattern = e.getPattern();
- e.getTarget().add(this);
- }
- }
- }
-
- protected void onPageChanged(AjaxRequestTarget target) {
- target.add(getTable());
- target.add(this);
- }
-
- protected Component newNavigationForm(String id) {
- Fragment frag = new Fragment(id, "navFrag", this);
- frag.add(new NavigationForm("form"));
- return frag;
- }
-
- static final List<Integer> ROWS_PER_PAGE = ImmutableList.<Integer> of(10,
- 25, 50, 100, 250, 500);
-
- @SuppressWarnings({ "serial" })
- private class NavigationForm extends Form<Void> {
-
- private int rowsPerPage = 10;
- private int currentPage = 1;
-
- public NavigationForm(String id) {
- super(id);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- rowsPerPage = (int) getTable().getItemsPerPage();
- currentPage = (int) getTable().getCurrentPage() + 1;
-
- DropDownChoice<Integer> rowsSelector = new DropDownChoice<Integer>(
- "rowsSelector", new PropertyModel<Integer>(this,
- "rowsPerPage"), ROWS_PER_PAGE);
- add(rowsSelector);
- rowsSelector.add(new AjaxFormComponentUpdatingBehavior("onchange") {
-
- @Override
- protected void onUpdate(AjaxRequestTarget target) {
- currentPage = 1;
- getTable().setItemsPerPage(rowsPerPage);
- send(getTable(), Broadcast.BREADTH, new PageChanged(target,
- currentPage - 1));
- }
- });
-
- add(new AjaxLink<Void>("previousLink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- long current = getTable().getCurrentPage();
- if (current == 0) {
- return;
- }
-
- current--;
- if (current < 0) {
- current = 0;
- }
-
- send(getTable(), Broadcast.BREADTH, new PageChanged(target,
- (int) current));
- }
- });
-
- add(new AjaxLink<Void>("nextLink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- long current = getTable().getCurrentPage();
- long totals = getTable().getPageCount();
- if (current == totals) {
- return;
- }
-
- current++;
- if (current >= totals) {
- current = totals - 1;
- }
-
- send(getTable(), Broadcast.BREADTH, new PageChanged(target,
- (int) current));
- }
-
- });
-
- add(new TextField<Integer>("pageInput", new PropertyModel<Integer>(
- this, "currentPage")));
-
- AjaxButton btn = new AjaxButton("submit", this) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- if (currentPage == getTable().getCurrentPage() + 1) {
- return;
- }
-
- long totals = getTable().getPageCount();
- currentPage = Math.min(currentPage, (int) totals);
- currentPage = Math.max(currentPage, 0);
-
- send(getTable(), Broadcast.BREADTH, new PageChanged(target,
- currentPage - 1));
- }
-
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- target.add(form);
- }
- };
- add(btn);
- setDefaultButton(btn);
-
- add(new Label("navlabel", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- long totals = getTable().getRowCount();
- long items = getTable().getItemsPerPage();
- long start = (currentPage - 1) * items + 1;
- long end = start + items - 1;
- end = Math.min(end, totals);
- return start + " - " + end + " of " + totals;
- }
- }));
- }
-
- @Override
- public void onEvent(IEvent<?> event) {
- if (event.getPayload() instanceof PageChanged) {
- PageChanged e = (PageChanged) event.getPayload();
- currentPage = e.getPage() + 1;
- rowsPerPage = (int) getTable().getItemsPerPage();
- e.getTarget().add(this);
- }
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/link/LinkPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/link/LinkPanel.html
deleted file mode 100644
index efdc0d8738..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/link/LinkPanel.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <a wicket:id="link"><span wicket:id="text"></span></a>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/link/LinkPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/link/LinkPanel.java
deleted file mode 100644
index 02a2d5bd8c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/link/LinkPanel.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.link;
-
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-@SuppressWarnings("serial")
-public abstract class LinkPanel extends Panel {
-
- private final IModel<String> labelModel;
-
- public LinkPanel(String id, IModel<?> model, IModel<String> labelModel) {
- super(id, model);
- this.labelModel = labelModel;
- }
-
- public LinkPanel(String id, IModel<String> labelModel) {
- this(id, null, labelModel);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- AbstractLink link = createLink("link");
- add(link);
- link.add(new Label("text", labelModel.getObject()));
- }
-
- @Override
- public void onDetach() {
- if (labelModel != null) {
- labelModel.detach();
- }
-
- super.onDetach();
- }
-
- protected abstract AbstractLink createLink(String id);
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/tab/BootstrapTabbedPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/tab/BootstrapTabbedPanel.html
deleted file mode 100644
index 585cc9c7ba..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/tab/BootstrapTabbedPanel.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <ul class="nav nav-tabs">
- <li wicket:id="tab-links">
- <wicket:container wicket:id="tab-link"></wicket:container>
- </li>
- </ul>
- <div class="tab-content">
- <div wicket:id="tab-contents" class="tab-pane">
- <wicket:container wicket:id="panel"></wicket:container>
- </div>
- </div>
-
- <wicket:fragment wicket:id="linkfrag">
- <a data-toggle="tab" wicket:id="link"><span wicket:id="title"></span></a>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/tab/BootstrapTabbedPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/tab/BootstrapTabbedPanel.java
deleted file mode 100644
index 23b0f49cd6..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/component/tab/BootstrapTabbedPanel.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.component.tab;
-
-import java.util.List;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.extensions.markup.html.tabs.ITab;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.Loop;
-import org.apache.wicket.markup.html.list.LoopItem;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.util.lang.Args;
-
-import com.google.common.base.Strings;
-
-@SuppressWarnings("serial")
-public class BootstrapTabbedPanel<T extends ITab> extends Panel {
-
- private final List<T> tabs;
- private final Loop tabContent;
- private final IModel<Integer> tabCount;
-
- public BootstrapTabbedPanel(String id, List<T> tabs) {
- this(id, tabs, null);
- }
-
- public BootstrapTabbedPanel(String id, List<T> tabs, IModel<Integer> activeTab) {
- super(id, activeTab);
-
- this.tabs = Args.notNull(tabs, "tabs");
- tabCount = new AbstractReadOnlyModel<Integer>() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public Integer getObject() {
- return BootstrapTabbedPanel.this.tabs.size();
- }
- };
-
- add(newTabLinks("tab-links", tabCount));
-
- add(tabContent = newTabContent("tab-contents", tabCount));
- }
-
- protected Component newTabLinks(String id, IModel<Integer> tabCount) {
- return new Loop(id, tabCount) {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- configureTabLinks(this);
- }
-
- @Override
- protected void populateItem(final LoopItem item) {
- final int index = item.getIndex();
- item.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return isTabSelected(index) ? "active" : "";
- }
-
- }));
-
- item.add(newTabLink("tab-link", item.getIndex()));
- }
- };
- }
-
- protected void configureTabLinks(Component loop) {
-
- }
-
- protected Loop newTabContent(String id, IModel<Integer> tabCount) {
- return new Loop(id, tabCount) {
-
- @Override
- protected void populateItem(LoopItem item) {
- final int index = item.getIndex();
- item.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return isTabSelected(index) ? "active" : "";
- }
-
- }));
-
- item.add(newTabContent("panel", item.getIndex()));
- }
- };
- }
-
- protected Component newTabLink(String id, final int index) {
- T tab = tabs.get(index);
- Fragment frag = new Fragment(id, "linkfrag", BootstrapTabbedPanel.this);
- WebMarkupContainer link = new WebMarkupContainer("link");
- frag.add(link);
- link.add(new Label("title", tab.getTitle()));
- link.add(AttributeModifier.replace("href", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return "#" + tabContent.get(index).getMarkupId(true);
- }
-
- }));
-
- return frag;
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- String onShownScript = getOnShownScript();
- if (!Strings.isNullOrEmpty(onShownScript)) {
- StringBuffer sb = new StringBuffer();
- sb.append("$('#" + getMarkupId(true) + " a[data-toggle=\"tab\"]')")
- .append(".on('shown.bs.tab', ")
- .append(onShownScript)
- .append(")");
-
- response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
- }
-
- }
-
- protected String getOnShownScript() {
- return null;
- }
-
- protected final boolean isTabSelected(int index) {
- if (getActiveTab() == null) {
- return index == 0;
- } else {
- return index == getActiveTab();
- }
- }
-
- protected Component newTabContent(String id, int index) {
- T tab = tabs.get(index);
- return tab.getPanel(id);
- }
-
- public Integer getActiveTab() {
- return (Integer) getDefaultModelObject();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractChoiceElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractChoiceElement.java
deleted file mode 100644
index d165652df7..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractChoiceElement.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.wicket.markup.html.form.IChoiceRenderer;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.util.WildcardListModel;
-
-public abstract class AbstractChoiceElement<T, B extends AbstractChoiceElement<T, B>>
- extends AbstractInputElement<T, B> {
-
- private static final long serialVersionUID = 1L;
-
- protected IModel<T> inputModel;
- protected IModel<List<? extends T>> choicesModel;
- protected IChoiceRenderer<? super T> choiceRenderer;
-
- public AbstractChoiceElement(String id, String label, IModel<T> inputModel, List<? extends T> choices) {
- this(id, label, inputModel, choices, null, false);
- }
-
- public AbstractChoiceElement(String id, String label, IModel<T> inputModel, List<? extends T> choices,
- IChoiceRenderer<? super T> renderer) {
- this(id, label, inputModel, choices, renderer, false);
- }
-
- public AbstractChoiceElement(String id, String label, IModel<T> inputModel, List<? extends T> choices,
- IChoiceRenderer<? super T> choiceRenderer, boolean required) {
- this(id, label, inputModel, new WildcardListModel<T>(choices), choiceRenderer, required);
- }
-
- public AbstractChoiceElement(String id, String label, IModel<T> inputModel) {
- this(id, label, inputModel, new WildcardListModel<T>(new ArrayList<T>()));
- }
-
- public AbstractChoiceElement(String id, String label, IModel<T> inputModel,
- IModel<List<? extends T>> choicesModel) {
- this(id, label, inputModel, choicesModel, null);
- }
-
- public AbstractChoiceElement(String id, String label, IModel<T> inputModel,
- IModel<List<? extends T>> choicesModel, IChoiceRenderer<? super T> choiceRenderer) {
- this(id, label, inputModel, choicesModel, choiceRenderer, false);
- }
-
- public AbstractChoiceElement(String id, String label, IModel<T> inputModel,
- IModel<List<? extends T>> choicesModel, IChoiceRenderer<? super T> choiceRenderer,
- boolean required) {
- super(id, label, required);
-
- this.inputModel = inputModel;
- this.choicesModel = choicesModel;
- this.choiceRenderer = choiceRenderer;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractInputElement.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractInputElement.html
deleted file mode 100644
index 5c4821f0c6..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractInputElement.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="form-group" wicket:id="fieldContainer">
- <wicket:enclosure child="label">
- <label class="control-label"><span wicket:id="label"></span><em class="required" wicket:id="required"></em></label>
- </wicket:enclosure>
- <div class="field-controls">
- <div wicket:id="input"></div>
- <div class="field-feedback help-block" wicket:id="feedback"></div>
- <div class="field-help" wicket:id="help"></div>
- </div>
- </div>
-</wicket:panel>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractInputElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractInputElement.java
deleted file mode 100644
index d9efe013b1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/AbstractInputElement.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.feedback.IFeedbackMessageFilter;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.validation.IValidator;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
-
-public abstract class AbstractInputElement<T, B extends AbstractInputElement<T, B>>
- extends ValidatableElement<T> {
-
- private static final long serialVersionUID = 1L;
-
- private final String label;
- private boolean required = true;
- private boolean readOnly = false;
- private String help;
- private List<IValidator<T>> validators = Lists.newArrayList();
- private List<Behavior> behaviors = Lists.newArrayList();
- private String extraCssClass = "";
-
- abstract protected Component createInputComponent(String id);
-
- abstract protected void addValidator(IValidator<T> validator);
-
- abstract protected IFeedbackMessageFilter getFeedbackMessageFilter();
-
- abstract protected B self();
-
- public AbstractInputElement(String id, String label) {
- super(id);
- this.label = label;
- }
-
- public AbstractInputElement(String id, String label, boolean required) {
- super(id);
- this.label = label;
- this.required = required;
- }
-
- public AbstractInputElement(String id, String label, String help) {
- this(label, help, true);
- }
-
- public AbstractInputElement(String id, String label, String help,
- boolean required) {
- super(id);
- this.label = label;
- this.help = help;
- this.required = required;
- }
-
- public boolean hasError() {
- return getFormComponent().hasErrorMessage();
- }
-
- public B add(IValidator<T> validator) {
- validators.add(validator);
- return self();
- }
-
- public B addFormComponentBehavior(Behavior behavior) {
- behaviors.add(behavior);
- return self();
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- MarkupContainer container = new WebMarkupContainer("fieldContainer");
- add(container);
- container.add(createFieldLabel("label"));
- container.add(createRequiredLabel("required"));
- container.add(createHelpLabel("help"));
-
- FeedbackPanel feedback = new FeedbackPanel("feedback", container);
-
- feedback.setOutputMarkupId(true);
- container.add(feedback);
-
- Component c = createInputComponent("input");
-
- container.add(c);
-
- feedback.setFilter(getFeedbackMessageFilter());
-
- for (IValidator<T> each : validators) {
- addValidator(each);
- }
-
- for (Behavior each : behaviors) {
- getFormComponent().add(each);
- }
- }
-
- public String getExtraCssClass() {
- return extraCssClass;
- }
-
- public B setExtraCssClass(String extraCssClass) {
- this.extraCssClass = extraCssClass;
- return self();
- }
-
- protected Component createFieldLabel(String id) {
- return new Label(id, label).setVisibilityAllowed(
- !Strings.isNullOrEmpty(label)).setEscapeModelStrings(false);
- }
-
- protected Component createRequiredLabel(String id) {
- return new Label(id, new AbstractReadOnlyModel<String>() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getObject() {
- return isRequired() ? "*" : "&nbsp;";
- }
- }).setEscapeModelStrings(false).setVisibilityAllowed(
- !Strings.isNullOrEmpty(label));
- }
-
- protected Component createHelpLabel(String id) {
- return new Label(id, help).setVisibilityAllowed(
- !Strings.isNullOrEmpty(help)).setEscapeModelStrings(false);
- }
-
- public boolean isRequired() {
- return required;
- }
-
- public B setRequired(boolean required) {
- this.required = required;
- return self();
- }
-
- public boolean isReadOnly() {
- return readOnly;
- }
-
- public B setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- return self();
- }
-
- public String getHelp() {
- return help;
- }
-
- public B setHelp(String help) {
- this.help = help;
- return self();
- }
-
- public String getLabel() {
- return label;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/FeedbackStyle.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/FeedbackStyle.java
deleted file mode 100644
index 61583fcc16..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/FeedbackStyle.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
-import org.apache.wicket.feedback.ContainerFeedbackMessageFilter;
-import org.apache.wicket.feedback.FeedbackMessage;
-import org.apache.wicket.feedback.FeedbackMessagesModel;
-import org.apache.wicket.markup.ComponentTag;
-
-/**
- * Copied from https://github.com/55minutes/fiftyfive-wicket/blob/master/fiftyfive-wicket-core/src/main/java/fiftyfive/wicket/feedback/FeedbackStyle.java
- *
- * Automatically adds an appropriate CSS feedback class to a component if that component or any of
- * its descendants have feedback messages.
- * <p>
- * For example, let's say our Java looks like this:
- *
- * <pre class="example">
- * add(new RequiredTextField("username").add(FeedbackStyle.INSTANCE));</pre>
- * <p>
- * Our HTML is:
- *
- * <pre class="example">
- * &lt;input type="text" wicket:id="username" /&gt;</pre>
- * <p>
- * Now, when our text field has a validation message to report, for example when the user submits
- * the form without filling in the required value, our component will render like this:
- *
- * <pre class="example">
- * &lt;input type="text" class="feedbackPanelERROR" /&gt;</pre>
- * <p>
- * Notice how the {@code <input>} gains the appropriate CSS class.
- *
- */
-public class FeedbackStyle extends Behavior {
- private static final long serialVersionUID = 1L;
-
- public static final FeedbackStyle INSTANCE = new FeedbackStyle();
-
- @Override
- public void onComponentTag(Component c, ComponentTag tag) {
- List<FeedbackMessage> msgs = newFeedbackMessagesModel(c).getObject();
- if (msgs.size() > 0) {
- StringBuffer newClassValue = new StringBuffer(tag.getAttributes().getString("class", ""));
- Set<String> classes = new HashSet<String>();
- for (FeedbackMessage m : msgs) {
- String cssClass = getCssClass(m);
- if (classes.add(cssClass)) {
- if (newClassValue.length() > 0) {
- newClassValue.append(" ");
- }
- newClassValue.append(cssClass);
- }
- }
- tag.put("class", newClassValue.toString());
- tag.setModified(true);
- }
- }
-
- protected FeedbackMessagesModel newFeedbackMessagesModel(Component c) {
- FeedbackMessagesModel model = new FeedbackMessagesModel(c);
- if (c instanceof MarkupContainer) {
- model.setFilter(new ContainerFeedbackMessageFilter((MarkupContainer) c));
- } else {
- model.setFilter(new ComponentFeedbackMessageFilter(c));
- }
- return model;
- }
-
- protected String getCssClass(FeedbackMessage msg) {
- return "feedbackPanel" + msg.getLevelAsString();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/FormElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/FormElement.java
deleted file mode 100644
index 11a590d0ce..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/FormElement.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form;
-
-import org.apache.wicket.markup.html.panel.Panel;
-
-public class FormElement extends Panel {
- private static final long serialVersionUID = 1L;
-
- public FormElement(String id) {
- super(id);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/ValidatableElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/ValidatableElement.java
deleted file mode 100644
index 11e2ca7c76..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/ValidatableElement.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form;
-
-import org.apache.wicket.markup.html.form.FormComponent;
-
-public abstract class ValidatableElement<T> extends FormElement {
-
- private static final long serialVersionUID = 1L;
-
- public ValidatableElement(String id) {
- super(id);
- }
-
- abstract public FormComponent<T> getFormComponent();
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElement.java
deleted file mode 100644
index 1dbd9691d0..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElement.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.checkbox;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
-import org.apache.wicket.feedback.IFeedbackMessageFilter;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.CheckBox;
-import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.validation.IValidator;
-
-import com.google.common.base.Strings;
-import com.pmease.gitplex.web.common.wicket.form.AbstractInputElement;
-
-public class CheckBoxElement extends
- AbstractInputElement<Boolean, CheckBoxElement> {
-
- private static final long serialVersionUID = 1L;
-
- protected IModel<String> description;
- protected IModel<Boolean> model;
- protected CheckBox checkbox;
-
- public CheckBoxElement(String id, IModel<Boolean> inputModel,
- IModel<String> description) {
- this(id, "", inputModel, description);
- }
-
- public CheckBoxElement(String id, String label, IModel<Boolean> inputModel,
- IModel<String> description) {
- super(id, label);
- this.model = inputModel;
- this.description = description;
- setRequired(false);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
- }
-
- @Override
- public FormComponent<Boolean> getFormComponent() {
- return checkbox;
- }
-
- @Override
- protected Component createInputComponent(String id) {
- CheckBoxElementPanel panel = new CheckBoxElementPanel(id);
- panel.setRenderBodyOnly(true);
-
- checkbox = new CheckBox("check", model);
- panel.add(checkbox);
- Label label = (Label) createDescriptionLabel("description");
-
- panel.add(label);
- return panel;
- }
-
- protected Component createDescriptionLabel(String id) {
- return new Label(id, description).setVisibilityAllowed(
- description != null
- && !Strings.isNullOrEmpty(description.getObject()))
- .setEscapeModelStrings(isEscapeDescriptionString());
- }
-
- protected boolean isEscapeDescriptionString() {
- return false;
- }
-
- @Override
- protected void addValidator(IValidator<Boolean> validator) {
- checkbox.add(validator);
- }
-
- @Override
- protected IFeedbackMessageFilter getFeedbackMessageFilter() {
- return new ComponentFeedbackMessageFilter(checkbox);
- }
-
- @Override
- protected CheckBoxElement self() {
- return this;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElementPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElementPanel.html
deleted file mode 100644
index b3f79c4f3e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElementPanel.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
- xml:lang="en" lang="en-US">
-<wicket:panel>
- <div class="checkbox">
- <label> <input type="checkbox" wicket:id="check" /> <span wicket:id="description"></span></label>
- </div>
-</wicket:panel>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElementPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElementPanel.java
deleted file mode 100644
index 870b8517a9..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/checkbox/CheckBoxElementPanel.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.checkbox;
-
-import org.apache.wicket.markup.html.panel.Panel;
-
-public class CheckBoxElementPanel extends Panel {
-
- private static final long serialVersionUID = 1L;
-
- public CheckBoxElementPanel(String id) {
- super(id);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElement.java
deleted file mode 100644
index 9b85b96847..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElement.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.passwordfield;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
-import org.apache.wicket.feedback.IFeedbackMessageFilter;
-import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.markup.html.form.PasswordTextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.validation.IValidator;
-
-import com.pmease.gitplex.web.common.wicket.form.AbstractInputElement;
-
-public class PasswordFieldElement extends
- AbstractInputElement<String, PasswordFieldElement> {
-
- private static final long serialVersionUID = 1L;
-
- private IModel<String> model;
- private int size;
- private PasswordTextField passwordField;
-
- public PasswordFieldElement(String id, String label, IModel<String> model) {
- this(id, label, model, true);
- }
-
- public PasswordFieldElement(String id, String label, IModel<String> model,
- boolean required) {
- super(id, label, required);
- this.model = model;
- }
-
- @Override
- public FormComponent<String> getFormComponent() {
- return passwordField;
- }
-
- @Override
- protected Component createInputComponent(String id) {
- PasswordFieldElementPanel panel = new PasswordFieldElementPanel(id);
- panel.setRenderBodyOnly(true);
- passwordField = newTextInput("inputField");
- panel.add(passwordField);
-
- return panel;
- }
-
- protected PasswordTextField newTextInput(String id) {
- PasswordTextField passwordField = new PasswordTextField(id, model) {
- private static final long serialVersionUID = 1L;
-
- @Override
- public boolean isEnabled() {
- return !isReadOnly();
- }
- };
-
- passwordField.setRequired(isRequired());
- passwordField.setResetPassword(false);
- passwordField.setLabel(Model.of(getLabel()));
-
- if (size > 0) {
- passwordField.add(AttributeModifier.replace("size",
- String.valueOf(size)));
- }
-
- return passwordField;
- }
-
- @Override
- protected void addValidator(IValidator<String> validator) {
- passwordField.add(validator);
- }
-
- @Override
- protected IFeedbackMessageFilter getFeedbackMessageFilter() {
- return new ComponentFeedbackMessageFilter(passwordField);
- }
-
- public int getSize() {
- return size;
- }
-
- public PasswordFieldElement setSize(int size) {
- this.size = size;
- return this;
- }
-
- @Override
- protected PasswordFieldElement self() {
- return this;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElementPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElementPanel.html
deleted file mode 100644
index 629f269be0..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElementPanel.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
- xml:lang="en" lang="en-US">
-<wicket:panel>
- <input type="password" wicket:id="inputField" class="form-control inputbox focusable"></input>
-</wicket:panel>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElementPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElementPanel.java
deleted file mode 100644
index e6a52fdf8c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/passwordfield/PasswordFieldElementPanel.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.passwordfield;
-
-import org.apache.wicket.markup.html.panel.Panel;
-
-public class PasswordFieldElementPanel extends Panel {
-
- private static final long serialVersionUID = 1L;
-
- public PasswordFieldElementPanel(String id) {
- super(id);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoiceElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoiceElement.java
deleted file mode 100644
index 30f79e6064..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoiceElement.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.select;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
-import org.apache.wicket.feedback.IFeedbackMessageFilter;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.markup.html.form.IChoiceRenderer;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.util.WildcardListModel;
-import org.apache.wicket.validation.IValidator;
-
-import com.pmease.gitplex.web.common.wicket.form.AbstractChoiceElement;
-
-public class DropDownChoiceElement<T> extends AbstractChoiceElement<T, DropDownChoiceElement<T>> {
-
- private static final long serialVersionUID = 1L;
-
- private DropDownChoice<T> dropdownChoice;
-
- public DropDownChoiceElement(String id, String label, IModel<T> inputModel, List<? extends T> choices) {
- super(id, label, inputModel, choices);
- }
-
- public DropDownChoiceElement(String id, String label, IModel<T> inputModel,
- List<? extends T> choices, IChoiceRenderer<? super T> renderer) {
- super(id, label, inputModel, choices, renderer);
- }
-
- public DropDownChoiceElement(
- String id,
- String label,
- IModel<T> inputModel,
- List<? extends T> choices,
- IChoiceRenderer<? super T> choiceRenderer,
- boolean required) {
- super(id, label, inputModel, new WildcardListModel<T>(choices), choiceRenderer, required);
- }
-
- public DropDownChoiceElement(String id, String label, IModel<T> inputModel) {
- super(id, label, inputModel);
- }
-
- public DropDownChoiceElement(String id, String label,
- IModel<T> inputModel,
- IModel<List<? extends T>> choicesModel) {
- super(id, label, inputModel, choicesModel);
- }
-
- public DropDownChoiceElement(String id, String label,
- IModel<T> inputModel,
- IModel<List<? extends T>> choicesModel,
- IChoiceRenderer<? super T> choiceRenderer) {
- super(id, label, inputModel, choicesModel, choiceRenderer);
- }
-
- public DropDownChoiceElement(String id, String label,
- IModel<T> inputModel,
- IModel<List<? extends T>> choicesModel,
- IChoiceRenderer<? super T> choiceRenderer,
- boolean required) {
- super(id, label, inputModel, choicesModel, choiceRenderer, required);
- }
-
- @Override
- protected Component createInputComponent(String id) {
- DropDownChoicePanel panel = new DropDownChoicePanel(id);
- dropdownChoice = newDropDownChoice("select");
- panel.add(dropdownChoice);
- return panel;
- }
-
- protected DropDownChoice<T> newDropDownChoice(String id) {
- return new DropDownChoice<T>(id, inputModel, choicesModel, choiceRenderer);
- }
-
- @Override
- protected void addValidator(IValidator<T> validator) {
- dropdownChoice.add(validator);
- }
-
- @Override
- protected IFeedbackMessageFilter getFeedbackMessageFilter() {
- return new ComponentFeedbackMessageFilter(dropdownChoice);
- }
-
- @Override
- public FormComponent<T> getFormComponent() {
- return dropdownChoice;
- }
-
- @Override
- protected DropDownChoiceElement<T> self() {
- return this;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoicePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoicePanel.html
deleted file mode 100644
index d15574a59e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoicePanel.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
- xml:lang="en" lang="en-US">
-<wicket:panel>
- <select wicket:id="select" class="form-control selectbox"></select>
-</wicket:panel>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoicePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoicePanel.java
deleted file mode 100644
index 68611779bf..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/select/DropDownChoicePanel.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.select;
-
-import org.apache.wicket.markup.html.panel.Panel;
-
-public class DropDownChoicePanel extends Panel {
-
- private static final long serialVersionUID = 1L;
-
- public DropDownChoicePanel(String id) {
- super(id);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElement.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElement.java
deleted file mode 100644
index c8d425b62f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElement.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.textfield;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
-import org.apache.wicket.feedback.IFeedbackMessageFilter;
-import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.util.convert.IConverter;
-import org.apache.wicket.validation.IValidator;
-
-import com.pmease.gitplex.web.common.wicket.form.AbstractInputElement;
-
-public class TextFieldElement<T> extends
- AbstractInputElement<T, TextFieldElement<T>> {
-
- private static final long serialVersionUID = 1L;
-
- private IModel<T> model;
- private int size;
- private TextField<T> textField;
-
- public TextFieldElement(String id, String label, IModel<T> inputModel) {
- this(id, label, inputModel, true);
- }
-
- public TextFieldElement(String id, String label, IModel<T> inputModel,
- int size) {
- this(id, label, inputModel, true, size);
- }
-
- public TextFieldElement(String id, String label, IModel<T> inputModel,
- boolean required) {
- this(id, label, inputModel, required, -1);
- }
-
- public TextFieldElement(String id, String label, IModel<T> inputModel,
- boolean required, int size) {
- super(id, label, required);
- this.model = inputModel;
- this.size = size;
- }
-
- @Override
- public FormComponent<T> getFormComponent() {
- return textField;
- }
-
- @Override
- protected Component createInputComponent(String id) {
- TextFieldElementPanel panel = new TextFieldElementPanel(id);
- panel.setRenderBodyOnly(true);
- textField = newTextInput("inputField");
- textField.setRequired(isRequired());
- textField.setEnabled(!isReadOnly());
- textField.setLabel(Model.of(getLabel()));
- panel.add(textField);
-
- return panel;
- }
-
- protected TextField<T> newTextInput(String id) {
- TextField<T> textField = new TextField<T>(id, model) {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public <C> IConverter<C> getConverter(Class<C> type) {
- return getComponentConverter(type);
- }
- };
-
- if (size > 0) {
- textField.add(AttributeModifier.replace("size",
- String.valueOf(size)));
- }
-
- return textField;
- }
-
- protected <C> IConverter<C> getComponentConverter(Class<C> type) {
- return getApplication().getConverterLocator().getConverter(type);
- }
-
- @Override
- protected void addValidator(IValidator<T> validator) {
- textField.add(validator);
- }
-
- @Override
- protected IFeedbackMessageFilter getFeedbackMessageFilter() {
- return new ComponentFeedbackMessageFilter(getFormComponent());
- }
-
- @Override
- protected TextFieldElement<T> self() {
- return this;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElementPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElementPanel.html
deleted file mode 100644
index 66466b97fb..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElementPanel.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
- xml:lang="en" lang="en-US">
-<wicket:panel>
- <input type="text" wicket:id="inputField" class="form-control inputbox focusable"></input>
-</wicket:panel>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElementPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElementPanel.java
deleted file mode 100644
index b980a780bd..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/form/textfield/TextFieldElementPanel.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.form.textfield;
-
-import org.apache.wicket.markup.html.panel.Panel;
-
-public class TextFieldElementPanel extends Panel {
-
- private static final long serialVersionUID = 1L;
-
- public TextFieldElementPanel(String id) {
- super(id);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/util/WicketUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/util/WicketUtils.java
deleted file mode 100644
index aceb9f8b94..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/util/WicketUtils.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.pmease.gitplex.web.common.wicket.util;
-
-import java.util.Map;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.core.request.handler.IPageRequestHandler;
-import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
-import org.apache.wicket.request.Request;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.http.WebRequest;
-import org.apache.wicket.request.http.WebResponse;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.string.StringValue;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.pmease.gitplex.web.util.CookieUtils;
-
-public final class WicketUtils {
- private WicketUtils() {
- }
-
- public static Optional<Page> getCurrentPage() {
- Page page = null;
- if (RequestCycle.get().getActiveRequestHandler() instanceof IPageRequestHandler) {
- page = (Page) ((IPageRequestHandler) RequestCycle.get().getActiveRequestHandler())
- .getPage();
- }
-
- return Optional.fromNullable(page);
- }
-
- public static Optional<PageParameters> getCurrentPageParameters() {
- PageParameters params = null;
- Optional<Page> page = getCurrentPage();
- if (page.isPresent()) {
- params = page.get().getPageParameters();
- }
-
- return Optional.fromNullable(params);
- }
-
- public static CharSequence urlFor(Class<? extends Page> pageClass, PageParameters parameters) {
- return RequestCycle.get().urlFor(pageClass, parameters);
- }
-
- public static boolean isCurrentRequestAjax() {
- return RequestCycle.get() != null
- ? RequestCycle.get().find(AjaxRequestTarget.class) != null : false;
- }
-
- private static final String QUERY_STRING_SEPARATOR = "?";
- public static String getCurrentRequestUrl() {
- Request request = RequestCycle.get().getRequest();
- if (!(request instanceof ServletWebRequest)) {
- throw new IllegalStateException("Cannot be used in a non servlet environment");
- }
-
- ServletWebRequest servletWebRequest = (ServletWebRequest) request;
- StringBuffer currentUrl = servletWebRequest.getContainerRequest().getRequestURL();
- String queryString = servletWebRequest.getContainerRequest().getQueryString();
- if (queryString != null) {
- currentUrl.append(QUERY_STRING_SEPARATOR).append(queryString);
- }
-
- return currentUrl.toString();
- }
-
- public static void ajaxAdd(AjaxRequestTarget target, Component component) {
- if (target != null) {
- target.add(component);
- }
- }
-
- public static void appendJavaScript(AjaxRequestTarget target,
- CharSequence script) {
- if (target != null) {
- target.appendJavaScript(script);
- }
- }
-
- public static HttpServletRequest getHttpServletRequest() {
- WebRequest request = (WebRequest) RequestCycle.get().getRequest();
- return (HttpServletRequest) request.getContainerRequest();
- }
-
- public static HttpServletResponse getHttpServletResponse() {
- WebResponse response = (WebResponse) RequestCycle.get().getResponse();
- return (HttpServletResponse) response.getContainerResponse();
- }
-
- public static Cookie getCookie(String cookieName) {
- return CookieUtils.getCookie(getHttpServletRequest(), cookieName);
- }
-
- public static String getCookieValue(String cookieName) {
- return CookieUtils.getCookieValue(getHttpServletRequest(), cookieName);
- }
-
- static final int SECONDS_PER_DAY = 24 * 60 * 60;
-
- public static Cookie setCookie(String cookieName, String value) {
- return setCookie(cookieName, value, "/", SECONDS_PER_DAY * 30);
- }
-
- public static Cookie setCookie(String cookieName, String value,
- String path, int maxAge) {
- return CookieUtils.setCookie(WicketUtils.getHttpServletRequest(),
- WicketUtils.getHttpServletResponse(), cookieName, value,
- maxAge, path);
-
- }
-
- public static void removeCookie(String cookieName) {
- CookieUtils.invalidateCookie(getHttpServletRequest(),
- getHttpServletResponse(), cookieName);
- }
-
- public static void removeCookie(String cookieName, String path) {
- CookieUtils.invalidateCookie(getHttpServletRequest(),
- getHttpServletResponse(), cookieName, path);
- }
-
- public static PageParameters newPageParams(String key, Object value) {
- PageParameters params = new PageParameters();
- params.add(key, value.toString());
- return params;
- }
-
- public static PageParameters newPageParams(String key1, String value1,
- String key2, String value2) {
- return newPageParams(ImmutableMap.of(key1, value1, key2, value2));
- }
-
- public static PageParameters newPageParams(String k1, String v1, String k2,
- String v2, String k3, String v3) {
- return newPageParams(ImmutableMap.of(k1, v1, k2, v2, k3, v3));
- }
-
- public static PageParameters newPageParams(Map<String, String> map) {
- PageParameters params = new PageParameters();
- for (Map.Entry<String, String> each : map.entrySet()) {
- params.add(each.getKey(), each.getValue());
- }
-
- return params;
- }
-
- public static String getStringParam(PageParameters params, String key,
- String defaultValue) {
- StringValue v = params.get(key);
- if (v == null)
- return defaultValue;
-
- return v.toString(defaultValue);
- }
-
- public static String getStringParam(PageParameters params, String key) {
- return getStringParam(params, key, null);
- }
-
- public static int getIntParam(PageParameters params, String key,
- int defaultValue) {
- StringValue v = params.get(key);
- if (v == null)
- return defaultValue;
-
- return v.toInt(defaultValue);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentEditor.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentEditor.html
deleted file mode 100644
index 0fa120b296..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentEditor.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <form class="form-comment" wicket:id="form">
- <div class="comment-editor-head">
- <ul class="nav nav-tabs">
- <li class="active"><a wicket:id="writelink">Write</a></li>
- <li><a wicket:id="previewlink">Preview</a></li>
- </ul>
- </div>
- <div class="tab-content comment-editor-body">
- <div class="tab-pane active" wicket:id="edit"></div>
- <div class="tab-pane" wicket:id="preview"></div>
-
- <div class="form-actions clearfix" wicket:id="actions"></div>
- </div>
- </form>
-
- <wicket:fragment wicket:id="editfrag">
- <div wicket:id="feedback"></div>
- <textarea wicket:id="input" placeholder="Leave a comment" class="focusable"></textarea>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="previewfrag">
- <div class="panel panel-default panel-comment">
- <div class="panel-heading">
- <span class="author" wicket:id="author"></span>
- </div>
- <div class="panel-body">
- <div wicket:id="content"></div>
- </div>
- </div>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="submitfrag">
- <button class="btn btn-default btn-cancel secondary" wicket:id="btnCancel"><span wicket:id="name"></span></button>
- <button class="btn btn-success dirty-aware primary" wicket:id="btnSubmit"><span wicket:id="name"></span></button>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentEditor.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentEditor.java
deleted file mode 100644
index 57a8a4618b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentEditor.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package com.pmease.gitplex.web.component.comment;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxEventBehavior;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.head.OnLoadHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextArea;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.IRequestParameters;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.parboiled.common.Preconditions;
-
-import com.google.common.base.Strings;
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.UserManager;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.component.user.UserLink;
-import com.pmease.gitplex.web.component.wiki.WikiTextPanel;
-
-@SuppressWarnings("serial")
-public abstract class OldCommitCommentEditor extends Panel {
-
- protected Form<?> form;
-
- public OldCommitCommentEditor(String id) {
- this(id, Model.of(""));
- }
-
- public OldCommitCommentEditor(String id, IModel<String> textModel) {
- super(id, textModel);
-
- form = createForm("form");
- add(form);
- }
-
- protected Form<?> createForm(String id) {
- return new Form<Void>(id);
- }
-
- private WebMarkupContainer previewPanel;
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- Component editor = newEditPanel("edit");
- previewPanel = (WebMarkupContainer) newPreviewPanel("preview");
-
- form.add(editor);
- form.add(previewPanel);
-
- WebMarkupContainer editLink = new WebMarkupContainer("writelink");
- editLink.add(AttributeModifier.replace("href", "#" + editor.getMarkupId(true)));
- form.add(editLink);
-
- WebMarkupContainer previewLink = new WebMarkupContainer("previewlink");
- previewLink.add(AttributeModifier.replace("href", "#" + previewPanel.getMarkupId(true)));
- previewLink.add(new AjaxEventBehavior("shown.bs.tab") {
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- super.updateAjaxAttributes(attributes);
-
- attributes.getDynamicExtraParameters()
- .add(String.format("return {'text': $('#%s').val() }", inputField.getMarkupId()));
- }
-
- @Override
- public void renderHead(Component component, IHeaderResponse response) {
- response.render(OnLoadHeaderItem.forScript(getCallbackScript().toString()));
- }
-
- @Override
- protected void onEvent(AjaxRequestTarget target) {
- IRequestParameters request = RequestCycle.get().getRequest().getRequestParameters();
- String text = request.getParameterValue("text").toString(null);
- updatePreview(target, text);
- }
-
- });
-
- form.add(previewLink);
-
- form.add(createSubmitBar("actions", form));
- }
-
- protected Component createSubmitBar(String id, Form<?> form) {
- Fragment frag = new Fragment(id, "submitfrag", this);
-
- frag.add(createCancelButton("btnCancel", form));
- frag.add(createSubmitButton("btnSubmit", form));
-
- return frag;
- }
-
- abstract protected void onCancel(AjaxRequestTarget target, Form<?> form);
- abstract protected void onSubmit(AjaxRequestTarget target, Form<?> form);
-
- protected Component createCancelButton(String id, Form<?> form) {
- AjaxLink<Void> cancelBtn = new AjaxLink<Void>("btnCancel") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- onCancel(target, getForm());
- }
-
- };
-
- cancelBtn.add(new Label("name", getCancelButtonLabel()));
- return cancelBtn;
- }
-
- @SuppressWarnings("unchecked")
- protected void clearInput() {
- IModel<String> model = (IModel<String>) getDefaultModel();
- model.setObject("");
- }
-
- protected Component createSubmitButton(String id, Form<?> form) {
- AjaxButton btn = new AjaxButton(id, form) {
- @Override
- public void onSubmit(AjaxRequestTarget target, Form<?> form) {
- OldCommitCommentEditor.this.onSubmit(target, form);
- }
- };
-
- btn.add(new Label("name", getSubmitButtonLabel()));
- return btn;
- }
-
- protected IModel<String> getCancelButtonLabel() {
- return Model.of("Close Form");
- }
-
- protected IModel<String> getSubmitButtonLabel() {
- return Model.of("Add a comment");
- }
-
- public String getCommentText() {
- return (String) getDefaultModelObject();
- }
-
- TextArea<String> inputField;
- @SuppressWarnings("unchecked")
- private Component newEditPanel(String id) {
- Fragment frag = new Fragment(id, "editfrag", this);
- frag.add(new FeedbackPanel("feedback", form));
- frag.add(inputField = new TextArea<String>("input", (IModel<String>) getDefaultModel()));
-
- return frag;
- }
-
- @SuppressWarnings("unchecked")
- private Component newPreviewPanel(String id) {
- Fragment frag = new Fragment(id, "previewfrag", this);
- User user = Preconditions.checkNotNull(GitPlex.getInstance(UserManager.class).getCurrent());
- frag.add(new UserLink("author", Model.of(user)));
- frag.add(newPreview((IModel<String>) getDefaultModel()));
-
- return frag;
- }
-
- private Component newPreview(final IModel<String> text) {
- return new WikiTextPanel("content", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- String str = text.getObject();
- if (Strings.isNullOrEmpty(str)) {
- return "Nothing to be shown";
- } else {
- return str;
- }
- }
- }).setOutputMarkupId(true);
- }
-
- private void updatePreview(AjaxRequestTarget target, String text) {
- Component c = newPreview(Model.of(text));
- previewPanel.addOrReplace(c);
- target.add(c);
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript(
- String.format("$('#%s a').click(function(e){e.preventDefault(); $(this).tab('show') })", getMarkupId())));
- }
-
- public Form<?> getForm() {
- return form;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentPanel.html
deleted file mode 100644
index 668c575e38..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentPanel.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="panel panel-default panel-comment">
- <div class="panel-heading">
- <wicket:container wicket:id="head"></wicket:container>
- </div>
- <div class="panel-body">
- <div wicket:id="content"></div>
- </div>
- </div>
-
- <wicket:fragment wicket:id="headfrag">
- <div class="clearfix">
- <div class="pull-left">
- <span class="author" wicket:id="author"></span>
- </div>
- <div class="pull-right actions">
- <span wicket:id="age"></span>
- <a wicket:id="editlink"><i class="fa fa-pencil"></i></a>
- <a wicket:id="removelink"><i class="fa fa-remove"></i></a>
- </div>
- </div>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentPanel.java
deleted file mode 100644
index 9199091b80..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/OldCommitCommentPanel.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package com.pmease.gitplex.web.component.comment;
-
-import java.util.Date;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Strings;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.UserManager;
-import com.pmease.gitplex.core.model.OldCommitComment;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentRemoved;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentUpdated;
-import com.pmease.gitplex.web.component.label.AgeLabel;
-import com.pmease.gitplex.web.component.user.UserLink;
-import com.pmease.gitplex.web.component.wiki.WikiTextPanel;
-
-@SuppressWarnings("serial")
-public class OldCommitCommentPanel extends Panel {
-
- public OldCommitCommentPanel(String id, IModel<OldCommitComment> model) {
- super(id, model);
-
- this.setOutputMarkupId(true);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(newCommentContent());
- add(createCommentHead("head"));
- }
-
- protected Component createCommentHead(String id) {
- Fragment frag = new Fragment(id, "headfrag", this);
-
- frag.add(new UserLink("author", Model.of(getCommitComment().getAuthor())));
-// frag.add(new WebMarkupContainer("authorType") {
-// @Override
-// protected void onConfigure() {
-// super.onConfigure();
-//
-// User author = getCommitComment().getAuthor();
-// setVisibilityAllowed(Objects.equal(author, repositoryModel.getObject().getOwner()));
-// }
-// });
-
- frag.add(new AgeLabel("age", new AbstractReadOnlyModel<Date>() {
-
- @Override
- public Date getObject() {
- return getCommitComment().getUpdateDate();
- }
-
- }).setOutputMarkupId(true));
-
- frag.add(newEditLink("editlink"));
- frag.add(newRemoveLink("removelink"));
- return frag;
- }
-
- protected Component newEditLink(String id) {
- return new AjaxLink<Void>(id) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- onEdit(target);
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- User current = GitPlex.getInstance(UserManager.class).getCurrent();
-
- if (current == null) {
- setVisibilityAllowed(false);
- } else {
- setVisibilityAllowed(Objects.equal(current, getCommitComment().getAuthor()));
- }
- }
-
- };
- }
-
- protected Component newRemoveLink(String id) {
- return new AjaxLink<Void>(id) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- onDelete(target);
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- User current = GitPlex.getInstance(UserManager.class).getCurrent();
- if (current == null) {
- setVisibilityAllowed(false);
- } else {
- setVisibilityAllowed(Objects.equal(current, getCommitComment().getAuthor())
- || current.isAdmin());
- }
- }
- }.add(new ConfirmBehavior("Are you sure you want to delete this comment?"));
- }
-
- private Component newCommentContent() {
- return new WikiTextPanel("content", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- String str = getCommitComment().getContent();
- if (Strings.isNullOrEmpty(str)) {
- return "Nothing to be shown";
- } else {
- return str;
- }
- }
-
- }).setOutputMarkupId(true);
- }
-
- protected void onEdit(AjaxRequestTarget target) {
- Component c = new OldCommitCommentEditor("content", Model.of(getCommitComment().getContent())) {
-
- private void updateCommentLabel(AjaxRequestTarget target) {
- Component label = newCommentContent();
- OldCommitCommentPanel.this.addOrReplace(label);
- target.add(label);
- }
-
- @Override
- protected void onCancel(AjaxRequestTarget target, Form<?> form) {
- updateCommentLabel(target);
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- String comment = getCommentText();
- if (Strings.isNullOrEmpty(comment)) {
- form.error("Comment can not be empty");
- target.add(form);
- return;
- }
-
- OldCommitComment cc = getCommitComment();
- cc.setUpdateDate(new Date());
- cc.setContent(comment);
-
- GitPlex.getInstance(Dao.class).persist(cc);
-
- send(getPage(), Broadcast.DEPTH, new CommitCommentUpdated(target, cc));
- updateCommentLabel(target);
- }
-
- @Override
- protected IModel<String> getCancelButtonLabel() {
- return Model.of("Cancel");
- }
-
- @Override
- protected IModel<String> getSubmitButtonLabel() {
- return Model.of("Update comment");
- }
- };
-
- c.setOutputMarkupId(true);
- addOrReplace(c);
- target.add(c);
- }
-
- protected void onDelete(AjaxRequestTarget target) {
- OldCommitComment comment = getCommitComment();
- GitPlex.getInstance(Dao.class).remove(comment);
- send(getPage(), Broadcast.BREADTH, new CommitCommentRemoved(target, comment));
- }
-
- protected OldCommitComment getCommitComment() {
- return (OldCommitComment) getDefaultModelObject();
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/AuthorInfoPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/AuthorInfoPanel.html
deleted file mode 100644
index 88d2f9f1f3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/AuthorInfoPanel.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="author-info">
- <b class="name"><wicket:container wicket:id="author"></wicket:container></b>
- authored <span class="age" wicket:id="authordate"></span>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/AuthorInfoPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/AuthorInfoPanel.java
deleted file mode 100644
index 81da03cbe7..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/AuthorInfoPanel.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.pmease.gitplex.web.component.commit;
-
-import java.util.Date;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.parboiled.common.Preconditions;
-
-import com.pmease.commons.git.Commit;
-import com.pmease.gitplex.web.component.label.AgeLabel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.PersonLink;
-
-@SuppressWarnings("serial")
-public class AuthorInfoPanel extends Panel {
-
- private final IModel<AvatarMode> mode = Model.of(AvatarMode.NAME);
-
- public AuthorInfoPanel(String id, IModel<Commit> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new PersonLink("author", Model.of(getCommit().getAuthor()), mode.getObject()));
- add(new AgeLabel("authordate", new AbstractReadOnlyModel<Date>() {
-
- @Override
- public Date getObject() {
- return getCommit().getAuthor().getWhen();
- }
-
- }));
- }
-
- public void setAuthorMode(AvatarMode mode) {
- this.mode.setObject(Preconditions.checkNotNull(mode));
- }
-
- private Commit getCommit() {
- return (Commit) getDefaultModelObject();
- }
-
- @Override
- public void onDetach() {
- if (mode != null) {
- mode.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitMetaPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitMetaPanel.html
deleted file mode 100644
index ae892b8c8b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitMetaPanel.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="commit-meta">
- <wicket:container wicket:id="author"></wicket:container>
- <wicket:container wicket:id="committer"></wicket:container>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitMetaPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitMetaPanel.java
deleted file mode 100644
index eba538b45e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitMetaPanel.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.pmease.gitplex.web.component.commit;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.google.common.base.Objects;
-import com.pmease.commons.git.Commit;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-
-@SuppressWarnings("serial")
-public class CommitMetaPanel extends Panel {
-
- private AuthorInfoPanel authorInfo;
-
- public CommitMetaPanel(String id, IModel<Commit> model) {
- super(id, model);
-
- add(authorInfo = new AuthorInfoPanel("author", model));
- add(new CommitterInfoPanel("committer", model) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- setVisibilityAllowed(!Objects.equal(getCommit().getAuthor(),
- getCommit().getCommitter()));
- }
- });
- }
-
- public CommitMetaPanel setAuthorMode(AvatarMode mode) {
- authorInfo.setAuthorMode(mode);
- return this;
- }
-
- private Commit getCommit() {
- return (Commit) getDefaultModelObject();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitsTablePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitsTablePanel.html
deleted file mode 100644
index b6f288988d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitsTablePanel.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div wicket:id="alert"></div>
- <wicket:container wicket:id="commits">
- <div class="panel panel-default panel-commit">
- <div class="panel-heading">
- <h3><i class="fa fa-calendar"></i> <span wicket:id="day"></span></h3>
- </div>
- <div class="panel-body">
- <table class="table table-compact table-commits table-striped">
- <tr wicket:id="rows">
- <td class="td-name">
- <div class="name" wicket:id="name"></div>
- </td>
- <td class="td-message">
- <wicket:container wicket:id="message"></wicket:container>
- </td>
- <td class="td-commitish">
- <a class="sha" wicket:id="commitlink"><span wicket:id="sha"></span></a>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </wicket:container>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitsTablePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitsTablePanel.java
deleted file mode 100644
index 3c6f67dc79..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitsTablePanel.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.pmease.gitplex.web.component.commit;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.commons.lang3.time.DateUtils;
-import org.apache.wicket.Component;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import com.pmease.commons.git.Commit;
-import com.pmease.commons.git.GitUtils;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.Constants;
-import com.pmease.gitplex.web.common.datatype.DataTypes;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Alert;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.PersonLink;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
-
-@SuppressWarnings("serial")
-public class CommitsTablePanel extends Panel {
-
- private final IModel<Multimap<Date, Commit>> groupsModel;
-
- private final IModel<Repository> repositoryModel;
-
- public CommitsTablePanel(String id, IModel<List<Commit>> model, IModel<Repository> repositoryModel) {
- super(id, model);
-
- this.repositoryModel = repositoryModel;
- groupsModel = new LoadableDetachableModel<Multimap<Date, Commit>>() {
-
- @Override
- protected Multimap<Date, Commit> load() {
- List<Commit> commits = getCommits();
-
- LinkedListMultimap<Date, Commit> groups = LinkedListMultimap.<Date, Commit>create();
- for (Commit commit : commits) {
- Date date = commit.getAuthor().getWhen();
- date = DateUtils.round(date, Calendar.DAY_OF_MONTH);
- groups.put(date, commit);
- }
-
- return groups;
- }
- };
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- Alert alert = new Alert("alert",
- Model.of("The commits are too large to render, only showing most recent 250 commits")) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisibilityAllowed(getCommits().size() > Constants.MAX_RENDERABLE_COMMITS);
- }
- };
-
- add(alert.type(Alert.Type.Warning));
-
- add(new ListView<Date>("commits", new AbstractReadOnlyModel<List<Date>>() {
-
- @Override
- public List<Date> getObject() {
- List<Date> dates = Lists.newArrayList(groupsModel.getObject().keySet());
- Collections.sort(dates);
- Collections.reverse(dates);
- return dates;
- }
-
- }) {
-
- @Override
- protected void populateItem(ListItem<Date> item) {
- Date date = item.getModelObject();
- item.add(new Label("day", DataTypes.DATE.asString(date, "MMM dd, yyyy")));
- item.add(createCommitsView("rows", date));
- }
- });
- }
-
- private Component createCommitsView(String id, final Date date) {
- return new ListView<Commit>(id, new AbstractReadOnlyModel<List<Commit>>() {
-
- @Override
- public List<Commit> getObject() {
- return Lists.newArrayList(groupsModel.getObject().get(date));
- }
-
- }) {
-
- @Override
- protected void populateItem(ListItem<Commit> item) {
- Commit commit = item.getModelObject();
- item.add(new PersonLink("name", Model.of(commit.getAuthor()), AvatarMode.NAME_AND_AVATAR));
- item.add(new OldCommitMessagePanel("message", repositoryModel, item.getModel()));
-
- AbstractLink link = new BookmarkablePageLink<Void>("commitlink",
- RepoCommitPage.class,
- RepoCommitPage.paramsOf(getRepository(), commit.getHash(), null));
-
- item.add(link);
- link.add(new Label("sha", GitUtils.abbreviateSHA(commit.getHash())));
- }
- };
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript("gitplex.commitMessage.toggle('.title-message .detailed-toggle');"));
-
- }
-
- @SuppressWarnings("unchecked")
- private List<Commit> getCommits() {
- return (List<Commit>) getDefaultModelObject();
- }
-
- private Repository getRepository() {
- return repositoryModel.getObject();
- }
-
- @Override
- public void onDetach() {
- if (groupsModel != null) {
- groupsModel.detach();
- }
-
- if (repositoryModel != null) {
- repositoryModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitterInfoPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitterInfoPanel.html
deleted file mode 100644
index 4892ebab0b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitterInfoPanel.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="committer-info">
- <i class="fa fa-arrow-right"></i>
- <b class="name"><wicket:container wicket:id="committer"></wicket:container></b>
- committed <span class="age" wicket:id="committerdate"></span>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitterInfoPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitterInfoPanel.java
deleted file mode 100644
index 76e0bdacfe..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitterInfoPanel.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.pmease.gitplex.web.component.commit;
-
-import java.util.Date;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-
-import com.pmease.commons.git.Commit;
-import com.pmease.gitplex.web.component.label.AgeLabel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.PersonLink;
-
-@SuppressWarnings("serial")
-public class CommitterInfoPanel extends Panel {
-
- private final IModel<AvatarMode> mode = Model.of(AvatarMode.NAME);
-
- public CommitterInfoPanel(String id, IModel<Commit> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
-
- add(new PersonLink("committer", Model.of(getCommit().getCommitter()), mode.getObject()));
-
- add(new AgeLabel("committerdate", new AbstractReadOnlyModel<Date>() {
-
- @Override
- public Date getObject() {
- return getCommit().getCommitter().getWhen();
- }
- }));
- }
-
- private Commit getCommit() {
- return (Commit) getDefaultModelObject();
- }
-
- public CommitterInfoPanel committerLinkMode(AvatarMode mode) {
- this.mode.setObject(mode);
- return this;
- }
-
- @Override
- public void onDetach() {
- if (mode != null) {
- mode.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitHashLink.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlink/CommitHashLink.html
similarity index 100%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitHashLink.html
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlink/CommitHashLink.html
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitHashLink.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlink/CommitHashLink.java
similarity index 83%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitHashLink.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlink/CommitHashLink.java
index 9f4b3f273a..ee959aa5a4 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/CommitHashLink.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitlink/CommitHashLink.java
@@ -1,4 +1,4 @@
-package com.pmease.gitplex.web.component.commit;
+package com.pmease.gitplex.web.component.commitlink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
@@ -8,7 +8,7 @@ import org.apache.wicket.model.IModel;
import com.pmease.commons.git.GitUtils;
import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
+import com.pmease.gitplex.web.page.repository.commit.RepoCommitPage;
@SuppressWarnings("serial")
public class CommitHashLink extends Panel {
@@ -29,7 +29,7 @@ public class CommitHashLink extends Panel {
Link<?> link = new BookmarkablePageLink<Void>("link",
RepoCommitPage.class,
- RepoCommitPage.paramsOf(repoModel.getObject(), hash, null));
+ RepoCommitPage.paramsOf(repoModel.getObject(), hash));
link.add(new Label("label", GitUtils.abbreviateSHA(hash)));
add(link);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.java
index 9ef41aac71..99fc48a6b3 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.java
@@ -15,7 +15,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
import com.google.common.base.Objects;
import com.pmease.commons.wicket.component.MultilineText;
import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
+import com.pmease.gitplex.web.page.repository.commit.RepoCommitPage;
@SuppressWarnings("serial")
public class CommitMessagePanel extends Panel {
@@ -37,7 +37,7 @@ public class CommitMessagePanel extends Panel {
AbstractLink link = new BookmarkablePageLink<Void>("link",
RepoCommitPage.class,
- RepoCommitPage.paramsOf(repoModel.getObject(), commitModel.getObject().name(), null));
+ RepoCommitPage.paramsOf(repoModel.getObject(), commitModel.getObject().name()));
add(link);
link.add(new Label("label", new AbstractReadOnlyModel<String>() {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/OldCommitMessagePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/OldCommitMessagePanel.html
similarity index 100%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/OldCommitMessagePanel.html
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/OldCommitMessagePanel.html
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/OldCommitMessagePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/OldCommitMessagePanel.java
similarity index 93%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/OldCommitMessagePanel.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/OldCommitMessagePanel.java
index ee39a129d0..d55b3770a6 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commit/OldCommitMessagePanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/OldCommitMessagePanel.java
@@ -1,4 +1,4 @@
-package com.pmease.gitplex.web.component.commit;
+package com.pmease.gitplex.web.component.commitmessage;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
@@ -12,7 +12,7 @@ import org.apache.wicket.model.Model;
import com.google.common.base.Objects;
import com.pmease.commons.git.Commit;
import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
+import com.pmease.gitplex.web.page.repository.commit.RepoCommitPage;
@SuppressWarnings("serial")
public class OldCommitMessagePanel extends Panel {
@@ -31,7 +31,7 @@ public class OldCommitMessagePanel extends Panel {
AbstractLink link = new BookmarkablePageLink<Void>("link",
RepoCommitPage.class,
- RepoCommitPage.paramsOf(repoModel.getObject(), getCommit().getHash(), null));
+ RepoCommitPage.paramsOf(repoModel.getObject(), getCommit().getHash()));
add(link);
link.add(new Label("label", new AbstractReadOnlyModel<String>() {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repository/RepositoryHomeLink.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repository/RepositoryHomeLink.java
deleted file mode 100644
index 49d94946a1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repository/RepositoryHomeLink.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.pmease.gitplex.web.component.repository;
-
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.common.wicket.component.link.LinkPanel;
-import com.pmease.gitplex.web.page.repository.RepositoryHomePage;
-
-public class RepositoryHomeLink extends LinkPanel {
- private static final long serialVersionUID = 1L;
-
- private final IModel<Repository> repoModel;
-
- @SuppressWarnings("serial")
- public RepositoryHomeLink(String id, final IModel<Repository> repoModel) {
- super(id, new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- Repository repository = repoModel.getObject();
- return repository.getOwner().getName() + "/" + repository.getName();
- }
-
- });
-
- this.repoModel = repoModel;
- }
-
- @Override
- protected AbstractLink createLink(String id) {
- return new BookmarkablePageLink<Void>(id,
- RepositoryHomePage.class, RepositoryHomePage.paramsOf(repoModel.getObject()));
- }
-
- @Override
- public void onDetach() {
- if (repoModel != null) {
- repoModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/treelist/TreeList.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/treelist/TreeList.java
index e8390693d8..d0087e39b9 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/treelist/TreeList.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/treelist/TreeList.java
@@ -58,8 +58,8 @@ import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.web.component.commitmessage.CommitMessagePanel;
import com.pmease.gitplex.web.component.user.PersonLink;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
+import com.pmease.gitplex.web.page.repository.code.blob.RepoBlobPage;
+import com.pmease.gitplex.web.page.repository.commit.RepoCommitPage;
import com.pmease.gitplex.web.util.DateUtils;
@SuppressWarnings("serial")
@@ -212,7 +212,7 @@ public class TreeList extends GenericPanel<String> {
LastCommitInfo info = new LastCommitInfo();
PageParameters params = RepoCommitPage.paramsOf(
repoModel.getObject(), entry.getValue().getId().name());
- info.url = RequestCycle.get().urlFor(RepoCommitPage.class, params).toString();
+ info.url = RequestCycle.get().urlFor(RepoBlobPage.class, params).toString();
info.summary = entry.getValue().getSummary();
info.age = DateUtils.formatAge(new Date(entry.getValue().getTimestamp()*1000L));
map.put(entry.getKey(), info);
@@ -308,10 +308,10 @@ public class TreeList extends GenericPanel<String> {
}));
- PageParameters params = RepositoryPage.paramsOf(
+ PageParameters params = RepoCommitPage.paramsOf(
repoModel.getObject(), commitModel.getObject().name());
BookmarkablePageLink<Void> commitLink = new BookmarkablePageLink<Void>(
- "commitLink", RepoCommitPage.class, params);
+ "commitLink", RepoBlobPage.class, params);
commitLink.add(new Label("commitId", new AbstractReadOnlyModel<String>() {
@Override
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/wiki/WikiTextPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/wiki/WikiTextPanel.html
deleted file mode 100644
index 749e0410e9..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/wiki/WikiTextPanel.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="wiki" wicket:id="wiki"></div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/wiki/WikiTextPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/wiki/WikiTextPanel.java
deleted file mode 100644
index e9d0101902..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/wiki/WikiTextPanel.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.pmease.gitplex.web.component.wiki;
-
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-
-import com.google.common.base.Throwables;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.highlighter.AceHighlighter;
-import com.pmease.gitplex.web.util.MarkdownUtils;
-
-@SuppressWarnings("serial")
-public class WikiTextPanel extends Panel {
- private static final long serialVersionUID = 1L;
-
- public WikiTextPanel(String id, IModel<String> contentModel) {
- super(id, contentModel);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new Label("wiki", new LoadableDetachableModel<String>() {
-
- @Override
- protected String load() {
- String markdown = WikiTextPanel.this.getDefaultModelObjectAsString();
- String html;
- try {
- html = MarkdownUtils.transformMarkdown(markdown);
- return html;
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
- }).setEscapeModelStrings(false));
-
- add(new AceHighlighter().withSelector("#" + getMarkupId() + " pre code").hasLineId(false));
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/RepoUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/RepoUtils.java
deleted file mode 100644
index a4356574ad..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/RepoUtils.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package com.pmease.gitplex.web.git;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.eclipse.jgit.api.CloneCommand;
-import org.eclipse.jgit.api.FetchCommand;
-import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.errors.GitAPIException;
-import org.eclipse.jgit.errors.RepositoryNotFoundException;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.RepositoryBuilder;
-import org.eclipse.jgit.lib.RepositoryCache;
-import org.eclipse.jgit.lib.RepositoryCache.FileKey;
-import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
-import org.eclipse.jgit.transport.CredentialsProvider;
-import org.eclipse.jgit.transport.FetchResult;
-import org.eclipse.jgit.transport.RefSpec;
-import org.eclipse.jgit.util.FS;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.pmease.gitplex.web.util.JnaUtils;
-
-public class RepoUtils {
-
- private static final Logger logger = LoggerFactory.getLogger(RepoUtils.class);
-
- private RepoUtils() {}
-
- public static Repository open(File dir) {
- try {
- RepositoryCache.FileKey key;
- key = RepositoryCache.FileKey.lenient(dir, FS.DETECTED);
-
- return new RepositoryBuilder()
- .setFS(FS.DETECTED)
- .setGitDir(key.getFile())
- .setMustExist(true)
- .build();
- } catch (RepositoryNotFoundException e) {
- throw new RepositoryException(e);
- } catch (IOException e) {
- throw new RepositoryException(e);
- }
- }
-
- public static void close(Repository db) {
- RepositoryCache.close(db);
- if (db != null) {
- db.close();
- }
- }
-
- /**
- * Encapsulates the result of cloning or pulling from a repository.
- */
- public static class CloneResult {
- public String name;
- public FetchResult fetchResult;
- public boolean createdRepository;
- }
-
- /**
- * Clone or Fetch a repository. If the local repository does not exist,
- * clone is called. If the repository does exist, fetch is called. By
- * default the clone/fetch retrieves the remote heads, tags, and notes.
- *
- * @param repositoriesFolder
- * @param name
- * @param fromUrl
- * @return CloneResult
- * @throws Exception
- */
- public static CloneResult cloneRepository(File repositoriesFolder, String name, String fromUrl)
- throws Exception {
- return cloneRepository(repositoriesFolder, name, fromUrl, true, null);
- }
-
- /**
- * Clone or Fetch a repository. If the local repository does not exist,
- * clone is called. If the repository does exist, fetch is called. By
- * default the clone/fetch retrieves the remote heads, tags, and notes.
- *
- * @param repositoriesFolder
- * @param name
- * @param fromUrl
- * @param bare
- * @param credentialsProvider
- * @return CloneResult
- * @throws Exception
- */
- public static CloneResult cloneRepository(File repositoriesFolder, String name, String fromUrl,
- boolean bare, CredentialsProvider credentialsProvider) throws Exception {
- CloneResult result = new CloneResult();
- if (bare) {
- // bare repository, ensure .git suffix
- if (!name.toLowerCase().endsWith(Constants.DOT_GIT_EXT)) {
- name += Constants.DOT_GIT_EXT;
- }
- } else {
- // normal repository, strip .git suffix
- if (name.toLowerCase().endsWith(Constants.DOT_GIT_EXT)) {
- name = name.substring(0, name.indexOf(Constants.DOT_GIT_EXT));
- }
- }
- result.name = name;
-
- File folder = new File(repositoriesFolder, name);
- if (folder.exists()) {
- File gitDir = FileKey.resolve(new File(repositoriesFolder, name), FS.DETECTED);
- Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
- result.fetchResult = fetchRepository(credentialsProvider, repository);
- repository.close();
- } else {
- CloneCommand clone = new CloneCommand();
- clone.setBare(bare);
- clone.setCloneAllBranches(true);
- clone.setURI(fromUrl);
- clone.setDirectory(folder);
- if (credentialsProvider != null) {
- clone.setCredentialsProvider(credentialsProvider);
- }
- Repository repository = clone.call().getRepository();
-
- // Now we have to fetch because CloneCommand doesn't fetch
- // refs/notes nor does it allow manual RefSpec.
- result.createdRepository = true;
- result.fetchResult = fetchRepository(credentialsProvider, repository);
- repository.close();
- }
- return result;
- }
-
- /**
- * Fetch updates from the remote repository. If refSpecs is unspecifed,
- * remote heads, tags, and notes are retrieved.
- *
- * @param credentialsProvider
- * @param repository
- * @param refSpecs
- * @return FetchResult
- * @throws Exception
- */
- public static FetchResult fetchRepository(CredentialsProvider credentialsProvider,
- Repository repository, RefSpec... refSpecs) throws Exception {
- Git git = new Git(repository);
- FetchCommand fetch = git.fetch();
- List<RefSpec> specs = new ArrayList<RefSpec>();
- if (refSpecs == null || refSpecs.length == 0) {
- specs.add(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
- specs.add(new RefSpec("+refs/tags/*:refs/tags/*"));
- specs.add(new RefSpec("+refs/notes/*:refs/notes/*"));
- } else {
- specs.addAll(Arrays.asList(refSpecs));
- }
- if (credentialsProvider != null) {
- fetch.setCredentialsProvider(credentialsProvider);
- }
- fetch.setRefSpecs(specs);
- FetchResult fetchRes = fetch.call();
- return fetchRes;
- }
-
- /**
- * Creates a bare repository.
- *
- * @param repositoriesFolder
- * @param name
- * @return Repository
- */
- public static Repository createRepository(File repositoriesFolder, String name) {
- return createRepository(repositoriesFolder, name, "FALSE");
- }
-
- /**
- * Creates a bare, shared repository.
- *
- * @param repositoriesFolder
- * @param name
- * @param shared
- * the setting for the --shared option of "git init".
- * @return Repository
- */
- public static Repository createRepository(File repositoriesFolder, String name, String shared) {
- try {
- Repository repo = null;
- try {
- Git git = Git.init().setDirectory(new File(repositoriesFolder, name)).setBare(true).call();
- repo = git.getRepository();
- } catch (GitAPIException e) {
- throw new RuntimeException(e);
- }
-
- GitConfigSharedRepository sharedRepository = new GitConfigSharedRepository(shared);
- if (sharedRepository.isShared()) {
- StoredConfig config = repo.getConfig();
- config.setString("core", null, "sharedRepository", sharedRepository.getValue());
- config.setBoolean("receive", null, "denyNonFastforwards", true);
- config.save();
-
- if (! JnaUtils.isWindows()) {
- Iterator<File> iter = org.apache.commons.io.FileUtils.iterateFilesAndDirs(repo.getDirectory(),
- TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- // Adjust permissions on file/directory
- while (iter.hasNext()) {
- adjustSharedPerm(iter.next(), sharedRepository);
- }
- }
- }
-
- return repo;
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private enum GitConfigSharedRepositoryValue
- {
- UMASK("0", 0), FALSE("0", 0), OFF("0", 0), NO("0", 0),
- GROUP("1", 0660), TRUE("1", 0660), ON("1", 0660), YES("1", 0660),
- ALL("2", 0664), WORLD("2", 0664), EVERYBODY("2", 0664),
- Oxxx(null, -1);
-
- private String configValue;
- private int permValue;
- private GitConfigSharedRepositoryValue(String config, int perm) { configValue = config; permValue = perm; };
-
- public String getConfigValue() { return configValue; };
- public int getPerm() { return permValue; };
-
- }
-
- private static class GitConfigSharedRepository
- {
- private int intValue;
- private GitConfigSharedRepositoryValue enumValue;
-
- GitConfigSharedRepository(String s) {
- if ( s == null || s.trim().isEmpty() ) {
- enumValue = GitConfigSharedRepositoryValue.GROUP;
- }
- else {
- try {
- // Try one of the string values
- enumValue = GitConfigSharedRepositoryValue.valueOf(s.trim().toUpperCase());
- } catch (IllegalArgumentException iae) {
- try {
- // Try if this is an octal number
- int i = Integer.parseInt(s, 8);
- if ( (i & 0600) != 0600 ) {
- String msg = String.format("Problem with core.sharedRepository filemode value (0%03o).\nThe owner of files must always have read and write permissions.", i);
- throw new IllegalArgumentException(msg);
- }
- intValue = i & 0666;
- enumValue = GitConfigSharedRepositoryValue.Oxxx;
- } catch (NumberFormatException nfe) {
- throw new IllegalArgumentException("Bad configuration value for 'shared': '" + s + "'");
- }
- }
- }
- }
-
- String getValue() {
- if ( enumValue == GitConfigSharedRepositoryValue.Oxxx ) {
- if (intValue == 0) return "0";
- return String.format("0%o", intValue);
- }
- return enumValue.getConfigValue();
- }
-
- int getPerm() {
- if ( enumValue == GitConfigSharedRepositoryValue.Oxxx ) return intValue;
- return enumValue.getPerm();
- }
-
- boolean isCustom() {
- return enumValue == GitConfigSharedRepositoryValue.Oxxx;
- }
-
- boolean isShared() {
- return (enumValue.getPerm() > 0) || enumValue == GitConfigSharedRepositoryValue.Oxxx;
- }
- }
-
- /**
- * Adjust file permissions of a file/directory for shared repositories
- *
- * @param path
- * File that should get its permissions changed.
- * @param configShared
- * Configuration setting for the shared mode.
- * @return Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned.
- */
- public static int adjustSharedPerm(File path, GitConfigSharedRepository configShared) {
- if (! configShared.isShared()) return 0;
- if (! path.exists()) return -1;
-
- int perm = configShared.getPerm();
- JnaUtils.Filestat stat = JnaUtils.getFilestat(path);
- if (stat == null) return -1;
- int mode = stat.mode;
- if (mode < 0) return -1;
-
- // Now, here is the kicker: Under Linux, chmod'ing a sgid file whose guid is different from the process'
- // effective guid will reset the sgid flag of the file. Since there is no way to get the sgid flag back in
- // that case, we decide to rather not touch is and getting the right permissions will have to be achieved
- // in a different way, e.g. by using an appropriate umask for the Gitblit process.
- if (System.getProperty("os.name").toLowerCase().startsWith("linux")) {
- if ( ((mode & (JnaUtils.S_ISGID | JnaUtils.S_ISUID)) != 0)
- && stat.gid != JnaUtils.getegid() ) {
- logger.debug("Not adjusting permissions to prevent clearing suid/sgid bits for '" + path + "'" );
- return 0;
- }
- }
-
- // If the owner has no write access, delete it from group and other, too.
- if ((mode & JnaUtils.S_IWUSR) == 0) perm &= ~0222;
- // If the owner has execute access, set it for all blocks that have read access.
- if ((mode & JnaUtils.S_IXUSR) == JnaUtils.S_IXUSR) perm |= (perm & 0444) >> 2;
-
- if (configShared.isCustom()) {
- // Use the custom value for access permissions.
- mode = (mode & ~0777) | perm;
- }
- else {
- // Just add necessary bits to existing permissions.
- mode |= perm;
- }
-
- if (path.isDirectory()) {
- mode |= (mode & 0444) >> 2;
- mode |= JnaUtils.S_ISGID;
- }
-
- return JnaUtils.setFilemode(path, mode);
- }
-
- /**
- * Adjust file permissions of a file/directory for shared repositories
- *
- * @param path
- * File that should get its permissions changed.
- * @param configShared
- * Configuration string value for the shared mode.
- * @return Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned.
- */
- public static int adjustSharedPerm(File path, String configShared) {
- return adjustSharedPerm(path, new GitConfigSharedRepository(configShared));
- }
-
- /**
- * Determine if a repository has any commits. This is determined by checking
- * the for loose and packed objects.
- *
- * @param repository
- * @return true if the repository has commits
- */
- public static boolean hasCommits(Repository repository) {
- if (repository != null && repository.getDirectory().exists()) {
- return (new File(repository.getDirectory(), "objects").list().length > 2)
- || (new File(repository.getDirectory(), "objects/pack").list().length > 0);
- }
- return false;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/RepositoryException.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/RepositoryException.java
deleted file mode 100644
index 0e19bcf478..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/RepositoryException.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.pmease.gitplex.web.git;
-
-public class RepositoryException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- public RepositoryException(String msg) {
- super(msg);
- }
-
- public RepositoryException(String msg, Throwable e) {
- super(msg, e);
- }
-
- public RepositoryException(Throwable e) {
- super(e);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/AbstractDiffCommand.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/AbstractDiffCommand.java
deleted file mode 100644
index fa1bbdf59a..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/AbstractDiffCommand.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package com.pmease.gitplex.web.git.command;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Set;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Sets;
-import com.pmease.commons.git.command.GitCommand;
-import com.pmease.commons.loader.AppLoader;
-import com.pmease.commons.util.execution.Commandline;
-
-public abstract class AbstractDiffCommand<T, S extends AbstractDiffCommand<T, S>> extends GitCommand<T> {
-
- public static enum RenameType {
- NONE, FIND_RENAMES, FIND_COPIES, FIND_COPIES_HEADER
- }
-
- public static enum WhitespaceType {
- NONE,
-
- // Ignore changes in whitespace at EOL.
- IGNORE_SPACE_AT_EOL,
-
- // Ignore changes in amount of whitespace. This ignores whitespace at
- // line end, and considers all other sequences of one or more whitespace
- // characters to be equivalent.
- IGNORE_SPACE_CHANGE,
-
- // Ignore whitespace when comparing lines. This ignores differences even
- // if one line has whitespace where the other line has none.
- IGNORE_ALL_SPACE,
-
- // Ignore changes whose lines are all blank.
- IGNORE_BLANK_LINES
- }
-
- public static enum DiffAlgorithm {
- PATIENCE, MINIMAL, HISTOGRAM, MYERS
- }
-
- protected String since;
- protected String until;
-
- protected Set<String> paths = Sets.newLinkedHashSet();
-
- protected int contextLines;
-
- protected RenameType renameType = RenameType.FIND_RENAMES;
-
- protected int threshold = -1;
-
- protected WhitespaceType whitespaceType = WhitespaceType.NONE;
-
- protected DiffAlgorithm diffAlgorithm = DiffAlgorithm.MYERS; // git default
-
- protected String format;
-
- public AbstractDiffCommand(File repoDir) {
- super(repoDir);
- }
-
- protected abstract S self();
-
- public S since(String since) {
- this.since = since;
- return self();
- }
-
- public S until(String until) {
- this.until = until;
- return self();
- }
-
- public S path(String path) {
- this.paths.add(path);
- return self();
- }
-
- public S paths(Collection<String> paths) {
- this.paths.addAll(paths);
- return self();
- }
-
- public S contextLines(int contextLines) {
- this.contextLines = contextLines;
- return self();
- }
-
- public S findCopiesHarder(boolean b) {
- return renameType(b ? RenameType.FIND_COPIES_HEADER : RenameType.NONE);
- }
-
- public S findCopies(boolean b) {
- return findCopies(b, -1);
- }
-
- public S findCopies(boolean b, int threshold) {
- return renameType(b ? RenameType.FIND_COPIES : RenameType.NONE, threshold);
- }
-
- public S findRenames(boolean b) {
- return findRenames(b, -1);
- }
-
- public S findRenames(boolean b, int threshold) {
- return renameType(b ? RenameType.FIND_RENAMES : RenameType.NONE, threshold);
- }
-
- private S renameType(RenameType renameType) {
- return renameType(renameType, -1);
- }
-
- private S renameType(RenameType renameType, int threshold) {
- this.renameType = renameType;
- this.threshold = threshold;
- return self();
- }
-
- private S whitespaceType(WhitespaceType whitespaceType) {
- this.whitespaceType = whitespaceType;
- return self();
- }
-
- public S ignoreSpaceAtEol() {
- return whitespaceType(WhitespaceType.IGNORE_SPACE_AT_EOL);
- }
-
- public S ignoreAllSpace() {
- return whitespaceType(WhitespaceType.IGNORE_ALL_SPACE);
- }
-
- public S ignoreBlankLines() {
- return whitespaceType(WhitespaceType.IGNORE_BLANK_LINES);
- }
-
- public S ignoreSpaceChange() {
- return whitespaceType(WhitespaceType.IGNORE_SPACE_CHANGE);
- }
-
- public S diffAlgorithm(DiffAlgorithm algorithm) {
- this.diffAlgorithm = algorithm;
- return self();
- }
-
- public S format(String format) {
- this.format = format;
- return self();
- }
-
- @Override
- protected String getGitExe() {
- if (AppLoader.injector == null) {
- return "git";
- } else {
- return super.getGitExe();
- }
- }
-
- abstract protected String getSubCommand();
-
- protected Commandline newCommand() {
- Commandline cmd = cmd();
- cmd.addArgs(getSubCommand(), "--full-index", "-p", "--no-color");
- return cmd;
- }
-
- protected Commandline buildCommand() {
- Commandline cmd = newCommand();
-
- addArgContextLines(cmd);
- addArgWhitespaceType(cmd);
- addArgRenameType(cmd);
- addArgDiffAlgorithm(cmd);
- addArgFormat(cmd);
-
- addArgRevision(cmd);
-
- addArgPaths(cmd);
-
- return cmd;
- }
-
- protected void addArgRevision(Commandline cmd) {
- if (!Strings.isNullOrEmpty(since)) {
- cmd.addArgs(since);
- }
-
- if (!Strings.isNullOrEmpty(until)) {
- cmd.addArgs(until);
- }
- }
-
- protected void addArgFormat(Commandline cmd) {
- if (!Strings.isNullOrEmpty(format)) {
- cmd.addArgs("--format=", format);
- }
- }
-
- protected void addArgContextLines(Commandline cmd) {
- if (contextLines > 0) {
- cmd.addArgs("-U" + contextLines);
- }
- }
-
- protected void addArgPaths(Commandline cmd) {
- if (paths.isEmpty())
- return;
-
- cmd.addArgs("--");
- for (String path : paths) {
- if (!Strings.isNullOrEmpty(path)) {
- cmd.addArgs(path);
- }
- }
- }
-
- protected void addArgWhitespaceType(Commandline cmd) {
- switch (whitespaceType) {
- case IGNORE_SPACE_AT_EOL:
- cmd.addArgs("--ignore-space-at-eol");
- break;
-
- case IGNORE_SPACE_CHANGE:
- cmd.addArgs("--ignore-space-change");
- break;
-
- case IGNORE_ALL_SPACE:
- cmd.addArgs("--ignore-all-space");
- break;
-
- case IGNORE_BLANK_LINES:
- cmd.addArgs("--ignore-blank-lines");
- break;
-
- default:
- break;
- }
- }
-
- protected void addArgRenameType(Commandline cmd) {
- if (renameType == RenameType.FIND_COPIES_HEADER) {
- cmd.addArgs("--find-copies-harder");
- } else if (renameType == RenameType.FIND_COPIES) {
- cmd.addArgs("-C" + (threshold > 0 ? threshold : ""));
- } else if (renameType == RenameType.FIND_RENAMES) {
- cmd.addArgs("-M" + (threshold > 0 ? threshold : ""));
- }
- }
-
- protected void addArgDiffAlgorithm(Commandline cmd) {
- if (diffAlgorithm != DiffAlgorithm.MYERS) {
- cmd.addArgs("--" + diffAlgorithm.name().toLowerCase());
- }
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/ArchiveCommand.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/ArchiveCommand.java
deleted file mode 100644
index f0832d9c12..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/ArchiveCommand.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package com.pmease.gitplex.web.git.command;
-
-import java.io.File;
-import java.io.OutputStream;
-import java.util.Collections;
-import java.util.List;
-
-import org.parboiled.common.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.pmease.commons.git.command.GitCommand;
-import com.pmease.commons.util.execution.Commandline;
-import com.pmease.commons.util.execution.LineConsumer;
-
-public class ArchiveCommand extends GitCommand<Void> {
-
- private static final Logger logger = LoggerFactory.getLogger(ArchiveCommand.class);
-
- public static enum Format {
- TAR("tar"), TGZ("tgz"), TAR_GZ("tar.gz"), ZIP("zip");
-
- private final String suffix;
-
- Format(String suffix) {
- this.suffix = suffix;
- }
-
- public String getSuffix() {
- return suffix;
- }
- }
-
- private Format format = Format.ZIP;
- private List<String> paths = Lists.newArrayList();
- private String treeish;
- private String prefix;
- private String outputFile;
-
- private final OutputStream output;
-
- public ArchiveCommand(File repoDir, OutputStream output) {
- super(repoDir);
- this.output = output;
- }
-
- public ArchiveCommand format(Format format) {
- this.format = format;
- return this;
- }
-
- public ArchiveCommand path(String path) {
- this.paths = Collections.singletonList(path);
- return this;
- }
-
- public ArchiveCommand paths(List<String> paths) {
- this.paths = paths;
- return this;
- }
-
- public ArchiveCommand treeish(String treeish) {
- this.treeish = treeish;
- return this;
- }
-
- public ArchiveCommand prefix(String prefix) {
- this.prefix = prefix;
- return this;
- }
-
- public ArchiveCommand outputFile(String outputFile) {
- this.outputFile = outputFile;
- return this;
- }
-
- @Override
- public Void call() {
- Commandline cmd = cmd();
-
- cmd.addArgs("archive");
-
- applyArgs(cmd);
-
- cmd.execute(output, new LineConsumer() {
-
- @Override
- public void consume(String line) {
- logger.error(line);
- }
-
- });
-
- return null;
- }
-
- protected void applyArgs(Commandline cmd) {
- cmd.addArgs("--format", format.suffix);
- if (!Strings.isNullOrEmpty(prefix)) {
- cmd.addArgs("--prefix=" + prefix);
- }
-
- if (!Strings.isNullOrEmpty(outputFile)) {
- cmd.addArgs("-o", outputFile);
- }
-
- cmd.addArgs(Preconditions.checkArgNotNull(treeish, "treeish"));
-
- if (!paths.isEmpty()) {
- for (String each : paths) {
- cmd.addArgs(each);
- }
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/CatFileCommand.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/CatFileCommand.java
deleted file mode 100644
index 42666bae51..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/CatFileCommand.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.pmease.gitplex.web.git.command;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.jgit.util.RawParseUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.pmease.commons.git.GitConfig;
-import com.pmease.commons.git.command.GitCommand;
-import com.pmease.commons.loader.AppLoader;
-import com.pmease.commons.util.Charsets;
-import com.pmease.commons.util.execution.Commandline;
-import com.pmease.commons.util.execution.LineConsumer;
-
-public class CatFileCommand extends GitCommand<String> {
-
- private static final Logger logger = LoggerFactory.getLogger(CatFileCommand.class);
-
- private String revision;
-
- private String path;
-
- private ShowType showType = ShowType.PRETTY;
-
- static enum ShowType {
- TYPE("-t"), SIZE("-s"), PRETTY("-p");
-
- final String arg;
-
- ShowType(String arg) {
- this.arg = arg;
- }
- }
-
- public CatFileCommand(File dir) {
- super(dir);
- }
-
- public CatFileCommand object(String revision, String path) {
- this.revision = revision;
- this.path = path;
- return this;
- }
-
- public CatFileCommand showSize() {
- this.showType = ShowType.SIZE;
- return this;
- }
-
- public CatFileCommand showType() {
- this.showType = ShowType.TYPE;
- return this;
- }
-
- public CatFileCommand prettyPrint() {
- this.showType = ShowType.PRETTY;
- return this;
- }
-
- @Override
- public String call() {
- Commandline cmd = cmd();
- cmd.addArgs("cat-file", showType.arg, revision+":"+path);
-
- try (
- ByteArrayOutputStream out = (ByteArrayOutputStream) getOutputStream();
- InputStream in = getInputStream()) {
-
- cmd.execute(out, new LineConsumer() {
-
- @Override
- public void consume(String line) {
- logger.debug(line);
- }
-
- }).checkReturnCode();
-
- byte[] bytes = out.toByteArray();
- if (showType == ShowType.PRETTY) {
- return RawParseUtils.decode(Charsets.detectFrom(bytes), bytes);
- } else {
- // needn't detect charset when showing size or type
- return RawParseUtils.decode(bytes);
- }
- } catch (IOException e) {
- throw Throwables.propagate(e);
- }
- }
-
- protected OutputStream getOutputStream() {
- return new ByteArrayOutputStream(1024);
- }
-
- protected InputStream getInputStream() {
- return null;
- }
-
- @Override
- protected String getGitExe() {
- if (AppLoader.injector == null) {
- return "git";
- } else {
- return AppLoader.getInstance(GitConfig.class).getExecutable();
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/CommitInCommand.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/CommitInCommand.java
deleted file mode 100644
index bed16f4e78..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/CommitInCommand.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.pmease.gitplex.web.git.command;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.parboiled.common.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.pmease.commons.git.command.GitCommand;
-import com.pmease.commons.util.execution.Commandline;
-import com.pmease.commons.util.execution.LineConsumer;
-
-public class CommitInCommand extends GitCommand<List<String>> {
-
- private static final Logger logger = LoggerFactory.getLogger(CommitInCommand.class);
-
- public static enum RefType {
- BRANCH, TAG
- }
-
- private RefType refType = RefType.BRANCH;
-
- private String commit;
-
- public CommitInCommand(File repoDir) {
- super(repoDir);
- }
-
- public CommitInCommand in(RefType refType) {
- this.refType = refType;
- return this;
- }
-
- public CommitInCommand inBranch() {
- return in(RefType.BRANCH);
- }
-
- public CommitInCommand inTag() {
- return in(RefType.TAG);
- }
-
- public CommitInCommand commit(String commit) {
- this.commit = Preconditions.checkNotNull(commit);
- return this;
- }
-
- @Override
- public List<String> call() {
- Commandline cmd = cmd();
- cmd.addArgs(refType.name().toLowerCase());
- cmd.addArgs("--contains", commit);
-
- final List<String> lines = Lists.newArrayList();
-
- cmd.execute(new LineConsumer() {
-
- @Override
- public void consume(String line) {
- String l = StringUtils.stripStart(line, "*").trim();
- if (!Strings.isNullOrEmpty(l)) {
- lines.add(l);
- }
- }
-
- }, new LineConsumer() {
-
- @Override
- public void consume(String line) {
- logger.error(line);
- }
-
- });
-
- return lines;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/DiffTreeCommand.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/DiffTreeCommand.java
deleted file mode 100644
index 842347c536..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/DiffTreeCommand.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.pmease.gitplex.web.git.command;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Strings;
-import com.google.common.base.Throwables;
-import com.google.common.io.ByteSource;
-import com.pmease.commons.util.execution.Commandline;
-import com.pmease.commons.util.execution.LineConsumer;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.Patch;
-
-public class DiffTreeCommand extends AbstractDiffCommand<Patch, DiffTreeCommand> {
-
- private static final Logger logger = LoggerFactory.getLogger(DiffTreeCommand.class);
-
- boolean recurse = true;
-
- private boolean root = true;
-
- public DiffTreeCommand(File repoDir) {
- super(repoDir);
- }
-
- @Override
- protected Commandline newCommand() {
- Commandline cmd = super.newCommand();
-
- if (root) {
- cmd.addArgs("--root");
- }
-
- if (recurse) {
- cmd.addArgs("-r");
- }
-
- cmd.addArgs("--no-commit-id");
-
- return cmd;
- }
-
- @Override
- protected void addArgPaths(Commandline cmd) {
- cmd.addArgs("--");
- for (String path : paths) {
- if (!Strings.isNullOrEmpty(path)) {
- cmd.addArgs(path);
- }
- }
- }
-
- public DiffTreeCommand recurse(boolean recurse) {
- this.recurse = recurse;
- return self();
- }
-
- public DiffTreeCommand root(boolean root) {
- this.root = root;
- return self();
- }
-
- static final int BUFFER_SIZE = 1024 * 8;
-
- @Override
- public Patch call() {
- Commandline cmd = buildCommand();
-
- final Patch patch = new Patch();
-
- try (ByteArrayOutputStream out = new ByteArrayOutputStream(BUFFER_SIZE)) {
-
- cmd.execute(out, new LineConsumer() {
-
- @Override
- public void consume(String line) {
- logger.error(line);
- }
-
- }).checkReturnCode();
-
- try (InputStream in = ByteSource.wrap(out.toByteArray()).openBufferedStream()) {
- patch.parse(in);
- return patch;
- }
- } catch (IOException e) {
- throw Throwables.propagate(e);
- }
- }
-
- @Override
- protected String getSubCommand() {
- return "diff-tree";
- }
-
- @Override
- protected DiffTreeCommand self() {
- return this;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/LineListConsumer.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/LineListConsumer.java
deleted file mode 100644
index 179b1ff582..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/LineListConsumer.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.pmease.gitplex.web.git.command;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-import com.pmease.commons.util.execution.LineConsumer;
-
-public class LineListConsumer extends LineConsumer {
-
- private final List<String> lines = Lists.newLinkedList();
-
- @Override
- public void consume(String line) {
- lines.add(line);
- }
-
- public List<String> getLines() {
- return lines;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/Tag.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/Tag.java
deleted file mode 100644
index d96f1c4a78..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/git/command/Tag.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.pmease.gitplex.web.git.command;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.Serializable;
-
-import javax.annotation.Nullable;
-
-import org.eclipse.jgit.lib.PersonIdent;
-
-import com.google.common.base.Strings;
-
-public class Tag implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final String name;
- private final String hash;
- private final String commitHash;
- private final PersonIdent tagger;
- private final String subject;
- private final String body;
-
- public static class Builder {
- private String name;
- private String hash;
- private String commitHash;
- private PersonIdent tagger;
- private String subject;
- private String body;
-
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- public Builder hash(String hash) {
- this.hash = hash;
- return this;
- }
-
- public Builder commitHash(String commitHash) {
- this.commitHash = commitHash;
- return this;
- }
-
- public Builder tagger(PersonIdent tagger) {
- this.tagger = tagger;
- return this;
- }
-
- public Builder subject(String subject) {
- this.subject = subject;
- return this;
- }
-
- public Builder body(String body) {
- this.body = body;
- return this;
- }
-
- public Tag build() {
- return new Tag(name, hash, commitHash, tagger, subject, body);
- }
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- Tag(String name, String hash, @Nullable String commitHash,
- PersonIdent tagger, String subject, @Nullable String body) {
- this.name = checkNotNull(name, "name");
- this.hash = checkNotNull(hash, "hash");
- this.commitHash = commitHash;
- this.tagger = tagger;
- this.subject = checkNotNull(subject, "subject");
- this.body = body;
- }
-
- public String getName() {
- return name;
- }
-
- public String getHash() {
- return hash;
- }
-
- public String getCommitHash() {
- return commitHash;
- }
-
- public PersonIdent getTagger() {
- return tagger;
- }
-
- public String getSubject() {
- return subject;
- }
-
- public String getBody() {
- return body;
- }
-
- public String getMessage() {
- return Strings.isNullOrEmpty(body) ? subject : subject + "\n" + body;
- }
-
- public String getSha() {
- return Strings.isNullOrEmpty(commitHash) ? hash : commitHash;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/mapper/PageParameterAwareMountedMapper.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/PageParameterAwareMountedMapper.java
similarity index 98%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/mapper/PageParameterAwareMountedMapper.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/PageParameterAwareMountedMapper.java
index 2356427260..5669385cb7 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/mapper/PageParameterAwareMountedMapper.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/PageParameterAwareMountedMapper.java
@@ -1,4 +1,4 @@
-package com.pmease.gitplex.web.common.wicket.mapper;
+package com.pmease.gitplex.web.mapper;
import org.apache.wicket.Application;
import org.apache.wicket.core.request.handler.PageProvider;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/mapper/PatternMountedMapper.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/PatternMountedMapper.java
similarity index 99%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/mapper/PatternMountedMapper.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/PatternMountedMapper.java
index 20e479f1ef..09c27d65c2 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/common/wicket/mapper/PatternMountedMapper.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/PatternMountedMapper.java
@@ -1,4 +1,4 @@
-package com.pmease.gitplex.web.common.wicket.mapper;
+package com.pmease.gitplex.web.mapper;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.html
index 5e47bf662a..b458eac7a0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.html
@@ -1,19 +1,5 @@
<wicket:head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <title wicket:id="title"></title>
- <meta http-equiv="pragma" content="no-cache" />
- <meta name="Author" content="PMEase Inc." />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta wicket:id="refresh" http-equiv="refresh"/>
-
- <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
-
- <link rel="home" wicket:id="home-link" />
</wicket:head>
<wicket:extend>
- <!--[if lt IE 9]>
- <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
- <![endif]-->
<wicket:child></wicket:child>
</wicket:extend>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.java
index 58eeb1be90..8e6cba07d9 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/BasePage.java
@@ -1,15 +1,9 @@
package com.pmease.gitplex.web.page;
-import org.apache.wicket.Application;
import org.apache.wicket.RestartResponseAtInterceptPageException;
-import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.head.PriorityHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import com.pmease.commons.wicket.CommonPage;
@@ -17,9 +11,6 @@ import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.manager.UserManager;
import com.pmease.gitplex.core.model.User;
import com.pmease.gitplex.web.assets.PageResourceReference;
-import com.pmease.gitplex.web.exception.AccessDeniedException;
-import com.pmease.gitplex.web.page.init.ServerInitPage;
-import com.pmease.gitplex.web.shiro.LoginPage;
@SuppressWarnings("serial")
public abstract class BasePage extends CommonPage {
@@ -28,11 +19,6 @@ public abstract class BasePage extends CommonPage {
checkReady();
}
- public BasePage(IModel<?> model) {
- super(model);
- checkReady();
- }
-
public BasePage(PageParameters params) {
super(params);
checkReady();
@@ -55,34 +41,6 @@ public abstract class BasePage extends CommonPage {
@Override
protected void onInitialize() {
super.onInitialize();
-
- if (!isPermitted()) {
- if (getCurrentUser() != null) {
- throw new AccessDeniedException("Access denied");
- } else {
- throw new RestartResponseAtInterceptPageException(LoginPage.class);
- }
- }
-
- add(new BookmarkablePageLink<Void>("home-link", Application.get().getHomePage()));
-
- add(new Label("title", getPageTitle()));
-
- add(new WebMarkupContainer("refresh") {
-
- @Override
- protected void onComponentTag(ComponentTag tag) {
- super.onComponentTag(tag);
- tag.put("content", getPageRefreshInterval());
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(getPageRefreshInterval() != 0);
- }
-
- });
}
protected String getPageTitle() {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/HomePage.html
similarity index 100%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.html
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/page/HomePage.html
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/HomePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/HomePage.java
similarity index 83%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/HomePage.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/page/HomePage.java
index cdd182995a..39a1481e6e 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/HomePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/HomePage.java
@@ -1,9 +1,7 @@
-package com.pmease.gitplex.web.page.home;
+package com.pmease.gitplex.web.page;
import org.apache.wicket.markup.head.IHeaderResponse;
-import com.pmease.gitplex.web.page.LayoutPage;
-
public class HomePage extends LayoutPage {
private static final long serialVersionUID = 1L;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.html
index 48164e10a0..154ca0a912 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.html
@@ -1,61 +1,3 @@
-<html xmlns:wicket>
<wicket:extend>
- <div id="top"></div>
- <header>
- <nav class="navbar navbar-default" role="navigation">
- <div class="navbar-left">
- <a class="navbar-brand" wicket:id="homeLink"><i class="fa fa-ext fa-gitplex-logo"></i></a>
- <form class="navbar-form navbar-left search-form" role="search">
- <div class="form-group">
- <input type="text" class="form-control text-field" placeholder="Search">
- </div>
- </form>
- </div>
-
- <div class="navbar-right">
- <ul class="user-links inline-list">
- <wicket:enclosure child="loginLink">
- <li><a wicket:id="registerLink">Sign up</a></li>
- <li class="separator"></li>
- <li><a href="#" wicket:id="loginLink">Log in</a></li>
- </wicket:enclosure>
-
- <wicket:enclosure child="logoutLink">
- <wicket:enclosure child="adminLink">
- <li><a class="has-tip" wicket:id="adminLink" data-toggle="tooltip" title="System administration"><i class="fa fa-wrench"></i></a></li>
- </wicket:enclosure>
- <li><a class="has-tip" data-toggle="tooltip" title="Create a new repository" wicket:id="newRepoLink"><i class="fa fa-ext fa-repo-add"></i></a></li>
- <li><a class="has-tip" data-toggle="tooltip" title="Sign out" wicket:id="logoutLink"><i class="fa fa-sign-out"></i></a></li>
- <li class="separator"></li>
- <li><a class="has-tip" data-toggle="tooltip" title="You've got tasks" wicket:id="notificationLink"><i class="fa fa-circle"></i></a></li>
- <li class="avatar-user"><wicket:container wicket:id="userLink"></wicket:container></li>
- </wicket:enclosure>
- </ul>
- </div>
- </nav>
- </header>
- <wicket:enclosure child="gitError">
- <div class="alert alert-danger git-error text-center">
- <span wicket:id="gitError"></span>
- <a wicket:id="checkGit" title="Check again"><i class="fa fa-undo"></i></a>
- <a wicket:id="configureGit" title="Configure git"><i class="fa fa-wrench"></i></a>
- </div>
- </wicket:enclosure>
-
- <div id="main">
- <wicket:child></wicket:child>
- </div>
-
- <footer>
- <p class="pull-left">
- <a href="http://www.pmease.com">PMEase GitPlex</a>, <span>1.0.0</span>,
- <span>2013-03-05</span>,
- <span class="license-info">Commercial License for Site 'PMEase Inc.'</span>
- </p>
- <ul class="pull-right piped">
- <li><a href="http://www.pmease.com/support" target="_blank" class="first">Support</a></li>
- <li><a target="_blank" href="http://track.pmease.com">Report Bug or Enhancement</a></li>
- </ul>
- </footer>
-</wicket:extend>
-</html>
+ <wicket:child></wicket:child>
+</wicket:extend>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.java
index 6aaf25f432..3d948fedb9 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LayoutPage.java
@@ -1,26 +1,6 @@
package com.pmease.gitplex.web.page;
import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.LoadableDetachableModel;
-
-import com.pmease.commons.wicket.behavior.TooltipBehavior;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.UserManager;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.component.user.UserLink;
-import com.pmease.gitplex.web.model.UserModel;
-import com.pmease.gitplex.web.page.account.AccountNotificationsPage;
-import com.pmease.gitplex.web.page.account.AccountProfilePage;
-import com.pmease.gitplex.web.page.account.RegisterPage;
-import com.pmease.gitplex.web.page.account.repository.NewRepositoryPage;
-import com.pmease.gitplex.web.page.admin.SystemSettingPage;
-import com.pmease.gitplex.web.shiro.LoginPage;
-import com.pmease.gitplex.web.shiro.LogoutPage;
@SuppressWarnings("serial")
public abstract class LayoutPage extends BasePage {
@@ -28,86 +8,6 @@ public abstract class LayoutPage extends BasePage {
@Override
protected void onInitialize() {
super.onInitialize();
-
- User currentUser = GitPlex.getInstance(UserManager.class).getCurrent();
- final boolean signedIn = currentUser != null;
-
- add(new BookmarkablePageLink<Void>("homeLink", getApplication().getHomePage()));
-
- add(new BookmarkablePageLink<Void>("loginLink", LoginPage.class).setVisible(!signedIn));
- add(new BookmarkablePageLink<Void>("registerLink", RegisterPage.class).setVisible(!signedIn));
- add(new BookmarkablePageLink<Void>("logoutLink", LogoutPage.class).setVisible(signedIn));
- if (currentUser != null) {
- add(new BookmarkablePageLink<Void>("notificationLink",
- AccountNotificationsPage.class,
- AccountNotificationsPage.paramsOf(currentUser)) {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(!getCurrentUser().getRequestNotifications().isEmpty());
- }
-
- });
- } else {
- add(new WebMarkupContainer("notificationLink").setVisible(false));
- }
-
- if (signedIn) {
- add(new UserLink("userLink", new UserModel(currentUser)));
- add(new BookmarkablePageLink<Void>("profileLink",
- AccountProfilePage.class,
- AccountProfilePage.paramsOf(currentUser)));
-
- add(new BookmarkablePageLink<Void>("newRepoLink", NewRepositoryPage.class,
- NewRepositoryPage.paramsOf(currentUser)));
- add(new BookmarkablePageLink<Void>("adminLink", SystemSettingPage.class) {
- @Override
- protected void onConfigure() {
- setVisible(SecurityUtils.getSubject().isPermitted(Permission.ofSystemAdmin()));
- }
- });
- } else {
- add(new WebMarkupContainer("userLink").setVisible(false));
- add(new WebMarkupContainer("newRepoLink").setVisible(false));
- add(new WebMarkupContainer("adminLink").setVisible(false));
- }
-
- add(new Label("gitError", new LoadableDetachableModel<String>() {
-
- @Override
- protected String load() {
- return "Git configuration error: " + GitPlex.getInstance().getGitError();
- }
-
- }) {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(GitPlex.getInstance().getGitError() != null);
- }
-
- }.setEscapeModelStrings(false));
-
- add(new Link<Void>("checkGit") {
-
- @Override
- public void onClick() {
- GitPlex.getInstance().checkGit();
- }
-
- }.add(new TooltipBehavior()));
-
- add(new BookmarkablePageLink<Void>("configureGit", SystemSettingPage.class) {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(SecurityUtils.getSubject().isPermitted(Permission.ofSystemAdmin()));
- }
-
- }.add(new TooltipBehavior()));
}
protected boolean isLoggedIn() {
@@ -121,4 +21,5 @@ public abstract class LayoutPage extends BasePage {
protected boolean isAuthenticated() {
return SecurityUtils.getSubject().isAuthenticated();
}
+
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LoginPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LoginPage.html
new file mode 100644
index 0000000000..b47194918b
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LoginPage.html
@@ -0,0 +1,2 @@
+<wicket:extend>
+</wicket:extend>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LoginPage.java
similarity index 62%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/page/LoginPage.java
index 44a462b021..5ceb239f69 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/LoginPage.java
@@ -1,6 +1,6 @@
package com.pmease.gitplex.web.page;
@SuppressWarnings("serial")
-public class TestPage extends BasePage {
+public class LoginPage extends BasePage {
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/init/ServerInitPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/ServerInitPage.html
similarity index 100%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/page/init/ServerInitPage.html
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/page/ServerInitPage.html
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/init/ServerInitPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/ServerInitPage.java
similarity index 94%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/page/init/ServerInitPage.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/page/ServerInitPage.java
index 5678debf0a..e822fef0df 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/init/ServerInitPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/ServerInitPage.java
@@ -1,4 +1,4 @@
-package com.pmease.gitplex.web.page.init;
+package com.pmease.gitplex.web.page;
import java.util.ArrayList;
import java.util.List;
@@ -12,7 +12,6 @@ import com.pmease.commons.util.init.ManualConfig;
import com.pmease.commons.wicket.component.wizard.ManualConfigStep;
import com.pmease.commons.wicket.component.wizard.Wizard;
import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.web.page.BasePage;
@SuppressWarnings("serial")
public class ServerInitPage extends BasePage {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountPage.java
index fab261ff14..ef5971365c 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountPage.java
@@ -25,8 +25,6 @@ import com.pmease.gitplex.web.component.user.AvatarMode;
import com.pmease.gitplex.web.component.user.UserLink;
import com.pmease.gitplex.web.model.UserModel;
import com.pmease.gitplex.web.page.account.repository.RepositoriesPage;
-import com.pmease.gitplex.web.page.account.team.AccountTeamsPage;
-import com.pmease.gitplex.web.page.account.team.EditTeamPage;
@SuppressWarnings("serial")
public abstract class AccountPage extends AccountBasePage {
@@ -44,7 +42,6 @@ public abstract class AccountPage extends AccountBasePage {
List<Tab> tabs = new ArrayList<>();
tabs.add(new AccountTab(Model.of("Repositories"), "fa fa-ext fa-repo", RepositoriesPage.class));
- tabs.add(new AccountTab(Model.of("Teams"), "fa fa-group", AccountTeamsPage.class, EditTeamPage.class));
tabs.add(new AccountTab(Model.of("Members"), "fa fa-user", MemberSettingPage.class));
tabs.add(new AccountTab(Model.of("Notifications"), "fa fa-volume-up", AccountNotificationsPage.class));
tabs.add(new AccountTab(Model.of("Profile"), "fa fa-gear", AccountProfilePage.class));
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.html
index 85b9296ea6..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.html
@@ -1,48 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <section class="profile">
- <div class="head">Edit your profile</div>
- <div class="body">
- <form wicket:id="form" class="form-md">
- <div wicket:id="feedback"></div>
- <div wicket:id="fullName"></div>
- <div wicket:id="email"></div>
- <div class="submits">
- <button type="submit" wicket:id="submit" class="btn btn-default dirty-aware">Update profile</button>
- </div>
- </form>
- </div>
- </section>
- <section>
- <div class="head">
- <h3>Change your avatar</h3>
- </div>
- <div class="padder">
- <div class="clearfix">
- <div class="pull-left avatar avatar-xlarge" wicket:id="currentavatar"></div>
- <form wicket:id="avatarForm" class="form-md avatar-form" style="padding-left: 150px;">
- <div wicket:id="feedback" class=""></div>
-
- <div class="fileupload fileupload-new" data-provides="fileupload">
- <div class="fileupload-preview thumbnail" data-trigger="fileupload"></div>
- <div>
- <a class="btn btn-default btn-file"><span class="fileupload-new">Select image</span><span class="fileupload-exists">Change image</span>
- <input type="file" wicket:id="fileInput" name="..."></a>
- <btn class="btn btn-default fileupload-exists" data-dismiss="fileupload">Clear</btn>
- </div>
- </div>
-
- <p class="text-muted">
- Supported image types are png, gif, jpg and jpeg. The image size should be less than 2M bytes.
- </p>
- <hr/>
- <p class="clearfix">
- <a wicket:id="submit" class="btn btn-default pull-left dirty-aware"><i class="fa fa-arrow-right"></i> Change avatar</a>
- <a wicket:id="remove" class="btn btn-default pull-right"><i class="fa fa-undo"></i> Reset avatar</a>
- </p>
- </form>
- </div>
- </div>
- </section>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.java
index 2715292c17..012de93974 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/AccountProfilePage.java
@@ -1,29 +1,6 @@
package com.pmease.gitplex.web.page.account;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.bean.validation.PropertyValidator;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.upload.FileUpload;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.lang.Bytes;
-
-import com.pmease.commons.loader.AppLoader;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.UserManager;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.avatar.AvatarManager;
-import com.pmease.gitplex.web.common.wicket.form.textfield.TextFieldElement;
-import com.pmease.gitplex.web.component.user.AvatarByUser;
-import com.pmease.gitplex.web.component.user.AvatarChanged;
-import com.pmease.gitplex.web.model.UserModel;
-
-import de.agilecoders.wicket.extensions.javascript.jasny.FileUploadField;
@SuppressWarnings("serial")
public class AccountProfilePage extends AccountPage {
@@ -40,108 +17,6 @@ public class AccountProfilePage extends AccountPage {
@Override
protected void onInitialize() {
super.onInitialize();
-
- IModel<User> userModel = new UserModel(getAccount());
- add(new ProfileForm("form", userModel));
-
- add(new AvatarByUser("currentavatar", userModel, false));
- add(new AvatarForm("avatarForm", userModel));
- }
-
- private class ProfileForm extends Form<User> {
-
- public ProfileForm(String id, IModel<User> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- @SuppressWarnings("unchecked")
- final IModel<User> model = (IModel<User>) getDefaultModel();
-
- add(new FeedbackPanel("feedback", this));
- add(new TextFieldElement<String>("fullName", "Full Name",
- new PropertyModel<String>(model, "fullName"))
- .setRequired(false).add(new PropertyValidator<String>()));
- add(new TextFieldElement<String>("email", "Email Address",
- new PropertyModel<String>(model, "email"))
- .add(new PropertyValidator<String>()));
-
- add(new AjaxButton("submit", this) {
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- target.add(form);
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- User user = model.getObject();
- AppLoader.getInstance(UserManager.class).save(user);
- send(getPage(), Broadcast.BREADTH, new AvatarChanged(target));
- form.success("Account profile has been updated.");
- target.add(form);
- }
- });
- }
}
- private class AvatarForm extends Form<User> {
- AvatarForm(String id, IModel<User> model) {
- super(id, model);
- }
-
- private User getUser() {
- return (User) getDefaultModelObject();
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- // limit avatar size to 2M bytes
- setMaxSize(Bytes.megabytes(2));
- setMultiPart(true);
-
- final FileUploadField uploadField = new FileUploadField("fileInput");
- uploadField.setRequired(false);
-
- add(uploadField);
-
- add(new FeedbackPanel("feedback", this));
- add(new AjaxButton("submit", this) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- FileUpload upload = uploadField.getFileUpload();
- if (upload == null) {
- form.error("Please select an avatar file");
- target.add(form);
- return;
- }
-
- User user = getUser();
- if (upload != null) {
- GitPlex.getInstance(AvatarManager.class).useAvatar(user, upload);
-
- send(getPage(), Broadcast.BREADTH, new AvatarChanged(target));
- form.success("Your avatar has been updated successfully");
- target.add(form);
- }
- }
- });
-
- add(new AjaxButton("remove", this) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- User user = getUser();
- GitPlex.getInstance(AvatarManager.class).resetAvatar(user);
-
- send(getPage(), Broadcast.BREADTH, new AvatarChanged(target));
- form.success("Your avatar has been reset to the default.");
- target.add(form);
- }
- }.add(new ConfirmBehavior("Are you sure you want to use the default avatar?")));
- }
- }
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberListPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberListPanel.html
deleted file mode 100644
index 918a92df53..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberListPanel.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="list-group-heading">
- <h3><b wicket:id="totals"></b> <small>members total</small></h3>
- </div>
- <ul class="list-group list-group-hover list-members clearfix">
- <li class="list-group-item member-item" wicket:id="member">
- <div class="member-content clearfix">
- <span class="avatar" wicket:id="avatar"></span>
- <h4 class="list-group-item-heading">
- <a wicket:id="userLink"><wicket:container wicket:id="name"></wicket:container></a>
- <em><wicket:container wicket:id="fullName"></wicket:container></em>
- </h4>
- </div>
- <div class="list-group-item-text list-item-teams" wicket:id="teams">
- <wicket:container wicket:id="team">
- <a class="btn btn-xs btn-info btn-colorful-text btn-animated" title="Remove this user from this team" wicket:id="removelink">
- <span class="hidden-content"><i class="fa fa-remove"></i></span>
- <span class="visible-content"><span wicket:id="teamName"></span></span>
- </a>
- </wicket:container>
- </div>
- <div class="list-group-item-actions" wicket:id="actions">
- </div>
- </li>
- </ul>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberListPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberListPanel.java
deleted file mode 100644
index c8f33f6664..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberListPanel.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package com.pmease.gitplex.web.page.account;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.hibernate.criterion.Restrictions;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.Membership;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.component.user.AvatarByUser;
-import com.pmease.gitplex.web.model.UserModel;
-
-@SuppressWarnings("serial")
-public class MemberListPanel extends Panel {
-
- IModel<List<Membership>> membershipsModel;
- IModel<User> accountModel;
-
- public MemberListPanel(String id, IModel<User> accountModel, IModel<List<User>> model) {
- super(id, model);
-
- this.setOutputMarkupId(true);
-
- this.accountModel = accountModel;
- membershipsModel = new LoadableDetachableModel<List<Membership>>() {
-
- @Override
- protected List<Membership> load() {
- Dao dao = GitPlex.getInstance(Dao.class);
- EntityCriteria<Membership> criteria = EntityCriteria.of(Membership.class);
- criteria.createAlias("team", "team");
- criteria.add(Restrictions.eq("team.owner", getAccount()));
- return dao.query(criteria);
- }
- };
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
-
- add(new Label("totals", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return ((List<?>) getDefaultModelObject()).size();
- }
-
- }));
-
- @SuppressWarnings("unchecked")
- ListView<User> membersView = new ListView<User>("member", (IModel<List<User>>) getDefaultModel()) {
-
- @Override
- protected void populateItem(ListItem<User> item) {
- User user = item.getModelObject();
- item.add(new AvatarByUser("avatar", item.getModel(), false));
- AbstractLink link = new BookmarkablePageLink<>("userLink",
- AccountHomePage.class, AccountHomePage.paramsOf(user));
- item.add(link);
- link.add(new Label("name", Model.of(user.getName())));
- if (Strings.isNullOrEmpty(user.getFullName())) {
- item.add(new Label("fullName", "&nbsp;").setEscapeModelStrings(false));
- } else {
- item.add(new Label("fullName", user.getFullName()));
- }
- item.add(createActionsPanel("actions", item.getModel()));
- item.add(createMemberTeams("teams", new UserModel(user)));
- }
-
- };
-
- add(membersView);
-
- }
-
- // retrieve memberships for user under current account
- private List<Membership> getMembershipsOfUser(User user) {
- List<Membership> memberships = membershipsModel.getObject();
- List<Membership> result = Lists.newArrayList();
- for (Membership each : memberships) {
- if (Objects.equal(each.getUser(), user)) {
- result.add(each);
- }
- }
-
- return result;
- }
-
- protected Component createMemberTeams(String id, final IModel<User> user) {
- final WebMarkupContainer teamsDiv = new WebMarkupContainer(id);
- teamsDiv.setOutputMarkupId(true);
- IModel<List<Membership>> teamsModel = new LoadableDetachableModel<List<Membership>>() {
-
- @Override
- protected List<Membership> load() {
- return getMembershipsOfUser(user.getObject());
- }
- };
-
- ListView<Membership> view = new ListView<Membership>("team", teamsModel) {
-
- @Override
- protected void populateItem(ListItem<Membership> item) {
- Membership membership = item.getModelObject();
- final Long membershipId = membership.getId();
- final int size = getList().size();
-
- WebMarkupContainer link;
- if (membership.getTeam().isOwners() &&
- Objects.equal(membership.getUser(), accountModel.getObject())) {
- // owner
- link = new WebMarkupContainer("removelink");
- link.add(AttributeAppender.append("class", "self disabled"));
- } else {
- link = new AjaxLink<Void>("removelink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Dao dao = GitPlex.getInstance(Dao.class);
- dao.remove(dao.load(Membership.class, membershipId));
- if (size > 1) {
- target.add(teamsDiv);
- } else {
- target.add(MemberListPanel.this);
- }
- }
- };
- link.add(new ConfirmBehavior("Are you sure you want to remove the user from team " + membership.getTeam().getName() + "?"));
- }
-
- link.add(new Label("teamName", Model.of(membership.getTeam().getName())));
- item.add(link);
- }
- };
-
- teamsDiv.add(view);
- return teamsDiv;
- }
-
- protected Component createActionsPanel(String id, IModel<User> model) {
- return new WebMarkupContainer(id).setVisibilityAllowed(false);
- }
-
- private User getAccount() {
- return accountModel.getObject();
- }
-
- @Override
- protected void onDetach() {
- if (membershipsModel != null) {
- membershipsModel.detach();
- }
-
- if (accountModel != null) {
- accountModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.html
index df560cca7f..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.html
@@ -1,16 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <section class="members">
- <div class="head">Members</div>
- <div class="body">
- <p>Manage your members/collaborators with <a wicket:id="teamlink">teams</a></p>
- <hr/>
- <div wicket:id="members"></div>
- </div>
- </section>
-
- <wicket:fragment wicket:id="memberactionfrag">
- <a class="img-link remove-link" wicket:id="remove" title="Remove this member"><i class="fa fa-times-circle-o"></i></a>
- </wicket:fragment>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.java
index 0ff2eefb78..4577630b27 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/MemberSettingPage.java
@@ -1,36 +1,6 @@
package com.pmease.gitplex.web.page.account;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.hibernate.criterion.Restrictions;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.commons.util.StringUtils;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.Membership;
-import com.pmease.gitplex.core.model.Team;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.model.UserModel;
-import com.pmease.gitplex.web.page.account.team.AccountTeamsPage;
@SuppressWarnings("serial")
public class MemberSettingPage extends AccountPage {
@@ -47,69 +17,6 @@ public class MemberSettingPage extends AccountPage {
@Override
protected void onInitialize() {
super.onInitialize();
-
- final IModel<List<User>> model = new LoadableDetachableModel<List<User>>() {
-
- @Override
- protected List<User> load() {
- User account = getAccount();
- Collection<Team> teams = account.getTeams();
- Set<User> users = Sets.newHashSet();
- for (Team each : teams) {
- for (Membership membership : each.getMemberships()) {
- users.add(membership.getUser());
- }
- }
-
- List<User> result = Lists.newArrayList(users);
- Collections.sort(result, new Comparator<User>() {
-
- @Override
- public int compare(User o1, User o2) {
- return o1.getName().compareTo(o2.getName());
- }
-
- });
- return result;
- }
-
- };
-
- add(new BookmarkablePageLink<Void>("teamlink",
- AccountTeamsPage.class, AccountTeamsPage.paramsOf(getAccount())));
-
- add(new MemberListPanel("members", new UserModel(getAccount()), model){
- @Override
- protected Component createActionsPanel(String id, IModel<User> model) {
- Fragment frag = new Fragment(id, "memberactionfrag", MemberSettingPage.this);
- User user = model.getObject();
- if (Objects.equal(user, getAccount())) {
- frag.add(new WebMarkupContainer("remove").setVisibilityAllowed(false));
- } else {
- frag.add(new AjaxLink<User>("remove", new UserModel(user)) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Dao dao = GitPlex.getInstance(Dao.class);
- User user = (User) getDefaultModelObject();
- List<Membership> memberships = dao.query(EntityCriteria.of(Membership.class).add(Restrictions.eq("user", user)));
- for (Membership each : memberships) {
- dao.remove(each);
- }
-
- target.add(MemberSettingPage.this.get("members"));
- }
- }.add(new ConfirmBehavior("<p>Are you sure you want to remove below user? "
- + "Remove this user will remove her/him from <b>all teams</b></p>"
- + "<p><b>"
- + StringEscapeUtils.escapeHtml4(user.getName()) + "</b> ("
- + StringEscapeUtils.escapeHtml4(StringUtils.defaultString(user.getFullName(), " "))
- + ")</p>")));
- }
-
- return frag;
- }
- }.setOutputMarkupId(true));
}
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.html
index 0edf0c44b8..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.html
@@ -1,17 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <section class="new-repository">
- <div class="head">New Repository</div>
- <div class="body">
- <form wicket:id="form">
- <div wicket:id="feedback"></div>
- <div wicket:id="owner"></div>
- <div wicket:id="name"></div>
- <div wicket:id="description"></div>
- <hr/>
- <button class="btn btn-primary dirty-aware" wicket:id="submit">Create repository</button>
- </form>
- </div>
- </section>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.java
index 1e276c236e..183c16306b 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/NewRepositoryPage.java
@@ -1,50 +1,16 @@
package com.pmease.gitplex.web.page.account.repository;
-import java.util.List;
-
-import org.apache.shiro.authz.annotation.RequiresUser;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.bean.validation.PropertyValidator;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.string.StringValue;
-import org.apache.wicket.validation.IValidatable;
-import org.apache.wicket.validation.IValidator;
-import org.apache.wicket.validation.ValidationError;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
import com.pmease.gitplex.core.manager.UserManager;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.common.wicket.form.select.DropDownChoiceElement;
-import com.pmease.gitplex.web.common.wicket.form.textfield.TextFieldElement;
-import com.pmease.gitplex.web.model.RepositoryModel;
import com.pmease.gitplex.web.page.account.AccountPage;
-import com.pmease.gitplex.web.page.repository.RepositoryHomePage;
@SuppressWarnings("serial")
-@RequiresUser
public class NewRepositoryPage extends AccountPage {
- private String owner;
-
public NewRepositoryPage(PageParameters params) {
super(params);
-
- StringValue sv = params.get("user");
- if (!sv.isEmpty() && !sv.isNull()) {
- owner = sv.toString();
- }
}
@Override
@@ -61,74 +27,5 @@ public class NewRepositoryPage extends AccountPage {
protected void onInitialize() {
super.onInitialize();
- if (Strings.isNullOrEmpty(owner)) {
- this.owner = GitPlex.getInstance(UserManager.class).getCurrent().getName();
- }
-
- final IModel<Repository> repositoryModel = new RepositoryModel(new Repository());
- Form<Repository> form = new Form<Repository>("form", repositoryModel);
- add(form);
-
- form.add(new FeedbackPanel("feedback", form));
- DropDownChoiceElement<?> e = new DropDownChoiceElement<String>("owner", "Repository Owner",
- new PropertyModel<String>(this, "owner"),
- new AbstractReadOnlyModel<List<? extends String>>() {
-
- @Override
- public List<String> getObject() {
- UserManager um = GitPlex.getInstance(UserManager.class);
- List<User> users = um.getManagableAccounts(um.getCurrent());
- List<String> names = Lists.newArrayList();
- for (User each : users) {
- names.add(each.getName());
- }
-
- return names;
- }
- });
-
- form.add(e.addFormComponentBehavior(AttributeModifier.replace("data-ays-ignore", "true")));
-
- form.add(new TextFieldElement<String>("name", "Repository Name",
- new PropertyModel<String>(repositoryModel, "name"))
- .add(new PropertyValidator<String>())
- .add(new IValidator<String>() {
-
- @Override
- public void validate(IValidatable<String> validatable) {
- String name = validatable.getValue();
- User o = GitPlex.getInstance(UserManager.class).findByName(owner);
-
- for (Repository each : o.getRepositories()) {
- if (each.getName().equalsIgnoreCase(name)) {
- validatable.error(new ValidationError().setMessage("This repository already exists"));
- return;
- }
- }
- }
-
- }));
-
- form.add(new TextFieldElement<String>("description", "Description",
- new PropertyModel<String>(repositoryModel, "description"))
- .add(new PropertyValidator<String>())
- .setRequired(false));
-
- form.add(new AjaxButton("submit", form) {
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- target.add(form);
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- Repository repository = repositoryModel.getObject();
- User o = GitPlex.getInstance(UserManager.class).findByName(owner);
- Preconditions.checkNotNull(o);
- repository.setOwner(o);
- GitPlex.getInstance(RepositoryManager.class).save(repository);
- setResponsePage(RepositoryHomePage.class, RepositoryHomePage.paramsOf(repository));
- }
- });
}
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.html
index 78a817fc75..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.html
@@ -1,35 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <section class="repositories">
- <div class="head">REPOSITORIES</div>
- <div class="body">
- <div class="actions clearfix">
- <div class="pull-left">
- <form class="form-inline form-search">
- <div class="form-group">
- <input type="search" class="form-control" placeholder="Find a repository ..." />
- </div>
- <button class="btn btn-default"><i class="fa fa-search"></i> Search</button>
- </form>
- </div>
- <wicket:enclosure child="newRepo">
- <div class="pull-left">
- <a wicket:id="newRepo" class="btn btn-default"><i class="fa fa-plus"></i> Add New</a>
- </div>
- </wicket:enclosure>
- </div>
- <ul class="list-unstyled">
- <li wicket:id="repositories">
- <i class="fa fa-ext fa-repo"></i>
- <a wicket:id="repositorylink" class="repo-link"><span wicket:id="name"></span></a>
- <wicket:enclosure>
- forked from <span wicket:id="forklink"></span>
- </wicket:enclosure>
- <div wicket:id="description" class="description"></div>
- <div class="age">Last updated <span wicket:id="lastUpdated"></span></div>
- </li>
- </ul>
- </div>
- </section>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.java
index a11e7aa7b5..e93d89ae7a 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/repository/RepositoriesPage.java
@@ -1,31 +1,8 @@
package com.pmease.gitplex.web.page.account.repository;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.pmease.commons.git.Commit;
-import com.pmease.commons.git.command.LogCommand;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.component.label.AgeLabel;
-import com.pmease.gitplex.web.component.repository.RepositoryHomeLink;
-import com.pmease.gitplex.web.model.RepositoryModel;
import com.pmease.gitplex.web.page.account.AccountPage;
-import com.pmease.gitplex.web.page.repository.RepositoryHomePage;
@SuppressWarnings("serial")
public class RepositoriesPage extends AccountPage {
@@ -42,67 +19,5 @@ public class RepositoriesPage extends AccountPage {
@Override
protected void onInitialize() {
super.onInitialize();
-
- User currentUser = getCurrentUser();
- if (getAccount().equals(currentUser)) {
- add(new BookmarkablePageLink<Void>("newRepo", NewRepositoryPage.class,
- NewRepositoryPage.paramsOf(currentUser)));
- } else {
- add(new WebMarkupContainer("newRepo").setVisible(false));
- }
-
- ListView<Repository> repositoriesView = new ListView<Repository>("repositories", new AbstractReadOnlyModel<List<Repository>>() {
-
- @Override
- public List<Repository> getObject() {
- List<Repository> repositories = Lists.newArrayList(getAccount().getRepositories());
- Collections.sort(repositories, new Comparator<Repository>() {
-
- @Override
- public int compare(Repository repo1, Repository repo2) {
- return repo1.getName().compareTo(repo2.getName());
- }
-
- });
- return repositories;
- }
-
- }) {
-
- @Override
- protected void populateItem(ListItem<Repository> item) {
- Repository repo = item.getModelObject();
- item.add(new BookmarkablePageLink<Void>("repositorylink", RepositoryHomePage.class, RepositoryHomePage.paramsOf(repo))
- .add(new Label("name", repo.getName())));
-
- if (repo.getForkedFrom() != null) {
- item.add(new RepositoryHomeLink("forklink", new RepositoryModel(repo.getForkedFrom())));
- } else {
- item.add(new WebMarkupContainer("forklink").setVisibilityAllowed(false));
- }
-
- item.add(new Label("description", repo.getDescription()));
-
- final Long repositoryId = repo.getId();
- item.add(new AgeLabel("lastUpdated", new AbstractReadOnlyModel<Date>() {
-
- @Override
- public Date getObject() {
- Repository repository = GitPlex.getInstance(Dao.class).load(Repository.class, repositoryId);
- if (repository.git().hasCommits()) {
- LogCommand command = new LogCommand(repository.git().repoDir());
- List<Commit> commits = command.maxCount(1).call();
- Commit first = Iterables.getFirst(commits, null);
- return first.getCommitter().getWhen();
- } else {
- return repository.getCreatedAt();
- }
- }
- }));
- }
-
- };
-
- add(repositoriesView);
}
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.html
index 3df83b4138..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.html
@@ -1,31 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <section class="teams">
- <div class="head">Teams</div>
- <div class="body">
- <div class="actions">
- <a class="btn btn-default" wicket:id="addTeam"><i class="fa fa-plus"></i> Add team</a>
- </div>
- <table class="table table-hover teams-table" wicket:id="teams"></table>
- </div>
- </section>
-
- <wicket:fragment wicket:id="ops">
- <ul class="piped">
- <li><a wicket:id="removelink" class="remove-link first" title="remove"><i class="fa fa-times-circle"></i> remove</a></li>
- </ul>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="permissionop">
- <a wicket:id="link"><i wicket:id="icon"></i></a>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="namefrag">
- <div class="name">
- <a wicket:id="link"><span wicket:id="name"></span> <i class="fa fa-pencil" wicket:id="icon"></i></a>
- <b class="label label-builtin" wicket:id="builtin">built-in</b>
- </div>
- <div class="text-muted" wicket:id="summary"></div>
- </wicket:fragment>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.java
index 24d6630315..0a1002893e 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AccountTeamsPage.java
@@ -1,47 +1,8 @@
package com.pmease.gitplex.web.page.account.team;
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.HeaderlessColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.HeadersToolbar;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.NoRecordsToolbar;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.Restrictions;
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.TeamManager;
-import com.pmease.gitplex.core.model.Team;
-import com.pmease.gitplex.core.permission.operation.GeneralOperation;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Icon;
-import com.pmease.gitplex.web.common.wicket.component.datagrid.DataGrid;
-import com.pmease.gitplex.web.common.wicket.component.datagrid.hibernate.EntityListProvider;
-import com.pmease.gitplex.web.model.TeamModel;
import com.pmease.gitplex.web.page.account.AccountPage;
-import com.pmease.gitplex.web.util.EnumUtils;
@SuppressWarnings("serial")
public class AccountTeamsPage extends AccountPage {
@@ -58,255 +19,6 @@ public class AccountTeamsPage extends AccountPage {
@Override
protected void onInitialize() {
super.onInitialize();
-
- add(new BookmarkablePageLink<Void>("addTeam", AddTeamPage.class, paramsOf(getAccount())));
- add(createTeamTable());
- }
-
- private String getPermissionMessage(GeneralOperation operation) {
- switch (operation) {
- case NO_ACCESS:
- return "can NOT access";
-
- case READ:
- return "can pull and browse";
-
- case WRITE:
- return "can pull and push";
-
- case ADMIN:
- return "can pull, push and admin";
-
- default:
- throw new IllegalArgumentException(operation.name());
- }
- }
-
- private String formatTeamDescription(Team team) {
- TeamManager tm = GitPlex.getInstance(TeamManager.class);
- GeneralOperation operation = tm.getActualAuthorizedOperation(team);
- if (team.isAnonymous()) {
- return String.format("Users %s any repositories within this account without logging in",
- getPermissionMessage(operation));
- } else if (team.isLoggedIn()) {
- return String.format("Logged-in users %s any repositories within this account",
- getPermissionMessage(operation));
- } else if (team.isOwners()) {
- return team.getMemberships().size() + " members have full access to all repositories and this account";
- } else {
- return String.format(team.getMemberships().size() + " members %s any repositories within this account",
- getPermissionMessage(operation));
- }
- }
-
- private Component createTeamTable() {
- List<IColumn<Team, String>> columns = Lists.newArrayList();
- IColumn<Team, String> column = new AbstractColumn<Team, String>(Model.of("Team")) {
-
- @Override
- public void populateItem(Item<ICellPopulator<Team>> cellItem,
- String componentId, IModel<Team> rowModel) {
- Team team = rowModel.getObject();
- Fragment frag = new Fragment(componentId, "namefrag", AccountTeamsPage.this);
- AbstractLink link = new BookmarkablePageLink<Void>("link",
- EditTeamPage.class,
- EditTeamPage.newParams(team));
- link.add(new Label("name", Model.of(team.getName())));
- link.add(new Icon("icon", "fa-pencil"));
- frag.add(link);
- frag.add(new Label("summary", formatTeamDescription(team)));
- frag.add(new Label("builtin", "built-in").setVisibilityAllowed(team.isBuiltIn()));
- cellItem.add(frag);
- }
- };
-
- columns.add(column);
-
- columns.add(new PermissionColumn(GeneralOperation.READ));
- columns.add(new PermissionColumn(GeneralOperation.WRITE));
- columns.add(new PermissionColumn(GeneralOperation.ADMIN));
-
- column = new HeaderlessColumn<Team, String>() {
-
- @Override
- public void populateItem(Item<ICellPopulator<Team>> cellItem,
- String componentId, IModel<Team> rowModel) {
- Team team = rowModel.getObject();
- Fragment frag = new Fragment(componentId, "ops", AccountTeamsPage.this);
- AbstractLink link = new AjaxLink<Team>("removelink", new TeamModel(team)) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Team p = (Team) this.getDefaultModelObject();
- GitPlex.getInstance(Dao.class).remove(p);
- target.add(AccountTeamsPage.this.get("teams"));
- }
- };
- link.add(new ConfirmBehavior("Are you sure you want to remove team <b>" + team.getName() + "</b>?"));
-
- frag.add(link);
- frag.setVisibilityAllowed(!team.isBuiltIn());
- cellItem.add(frag);
- }
-
- @Override
- public String getCssClass() {
- return "operations";
- }
- };
-
- columns.add(column);
-
- IModel<List<Team>> teamsModel = new LoadableDetachableModel<List<Team>>() {
-
- @Override
- protected List<Team> load() {
- Dao dao = GitPlex.getInstance(Dao.class);
- return dao.query(EntityCriteria.of(Team.class)
- .add(Restrictions.eq("owner", getAccount()))
- .addOrder(Order.asc("id")));
- }
-
- };
-
- EntityListProvider<Team> provider = new EntityListProvider<Team>(teamsModel);
- DataGrid<Team> table = new DataGrid<Team>("teams", columns, provider, Integer.MAX_VALUE);
- table.addBottomToolbar(new NoRecordsToolbar(table, Model.of("No Teams Found")));
- table.addTopToolbar(new HeadersToolbar<String>(table, provider));
-
- return table;
- }
-
- private GeneralOperation getTeamPermission(Team team) {
- TeamManager tm = GitPlex.getInstance(TeamManager.class);
- return tm.getActualAuthorizedOperation(team);
- }
-
- private class PermissionColumn extends AbstractColumn<Team, String> {
-
- final GeneralOperation operation;
-
- public PermissionColumn(GeneralOperation operation) {
- super(Model.of(operation.toString()));
- this.operation = operation;
- }
-
- @Override
- public void populateItem(Item<ICellPopulator<Team>> cellItem,
- String componentId, IModel<Team> rowModel) {
- Fragment frag = new Fragment(componentId, "permissionop", AccountTeamsPage.this);
- Team team = rowModel.getObject();
- boolean displayed = true;
- if (team.isAnonymous()) {
- displayed = operation == GeneralOperation.READ;
- } else if (team.isLoggedIn()) {
- displayed = operation != GeneralOperation.ADMIN;
- }
-
- if (!displayed) {
- cellItem.add(new WebMarkupContainer(componentId).setVisibilityAllowed(false));
- return;
- }
-
- boolean enabled = true;
-
- if (team.isOwners()) {
- enabled = false; // cannot edit owners team permission
- } else if (team.isAnonymous() || operation == GeneralOperation.ADMIN) {
- enabled = true; // can always edit anonymous and admin column
- } else {
- TeamManager tm = GitPlex.getInstance(TeamManager.class);
- if (operation == GeneralOperation.READ) {
- GeneralOperation op = tm.getAnonymous(getAccount()).getAuthorizedOperation();
- if (op == operation) {
- // READ
- enabled = false;
- } else {
- op = tm.getLoggedIn(getAccount()).getAuthorizedOperation();
- enabled = team.isLoggedIn() ? true : !op.can(GeneralOperation.READ);
- }
- } else if (operation == GeneralOperation.WRITE) {
- GeneralOperation op = tm.getLoggedIn(getAccount()).getAuthorizedOperation();
- enabled = team.isLoggedIn() ? true : !op.can(GeneralOperation.WRITE);
- }
- }
-
- final Long teamId = team.getId();
- AbstractLink link = new AjaxLink<Void>("link") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Team team = GitPlex.getInstance(Dao.class).load(Team.class, teamId);
- GeneralOperation permission = team.getAuthorizedOperation();
- if (Objects.equal(operation, permission)
- || operation.ordinal() < permission.ordinal()) {
- team.setAuthorizedOperation(EnumUtils.dec(operation));
- } else {
- team.setAuthorizedOperation(operation);
- }
-
- GitPlex.getInstance(Dao.class).persist(team);
- target.add(AccountTeamsPage.this.get("teams"));
- }
- };
-
- link.setEnabled(enabled);
- link.add(new Icon("icon", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- Team team = GitPlex.getInstance(Dao.class).load(Team.class, teamId);
- return getTeamPermission(team).can(operation) ?
- "fa-check-square-o" : "fa-square-o";
- }
-
- }));
- frag.add(link);
- cellItem.add(frag);
- }
-
- @Override
- public String getCssClass() {
- return "permission-col";
- }
}
- @Deprecated
- Component newTeamsView() {
- final WebMarkupContainer teamsDiv = new WebMarkupContainer("teams");
- teamsDiv.setOutputMarkupId(true);
-
- IModel<List<Team>> teamsModel = new LoadableDetachableModel<List<Team>>() {
-
- @Override
- protected List<Team> load() {
- List<Team> teams = Lists.newArrayList(getAccount().getTeams());
- return teams;
- }
- };
-
- ListView<Team> view = new ListView<Team>("team", teamsModel) {
-
- @Override
- protected void populateItem(ListItem<Team> item) {
- Team team = item.getModelObject();
- AbstractLink link = new BookmarkablePageLink<Void>("link",
- EditTeamPage.class,
- EditTeamPage.newParams(team));
- link.add(new Label("name", Model.of(team.getName())));
- item.add(link);
- item.add(new AjaxLink<Team>("removelink", new TeamModel(team)) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Team p = (Team) this.getDefaultModelObject();
- GitPlex.getInstance(Dao.class).remove(p);
- target.add(teamsDiv);
- }
- }.add(new ConfirmBehavior("Are you sure you want to remove team <b>" + team.getName() + "</b>?")));
- }
- };
- teamsDiv.add(view);
- return teamsDiv;
- }
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AddTeamPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AddTeamPage.java
deleted file mode 100644
index 9a1d26b4c5..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/AddTeamPage.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.pmease.gitplex.web.page.account.team;
-
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-@SuppressWarnings("serial")
-public class AddTeamPage extends EditTeamPage {
-
- public AddTeamPage(PageParameters params) {
- super(params);
-
-// this.accountModel = newAccountModel(params);
-// Team team = new Team();
-// team.setOwner(accountModel.getObject());
-// this.teamModel = new TeamModel(team);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/EditTeamPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/EditTeamPage.html
deleted file mode 100644
index ad69e976ee..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/EditTeamPage.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <section>
- <div class="head">
- <h2>
- <wicket:container wicket:id="head">Edit Team</wicket:container>
- <small wicket:id="teamname"></small>
- </h2>
- </div>
- <div class="actionbar" role="toolbar">
- <a wicket:id="backlink" class="btn"><i class="fa fa-long-arrow-left"></i> Back to list</a>
- <div class="btn-group">
- <a class="btn" href="javascript:void(0)" wicket:id="teamstoggle" data-toggle="dropdown"><i class="fa fa-pencil"></i> Edit team <span class="caret"></span></a>
- <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
- <li wicket:id="teams">
- <a wicket:id="editlink"><span wicket:id="name"></span></a>
- </li>
- </ul>
- </div>
- <a wicket:id="addlink" class="btn"><i class="fa fa-plus"></i> New team</a>
- <a class="btn btn-delete-team" wicket:id="deleteteamlink"><i class="fa fa-minus"></i> Remove this team</a>
- </div>
-
- <div class="body">
- <div wicket:id="editor"></div>
- </div>
- </section>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/EditTeamPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/EditTeamPage.java
deleted file mode 100644
index 9f5db912a3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/EditTeamPage.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package com.pmease.gitplex.web.page.account.team;
-
-import java.util.List;
-
-import javax.persistence.EntityNotFoundException;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.string.StringValue;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.Team;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.model.TeamModel;
-import com.pmease.gitplex.web.page.account.AccountPage;
-
-@SuppressWarnings("serial")
-public class EditTeamPage extends AccountPage {
-
- protected IModel<Team> teamModel;
-
- public static PageParameters newParams(Team team) {
- Preconditions.checkNotNull(team);
- PageParameters params = paramsOf(team.getOwner());
- params.set("teamId", team.getId());
- return params;
- }
-
- public EditTeamPage(PageParameters params) {
- super(params);
-
- User user = accountModel.getObject();
-
- StringValue sv = params.get("teamId");
- Team team;
- if (sv.isEmpty() || sv.isNull()) {
- team = new Team();
- team.setOwner(user);
- } else {
- Long id = sv.toLongObject();
- team = GitPlex.getInstance(Dao.class).get(Team.class, id);
- if (team == null) {
- throw new EntityNotFoundException("Team " + id + " doesn't exist");
- }
- }
-
- this.teamModel = new TeamModel(team);
- }
-
- @Override
- public boolean isPermitted() {
- Team team = getTeam();
- return SecurityUtils.getSubject().isPermitted(Permission.ofUserAdmin(team.getOwner()));
- }
-
- @Override
- protected String getPageTitle() {
- Team team = getTeam();
- return team.getId() == null ? "Create Team" : team.getOwner().getName() + "'s team " + team.getName();
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new TeamEditor("editor", new TeamModel(getTeam())));
- add(new Label("head", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return getTeam().getId() == null ? "Create Team" : "Edit Team";
- }
-
- }));
-
- add(new Label("teamname", new PropertyModel<String>(teamModel, "name")));
- add(new BookmarkablePageLink<Void>("backlink", AccountTeamsPage.class,
- AccountTeamsPage.paramsOf(getAccount())));
-
- add(new BookmarkablePageLink<Void>("addlink", AddTeamPage.class,
- AddTeamPage.paramsOf(getAccount())));
-
- WebMarkupContainer teamstoggle = new WebMarkupContainer("teamstoggle");
- add(teamstoggle);
-
- IModel<List<Team>> teamsModel = new LoadableDetachableModel<List<Team>>() {
-
- @Override
- public List<Team> load() {
- Team current = getTeam();
- if (current.getId() == null) {
- return Lists.newArrayList(getAccount().getTeams());
- } else {
- List<Team> teams = Lists.newArrayList();
- for (Team each : getAccount().getTeams()) {
- if (!Objects.equal(each, current)) {
- teams.add(each);
- }
- }
-
- return teams;
- }
- }
- };
-
- ListView<Team> teamsView = new ListView<Team>("teams", teamsModel) {
-
- @Override
- protected void populateItem(ListItem<Team> item) {
- Team team = item.getModelObject();
- AbstractLink link = new BookmarkablePageLink<Void>("editlink", EditTeamPage.class, EditTeamPage.newParams(team));
- link.add(new Label("name", team.getName()));
- item.add(link);
- }
-
- };
- add(teamsView);
-
- add(new AjaxLink<Void>("deleteteamlink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Team team = getTeam();
- GitPlex.getInstance(Dao.class).remove(team);
- setResponsePage(AccountTeamsPage.class, AccountTeamsPage.paramsOf(getAccount()));
- }
-
- }.add(new ConfirmBehavior("Are you sure you want to delete this team?")));
- }
-
- protected Team getTeam() {
- return teamModel.getObject();
- }
-
- @Override
- public void onDetach() {
- if (teamModel != null) {
- teamModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/RepositoryAdded.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/RepositoryAdded.java
deleted file mode 100644
index 4835b89ebc..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/RepositoryAdded.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.pmease.gitplex.web.page.account.team;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-
-import com.pmease.commons.wicket.AjaxEvent;
-
-public class RepositoryAdded extends AjaxEvent {
-
- public RepositoryAdded(AjaxRequestTarget target) {
- super(target);
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamEditor.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamEditor.html
deleted file mode 100644
index 0fc90f20b9..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamEditor.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <form class="form-inline form-md" wicket:id="infoForm">
- <div wicket:id="feedback"></div>
- <div class="form-group">
- <label class="control-label">Name <span class="required">*</span></label>
- <input type="text" class="form-control focusable" placeholder="Name" wicket:id="name" />
- </div>
- <div class="form-group">
- <label class="control-label">Permission</label>
- <select class="form-control" wicket:id="permission"></select>
- </div>
- <div class="form-group">
- <label class="control-label">&nbsp;</label>
- <button type="submit" class="btn btn-default form-control dirty-aware" wicket:id="submit">Save Team</button>
- </div>
- <hr />
- </form>
-
- <div wicket:id="members">
- <h4>Members</h4>
- <div wicket:id="teammembers"></div>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamEditor.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamEditor.java
deleted file mode 100644
index 989336a08d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamEditor.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package com.pmease.gitplex.web.page.account.team;
-
-import java.util.List;
-
-import com.pmease.gitplex.core.GitPlex;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.bean.validation.PropertyValidator;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.validation.IValidatable;
-import org.apache.wicket.validation.IValidator;
-import org.apache.wicket.validation.ValidationError;
-import org.hibernate.criterion.Restrictions;
-
-import com.google.common.collect.ImmutableList;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
-import com.pmease.gitplex.core.model.Team;
-import com.pmease.gitplex.core.permission.operation.GeneralOperation;
-
-@SuppressWarnings("serial")
-public class TeamEditor extends Panel {
-
- public TeamEditor(String id, IModel<Team> teamModel) {
- super(id, teamModel);
- this.setOutputMarkupId(true);
- }
-
- private Team getTeam() {
- return (Team) getDefaultModelObject();
- }
-
- private WebMarkupContainer membersDiv;
-
- @SuppressWarnings("unchecked")
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- IModel<Team> teamModel = (IModel<Team>) getDefaultModel();
- add(new TeamPropForm("infoForm", teamModel).setVisibilityAllowed(!getTeam().isOwners()));
- membersDiv = new WebMarkupContainer("members") {
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- Team team = getTeam();
- setVisibilityAllowed(team.getId() != null && !team.isAnonymous() && !team.isLoggedIn());
- }
- };
-
- membersDiv.setOutputMarkupId(true);
- add(membersDiv);
-
-
- membersDiv.add(new TeamMembersEditor("teammembers", teamModel));
-// moreDiv.add(new TeamRepositoriesEditor("teamrepositories", teamModel));
- }
-
- private class TeamPropForm extends Form<Team> {
-
- private String oldTeamName;
-
- public TeamPropForm(String id, IModel<Team> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- Team team = getTeam();
- oldTeamName = team.getName();
- add(new FeedbackPanel("feedback", this));
- add(new TextField<String>("name", new PropertyModel<String>(getDefaultModel(), "name"))
- .add(new IValidator<String>() {
-
- @Override
- public void validate(IValidatable<String> validatable) {
- String name = validatable.getValue();
-
- if (Team.ANONYMOUS.equalsIgnoreCase(name)
- || Team.LOGGEDIN.equalsIgnoreCase(name)
- || Team.OWNERS.equalsIgnoreCase(name)) {
- validatable.error(new ValidationError().setMessage("The name is already exist"));
- return;
- }
-
- if (getTeam().getId() != null && name.equalsIgnoreCase(oldTeamName)) {
- return; // name not change
- }
-
- Dao dao = GitPlex.getInstance(Dao.class);
- boolean b = dao.find(EntityCriteria.of(Team.class)
- .add(Restrictions.eq("owner", getTeam().getOwner()))
- .add(Restrictions.eq("name", name).ignoreCase())) != null;
- if (b) {
- validatable.error(new ValidationError().setMessage("The name is already exist"));
- return;
- }
- }
-
- })
- .add(new PropertyValidator<String>())
- .setRequired(true)
- .setEnabled(!team.isBuiltIn()));
-
- IModel<List<? extends GeneralOperation>> listModel = new AbstractReadOnlyModel<List<? extends GeneralOperation>>() {
-
- @Override
- public List<GeneralOperation> getObject() {
- Team team = getTeam();
- if (team.isAnonymous()) {
- return ImmutableList.<GeneralOperation>of(
- GeneralOperation.NO_ACCESS,
- GeneralOperation.READ);
- } else if (team.isLoggedIn()){
- return ImmutableList.<GeneralOperation>of(
- GeneralOperation.NO_ACCESS,
- GeneralOperation.READ,
- GeneralOperation.WRITE);
- } else if (team.isOwners()) {
- return ImmutableList.of(GeneralOperation.ADMIN);
- } else {
- return ImmutableList.<GeneralOperation>copyOf(
- GeneralOperation.values());
- }
- }
-
- };
-
- add(new DropDownChoice<GeneralOperation>("permission",
- new PropertyModel<GeneralOperation>(getDefaultModel(), "authorizedOperation"),
- listModel));
-
- add(new AjaxButton("submit", this) {
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- target.add(form);
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- Team team = getTeam();
- boolean isNew = team.getId() == null;
- GitPlex.getInstance(Dao.class).persist(team);
- if (isNew) {
- setResponsePage(EditTeamPage.class, EditTeamPage.newParams(team));
- } else {
- form.success(
- String.format("Team has been updated successfully."));
- target.add(form);
- }
-
- }
- });
- }
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamMembersEditor.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamMembersEditor.html
deleted file mode 100644
index fc42914b76..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamMembersEditor.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <form class="form-inline form-md" wicket:id="form">
- <input wicket:id="userchoice" class="team-users-choice" type="hidden" style="width: 300px;"></input>
- <button type="submit" class="btn btn-default dirty-aware" style="margin-left: 8px;" wicket:id="submit">Add</button>
- <p></p>
- <div wicket:id="feedback"></div>
- </form>
- <hr/>
- <div wicket:id="membersview">
- <div wicket:id="removeMemberFeedback"></div>
- <div class="simple-teams-list" wicket:id="members"></div>
- </div>
-
- <wicket:fragment wicket:id="memberactionfrag">
- <a class="img-link remove-link has-tip" wicket:id="remove" data-toggle="tooltip" title="remove this user from this team"><i class="fa fa-times-circle"></i></a>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamMembersEditor.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamMembersEditor.java
deleted file mode 100644
index 259b18fd1d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/account/team/TeamMembersEditor.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package com.pmease.gitplex.web.page.account.team;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import com.pmease.gitplex.core.GitPlex;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.util.WildcardListModel;
-import org.apache.wicket.util.time.Duration;
-import org.hibernate.criterion.Restrictions;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.commons.wicket.behavior.TooltipBehavior;
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
-import com.pmease.gitplex.core.model.Membership;
-import com.pmease.gitplex.core.model.Team;
-import com.pmease.gitplex.core.model.User;
-import com.pmease.gitplex.web.component.user.UserMultiChoice;
-import com.pmease.gitplex.web.model.UserModel;
-import com.pmease.gitplex.web.page.account.MemberListPanel;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
-
-@SuppressWarnings("serial")
-public class TeamMembersEditor extends Panel {
-
- public TeamMembersEditor(String id, IModel<Team> model) {
- super(id, model);
- }
-
- private Form<?> membersForm;
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- this.membersForm = newMembersForm();
- add(membersForm);
-
- WebMarkupContainer membersDiv = new WebMarkupContainer("membersview");
- membersDiv.setOutputMarkupId(true);
- membersDiv.add(new TooltipBehavior(new TooltipConfig().withSelector("a.remove-link")));
- add(membersDiv);
-
- final IModel<List<User>> membersModel = new LoadableDetachableModel<List<User>>() {
-
- @Override
- protected List<User> load() {
- Team team = getTeam();
- if (team.getId() == null) {
- return Collections.emptyList();
- }
-
- List<User> users = Lists.newArrayList();
- List<Membership> memberships = GitPlex.getInstance(Dao.class)
- .query(EntityCriteria.of(Membership.class).add(Restrictions.eq("team", team)));
- for (Membership each : memberships) {
- users.add(each.getUser());
- }
-
- Collections.sort(users, new java.util.Comparator<User>() {
-
- @Override
- public int compare(User o1, User o2) {
- return o1.getName()
- .compareTo(o2.getName());
- }
- });
-
- return users;
- }
- };
-
- Component membersView = newMembersListView(membersModel);
- membersDiv.add(membersView);
- FeedbackPanel removeMembersFeedback = new FeedbackPanel("removeMemberFeedback", membersDiv);
- membersDiv.add(removeMembersFeedback);
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- private Form<?> newMembersForm() {
- Form<?> form = new Form<Void>("form");
- form.add(new FeedbackPanel("feedback", form).hideAfter(Duration.seconds(10)));
- final IModel<Collection<User>> usersModel = new WildcardListModel(new ArrayList<User>());
-
- form.add(new UserMultiChoice("userchoice", usersModel));
- form.add(new AjaxButton("submit", form) {
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- form.error("Please fix errors below.");
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- Set<User> users = Sets.newHashSet(usersModel.getObject());
-
- if (users.isEmpty()) {
- form.warn("Please add an user first");
- target.add(form);
- return;
- }
-
- Team team = getTeam();
- Dao dao = GitPlex.getInstance(Dao.class);
- List<Membership> memberships = dao.query(EntityCriteria.of(Membership.class).add(Restrictions.eq("team", team)));
- for (Membership each : memberships) {
- if (users.contains(each.getUser())) {
- users.remove(each.getUser());
- }
- }
-
- for (User each : users) {
- Membership m = new Membership();
- m.setTeam(team);
- m.setUser(each);
- dao.persist(m);
- }
-
- usersModel.setObject(new ArrayList<User>());
- if (users.size() == 0) {
- form.warn("Users were added before");
- target.add(form);
- } else {
- form.success(users.size() + " new members added to this team");
- target.add(form);
- onMembersChanged(target);
- }
- }
- });
-
- return form;
- }
-
- private Component newMembersListView(IModel<List<User>> membersModel) {
- return new MemberListPanel("members", new UserModel(getTeam().getOwner()), membersModel){
-
- @Override
- protected Component createMemberTeams(String id, final IModel<User> user) {
- return new WebMarkupContainer(id).setVisibilityAllowed(false);
- }
-
- @Override
- protected Component createActionsPanel(String id, IModel<User> model) {
- Fragment frag = new Fragment(id, "memberactionfrag", TeamMembersEditor.this);
- frag.add(new AjaxLink<User>("remove", new UserModel(model.getObject())) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Dao dao = GitPlex.getInstance(Dao.class);
- User user = (User) getDefaultModelObject();
- Team team = getTeam();
- Membership membership = dao.find(EntityCriteria.of(Membership.class)
- .add(Restrictions.eq("user", user))
- .add(Restrictions.eq("team", team)));
- if (membership != null) {
- dao.remove(membership);
-
- // Use membersForm to show feedback?
- //
- membersForm.info(String.format("User %s is removed from the team",
- user.getName()));
- target.add(membersForm);
- onMembersChanged(target);
- }
- }
- }.setVisibilityAllowed(
- !(getTeam().isOwners() && Objects.equal(getTeam().getOwner(), model.getObject()))));
- return frag;
- }
- }.setOutputMarkupId(true);
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
- }
-
- private void onMembersChanged(AjaxRequestTarget target) {
- target.add(get("membersview"));
-// target.appendJavaScript(JQuery.$("a.remove-link").chain("tooltip").get());
- }
-
- private Team getTeam() {
- return (Team) getDefaultModelObject();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/AccessDeniedPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/AccessDeniedPage.html
deleted file mode 100644
index dfaa62f6d8..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/AccessDeniedPage.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <h1>Sorry!</h1>
- <h2>403 - access denied</h2>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/AccessDeniedPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/AccessDeniedPage.java
deleted file mode 100644
index 2ece5612c3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/AccessDeniedPage.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.pmease.gitplex.web.page.error;
-
-import org.apache.commons.httpclient.HttpStatus;
-
-public class AccessDeniedPage extends BaseErrorPage {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected String getPageTitle() {
- return "403 - Access denied";
- }
-
- @Override
- protected int getErrorCode() {
- return HttpStatus.SC_FORBIDDEN;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/InternalServerErrorPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/InternalServerErrorPage.html
deleted file mode 100644
index 955758a757..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/InternalServerErrorPage.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <h1>Sorry!</h1>
- <h2>501 - Internal Error</h2>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/InternalServerErrorPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/InternalServerErrorPage.java
deleted file mode 100644
index 84abae7f0d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/InternalServerErrorPage.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.pmease.gitplex.web.page.error;
-
-import org.apache.commons.httpclient.HttpStatus;
-
-public class InternalServerErrorPage extends BaseErrorPage {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected String getPageTitle() {
- return "500 - Internal Error";
- }
-
- @Override
- protected int getErrorCode() {
- return HttpStatus.SC_INTERNAL_SERVER_ERROR;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageExpiredPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageExpiredPage.html
deleted file mode 100644
index c671395350..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageExpiredPage.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <h1>Page is expired</h1>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageExpiredPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageExpiredPage.java
deleted file mode 100644
index 21074eda84..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageExpiredPage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.pmease.gitplex.web.page.error;
-
-import org.apache.commons.httpclient.HttpStatus;
-
-@SuppressWarnings("serial")
-public class PageExpiredPage extends BaseErrorPage {
-
- @Override
- protected String getPageTitle() {
- return "Page Expired";
- }
-
- @Override
- protected int getErrorCode() {
- return HttpStatus.SC_OK; // we can recover
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageNotFoundPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageNotFoundPage.html
deleted file mode 100644
index 6e0f070da4..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageNotFoundPage.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <h1>Error</h1>
- <h2>404 - page not found</h2>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageNotFoundPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageNotFoundPage.java
deleted file mode 100644
index 45a86c44d2..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/error/PageNotFoundPage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.pmease.gitplex.web.page.error;
-
-import org.apache.commons.httpclient.HttpStatus;
-
-@SuppressWarnings("serial")
-public class PageNotFoundPage extends BaseErrorPage {
-
- @Override
- protected String getPageTitle() {
- return "404 - Page not found";
- }
-
- @Override
- protected int getErrorCode() {
- return HttpStatus.SC_NOT_FOUND;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/HomePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/HomePage.html
deleted file mode 100644
index bbe9b38746..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/HomePage.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <div class="container">
- <h1>Welcome to GitPlex!</h1>
- </div>
-</wicket:extend>
-</html>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.html
index 6be1250f60..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.html
@@ -1,48 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <div class="page-nav repo-head clearfix">
- <h1 class="repo-info pull-left">
- <span class="repo-avatar"><i wicket:id="repoIcon" class="icon"></i></span>
- <span class="name">
- <a wicket:id="userlink"><wicket:container wicket:id="name"></wicket:container></a> /
- <b><a wicket:id="repositorylink"><wicket:container wicket:id="name"></wicket:container></a></b>
- <wicket:enclosure>
- <span class="status">
- <span class="label label-info" wicket:id="public-label"></span>
- </span>
- </wicket:enclosure>
- </span>
- </h1>
- <ul class="pull-right repo-actions">
- <wicket:container wicket:id="repoActions">
- <li>
- <div class="btn-group">
- <a class="btn btn-default popup-marker"><i class="fa fa-download"></i> Clone <span class="caret"></span></a>
- <a wicket:id="forkRepo" class="btn btn-default"><i class="fa fa-ext fa-repo-fork"></i> Fork</a>
- <a class="btn btn-default"><i class="fa fa-ext fa-branch-compare"></i> Compare</a>
- </div>
- </li>
- </wicket:container>
- </ul>
- </div>
- <table>
- <tbody>
- <tr>
- <td class="sidebar">
- <label class="group">CODE</label>
- <wicket:container wicket:id="codeTabs"></wicket:container>
- <label class="group">PULL REQUESTS</label>
- <wicket:container wicket:id="requestsTabs"></wicket:container>
- <wicket:enclosure child="adminTabs">
- <label class="group">ADMINISTRATION</label>
- <wicket:container wicket:id="adminTabs"></wicket:container>
- </wicket:enclosure>
- </td>
- <td class="content">
- <wicket:child></wicket:child>
- </td>
- </tr>
- </tbody>
- </table>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.java
index 5aff263190..37694155de 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPage.java
@@ -1,92 +1,30 @@
package com.pmease.gitplex.web.page.repository;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nullable;
import javax.persistence.EntityNotFoundException;
import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.Page;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.eclipse.jgit.lib.Constants;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.pmease.commons.git.GitPath;
-import com.pmease.commons.wicket.component.tabbable.Tab;
-import com.pmease.commons.wicket.component.tabbable.Tabbable;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.manager.TeamManager;
-import com.pmease.gitplex.core.manager.UserManager;
-import com.pmease.gitplex.core.model.Authorization;
import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.model.Team;
-import com.pmease.gitplex.core.model.User;
import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.core.permission.operation.GeneralOperation;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Icon;
import com.pmease.gitplex.web.model.RepositoryModel;
import com.pmease.gitplex.web.page.account.AccountBasePage;
-import com.pmease.gitplex.web.page.account.AccountHomePage;
-import com.pmease.gitplex.web.page.repository.admin.GeneralSettingPage;
-import com.pmease.gitplex.web.page.repository.admin.PermissionSettingPage;
-import com.pmease.gitplex.web.page.repository.admin.gatekeeper.GateKeeperPage;
-import com.pmease.gitplex.web.page.repository.admin.integrationpolicy.IntegrationPolicyPage;
-import com.pmease.gitplex.web.page.repository.code.blob.RepoBlobPage;
-import com.pmease.gitplex.web.page.repository.code.branches.BranchComparePage;
-import com.pmease.gitplex.web.page.repository.code.branches.RepoBranchesPage;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
-import com.pmease.gitplex.web.page.repository.code.commits.RepoCommitsPage;
-import com.pmease.gitplex.web.page.repository.code.contributors.ContributorsPage;
-import com.pmease.gitplex.web.page.repository.code.tree.RepoTreePage;
-import com.pmease.gitplex.web.page.repository.pullrequest.ClosedRequestsPage;
-import com.pmease.gitplex.web.page.repository.pullrequest.NewRequestPage;
-import com.pmease.gitplex.web.page.repository.pullrequest.OpenRequestsPage;
-import com.pmease.gitplex.web.page.repository.pullrequest.RequestDetailPage;
@SuppressWarnings("serial")
public abstract class RepositoryPage extends AccountBasePage {
public static final String PARAM_REPO = "repo";
- // below are commonly used params for various pages inherited from this class
- public static final String PARAM_REVISION = "revision";
-
- public static final String PARAM_PATH = "path";
-
protected IModel<Repository> repoModel;
- protected final String currentRevision;
-
- protected final String currentPath;
-
public static PageParameters paramsOf(Repository repository) {
- return paramsOf(repository, null);
- }
-
- public static PageParameters paramsOf(Repository repository, @Nullable String revision) {
- return paramsOf(repository, revision, null);
- }
-
- public static PageParameters paramsOf(Repository repository, @Nullable String revision, @Nullable String path) {
PageParameters params = paramsOf(repository.getUser());
params.set(PARAM_REPO, repository.getName());
- if (revision != null)
- params.set(PARAM_REVISION, revision);
- if (path != null)
- params.set(PARAM_PATH, path);
return params;
}
@@ -96,180 +34,22 @@ public abstract class RepositoryPage extends AccountBasePage {
String repositoryName = params.get(PARAM_REPO).toString();
Preconditions.checkNotNull(repositoryName);
- if (repositoryName.endsWith(Constants.DOT_GIT_EXT))
+ if (repositoryName.endsWith(Constants.DOT_GIT_EXT)) {
repositoryName = repositoryName.substring(0,
repositoryName.length() - Constants.DOT_GIT_EXT.length());
+ }
Repository repository = GitPlex.getInstance(RepositoryManager.class).findBy(getAccount(), repositoryName);
- if (repository == null) {
- throw new EntityNotFoundException("Unable to find repository "
- + getAccount() + "/" + repositoryName);
- }
+ if (repository == null)
+ throw new EntityNotFoundException("Unable to find repository " + getAccount() + "/" + repositoryName);
repoModel = new RepositoryModel(repository);
- currentRevision = GitPath.normalize(params.get(PARAM_REVISION).toString());
- currentPath = GitPath.normalize(params.get(PARAM_PATH).toString());
}
@Override
protected void onInitialize() {
super.onInitialize();
-
- Repository repository = getRepository();
- if (repository.getForkedFrom() != null)
- add(new Icon("repoIcon", "fa-ext fa-repo-fork"));
- else
- add(new Icon("repoIcon", "fa-ext fa-repo"));
-
- AbstractLink userlink = new BookmarkablePageLink<Void>("userlink",
- AccountHomePage.class, AccountHomePage.paramsOf(repository.getOwner()));
- add(userlink);
- userlink.add(new Label("name", Model.of(repository.getOwner().getName())));
-
- AbstractLink repositoryLink = new BookmarkablePageLink<Void>("repositorylink",
- RepositoryHomePage.class, RepositoryHomePage.paramsOf(repository));
- add(repositoryLink);
- repositoryLink.add(new Label("name", Model.of(repository.getName())));
-
- Label publicLabel = new Label("public-label", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return isPubliclyAccessible() ? "public" : "private";
- }
- }) {
- @Override
- public void onEvent(IEvent<?> event) {
- if (event.getPayload() instanceof RepositoryPubliclyAccessibleChanged) {
- RepositoryPubliclyAccessibleChanged e = (RepositoryPubliclyAccessibleChanged) event.getPayload();
- e.getTarget().add(this);
- }
- }
- };
-
- publicLabel.setOutputMarkupId(true);
- publicLabel.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return isPubliclyAccessible() ? "" : "hidden";
- }
-
- }));
- add(publicLabel);
-
- WebMarkupContainer actionsContainer = new WebMarkupContainer("repoActions") {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(getRepository().git().hasCommits());
- }
-
- };
- add(actionsContainer);
-
- actionsContainer.add(new Link<Void>("forkRepo") {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- UserManager userManager = GitPlex.getInstance(UserManager.class);
- User currentUser = userManager.getCurrent();
- setVisible(getRepository().isForkable()
- && currentUser != null
- && !getRepository().getOwner().equals(currentUser));
- }
-
- @Override
- public void onClick() {
- User currentUser = GitPlex.getInstance(UserManager.class).getCurrent();
- Repository forked = GitPlex.getInstance(RepositoryManager.class).fork(getRepository(), currentUser);
- setResponsePage(RepositoryHomePage.class, paramsOf(forked));
- }
-
- });
-
- add(new BookmarkablePageLink<Void>("adminRepo",
- GeneralSettingPage.class, paramsOf(getRepository())) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisibilityAllowed(SecurityUtils.getSubject().isPermitted(Permission.ofRepositoryAdmin(getRepository())));
- }
- });
-
- List<Tab> codeTabs = new ArrayList<>();
- codeTabs.add(new RepositoryTab(Model.of("Files"), "fa fa-file-code-o fa-fw", RepoTreePage.class, RepoBlobPage.class));
- codeTabs.add(new RepositoryTab(Model.of("Commits"), "fa fa-ext fa-commit fa-fw", RepoCommitsPage.class, RepoCommitPage.class));
- codeTabs.add(new RepositoryTab(Model.of("Branches"), "fa fa-ext fa-branch fa-fw", RepoBranchesPage.class, BranchComparePage.class));
- codeTabs.add(new RepositoryTab(Model.of("Contributors"), "fa fa-group fa-fw", ContributorsPage.class));
-
- add(new Tabbable("codeTabs", codeTabs));
-
- List<Tab> requestsTabs = new ArrayList<>();
- requestsTabs.add(new RepositoryTab(Model.of("Open"), "fa fa-ext fa-diff-renamed fa-fw", OpenRequestsPage.class) {
-
- @Override
- public boolean isActive(Page currentPage) {
- if (currentPage instanceof RequestDetailPage) {
- RequestDetailPage detailPage = (RequestDetailPage) currentPage;
- if (detailPage.getPullRequest().isOpen())
- return true;
- }
- return super.isActive(currentPage);
- }
-
- });
- requestsTabs.add(new RepositoryTab(Model.of("Closed"), "fa fa-circle-o fa-fw", ClosedRequestsPage.class) {
-
- @Override
- public boolean isActive(Page currentPage) {
- if (currentPage instanceof RequestDetailPage) {
- RequestDetailPage detailPage = (RequestDetailPage) currentPage;
- if (!detailPage.getPullRequest().isOpen())
- return true;
- }
- return super.isActive(currentPage);
- }
-
- });
- requestsTabs.add(new RepositoryTab(Model.of("Create"), "fa fa-plus fa-fw", NewRequestPage.class));
-
- add(new Tabbable("requestsTabs", requestsTabs));
-
- List<Tab> adminTabs = Lists.newArrayList();
- adminTabs.add(new RepositoryTab(Model.of("General Settings"), "fa fa-gear fa-fw", GeneralSettingPage.class));
- adminTabs.add(new RepositoryTab(Model.of("Permissions"), "fa fa-lock fa-fw", PermissionSettingPage.class));
- adminTabs.add(new RepositoryTab(Model.of("Gate Keepers"), "fa fa-ext fa-gatekeeper fa-fw", GateKeeperPage.class));
- adminTabs.add(new RepositoryTab(Model.of("Integration Policies"), "fa fa-puzzle-piece fa-fw", IntegrationPolicyPage.class));
-
- add(new Tabbable("adminTabs", adminTabs) {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(SecurityUtils.getSubject().isPermitted(Permission.ofRepositoryAdmin(getRepository())));
- }
-
- });
- }
-
- // TODO: here can be slow?
- private boolean isPubliclyAccessible() {
- Team anonymous = GitPlex.getInstance(TeamManager.class).getAnonymous(getAccount());
- for (Authorization each : getRepository().getAuthorizations()) {
- if (each.getTeam().isAnonymous()) {
- return each.getOperation().can(GeneralOperation.READ);
- }
- }
-
- if (anonymous.getAuthorizedOperation().can(GeneralOperation.READ)) {
- return true;
- }
-
- return false;
}
@Override
@@ -284,18 +64,9 @@ public abstract class RepositoryPage extends AccountBasePage {
@Override
protected void onDetach() {
- if (repoModel != null)
- repoModel.detach();
+ repoModel.detach();
super.onDetach();
}
- public @Nullable String getCurrentRevision() {
- return currentRevision;
- }
-
- public @Nullable String getCurrentPath() {
- return currentPath;
- }
-
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPubliclyAccessibleChanged.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPubliclyAccessibleChanged.java
deleted file mode 100644
index 86d148a016..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/RepositoryPubliclyAccessibleChanged.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.pmease.gitplex.web.page.repository;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-
-import com.pmease.commons.wicket.AjaxEvent;
-
-public class RepositoryPubliclyAccessibleChanged extends AjaxEvent {
-
- public RepositoryPubliclyAccessibleChanged(AjaxRequestTarget target) {
- super(target);
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.html
index 73cbe6ad95..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.html
@@ -1,73 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <section>
- <div class="head">Basic Info</div>
- <div class="body">
- <form class="form-md form-horizontal">
- <div class="form-group">
- <label class="control-label">Location</label>
- <div class="field-controls">
- <p class="message" wicket:id="location"></p>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label">Size</label>
- <div class="field-controls">
- <p class="message" wicket:id="size">27M</p>
- </div>
- </div>
- </form>
- </div>
- </section>
-
- <section>
- <div class="head">Basic Settings</div>
- <div class="body">
- <form class="form-md form-horizontal" wicket:id="form">
- <div class="form-feedback" wicket:id="feedback"></div>
- <div wicket:id="name"></div>
- <div wicket:id="description"></div>
- <hr />
- <div wicket:id="forkable"></div>
-
-
- <div class="submits">
- <button class="btn btn-primary dirty-aware" wicket:id="submit">Update Repository</button>
- </div>
-
- </form>
- </div>
- </section>
-
- <section>
- <div class="head">Actions</div>
- <div class="body">
- <ul class="list-group ">
- <li class="list-group-item">
- <h4>Delete this repository</h4>
- <div class="row">
- <div class="col-lg-8">
- <p>Once this repository is deleted, all related data, including repository, merge requests, etc, are also deleted and can not roll back</p>
- </div>
- <div class="col-lg-4 text-right">
- <button class="btn btn-danger btn-colorful-text" wicket:id="deletelink">Delete this repository</button>
- </div>
- </div>
-
- </li>
- <li class="list-group-item">
- <h4>Transfer ownership</h4>
- <div class="row">
- <div class="col-lg-8">
- <p>Transfer this repository to another account where you have <span class="label label-info">ADMIN</span> rights</p>
- </div>
- <div class="col-lg-4 text-right">
- <button class="btn btn-danger btn-colorful-text">Transfer ownership</button>
- </div>
- </div>
- </li>
- </ul>
- </div>
- </section>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.java
index 13ab437db7..1f5cd29f7d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/GeneralSettingPage.java
@@ -1,34 +1,9 @@
package com.pmease.gitplex.web.page.repository.admin;
-import org.apache.commons.io.FileUtils;
import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.bean.validation.PropertyValidator;
-import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.time.Duration;
-import org.apache.wicket.validation.IValidatable;
-import org.apache.wicket.validation.IValidator;
-import org.apache.wicket.validation.ValidationError;
-import com.google.common.base.Objects;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.common.quantity.Data;
-import com.pmease.gitplex.web.common.wicket.form.checkbox.CheckBoxElement;
-import com.pmease.gitplex.web.common.wicket.form.textfield.TextFieldElement;
-import com.pmease.gitplex.web.page.account.AccountHomePage;
import com.pmease.gitplex.web.page.repository.RepositoryPage;
@SuppressWarnings("serial")
@@ -38,102 +13,9 @@ public class GeneralSettingPage extends RepositoryPage {
super(params);
}
- private String repositoryName;
-
@Override
protected void onInitialize() {
super.onInitialize();
-
- add(new Label("location", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return getRepository().git().repoDir().toString();
- }
-
- }));
-
- add(new Label("size", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- long size = FileUtils.sizeOf(getRepository().git().repoDir());
- return Data.formatBytes(size);
- }
-
- }));
-
- repositoryName = getRepository().getName();
-
- Form<?> form = new Form<Void>("form");
- add(form);
- form.add(new FeedbackPanel("feedback",
- new ComponentFeedbackMessageFilter(form))
- .hideAfter(Duration.seconds(15)));
-
- form.add(new TextFieldElement<String>("name", "Repository Name",
- new PropertyModel<String>(this, "repositoryName"))
- .add(new PropertyValidator<String>())
- .add(new IValidator<String>() {
-
- @Override
- public void validate(IValidatable<String> validatable) {
- Repository repository = getRepository();
-
- String name = validatable.getValue();
- if (Objects.equal(name, repository.getName())) {
- return;
- }
-
- RepositoryManager pm = GitPlex.getInstance(RepositoryManager.class);
- if (pm.findBy(repository.getOwner(), name) != null) {
- validatable.error(new ValidationError().setMessage("Repository name is already exist"));
- }
- }
- }));
- form.add(new TextFieldElement<String>("description", "Description",
- new PropertyModel<String>(repoModel, "description"))
- .add(new PropertyValidator<String>())
- .setRequired(false));
-
- form.add(new CheckBoxElement("forkable", "Allow Forks",
- new PropertyModel<Boolean>(repoModel, "forkable"),
- Model.of("Enable/Disable whether this repository can be forked by others")));
-
- form.add(new AjaxButton("submit", form) {
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- target.add(form);
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- Repository repository = getRepository();
- boolean nameChanged = !Objects.equal(repository.getName(), repositoryName);
- if (nameChanged) {
- repository.setName(repositoryName);
- }
-
- GitPlex.getInstance(RepositoryManager.class).save(repository);
-
- if (nameChanged) {
- setResponsePage(GeneralSettingPage.class, GeneralSettingPage.paramsOf(repository));
- } else {
- form.success("Repository " + repository + " has been updated.");
- target.add(form);
- }
- }
- });
-
- add(new AjaxLink<Void>("deletelink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- GitPlex.getInstance(RepositoryManager.class).delete(getRepository());
- setResponsePage(AccountHomePage.class, AccountHomePage.paramsOf(getAccount()));
- }
- }.add(new ConfirmBehavior("<p>Are you sure you want to delete repository: " + getRepository()
- + "?</p><b>NOTE:</b> Once you delete this repository, there is no going back")));
}
@Override
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.html
index 290da7ae46..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.html
@@ -1,31 +1,2 @@
-<html xmlns:wicket>
<wicket:extend>
- <section>
- <div class="head">Repository Permissions</div>
- <div class="actionbar">
- <a class="btn" wicket:id="teamslink"><i class="fa fa-group"></i> Manage Teams</a>
- <a class="btn" wicket:id="resetlink"><i class="fa fa-undo"></i> Reset to default permissions</a>
- </div>
- <div class="body">
- <table class="table teams-table table-hover" wicket:id="teamstable">
- </table>
- </div>
- </section>
-
- <wicket:fragment wicket:id="permissionop">
- <a wicket:id="link"><i wicket:id="icon"></i></a>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="namefrag">
- <div class="name">
- <a wicket:id="editlink"><span wicket:id="name"></span> <i class="fa fa-pencil" wicket:id="icon"></i></a>
- </div>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="operationfrag">
- <ul class="piped">
- <li><a class="first" wicket:id="btn">use default</a></li>
- </ul>
- </wicket:fragment>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.java
index 4c5f70dd75..dba445bc59 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/admin/PermissionSettingPage.java
@@ -1,54 +1,10 @@
package com.pmease.gitplex.web.page.repository.admin;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.HeaderlessColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.HeadersToolbar;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.Restrictions;
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.commons.wicket.behavior.ConfirmBehavior;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.manager.TeamManager;
-import com.pmease.gitplex.core.model.Authorization;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.model.Team;
import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.core.permission.operation.GeneralOperation;
-import com.pmease.gitplex.web.common.wicket.component.datagrid.DataGrid;
-import com.pmease.gitplex.web.common.wicket.component.datagrid.hibernate.EntityListProvider;
-import com.pmease.gitplex.web.page.account.team.AccountTeamsPage;
-import com.pmease.gitplex.web.page.account.team.EditTeamPage;
import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.RepositoryPubliclyAccessibleChanged;
-import com.pmease.gitplex.web.util.EnumUtils;
@SuppressWarnings("serial")
public class PermissionSettingPage extends RepositoryPage {
@@ -60,291 +16,8 @@ public class PermissionSettingPage extends RepositoryPage {
@Override
protected void onInitialize() {
super.onInitialize();
-
- add(newTeamsTable());
- add(new AjaxLink<Void>("resetlink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Repository repository = getRepository();
- Collection<Authorization> list = repository.getAuthorizations();
- Dao dao = GitPlex.getInstance(Dao.class);
- for (Iterator<Authorization> it = list.iterator(); it.hasNext();) {
- Authorization auth = it.next();
- dao.remove(auth);
- it.remove();
- }
-
- GitPlex.getInstance(RepositoryManager.class).save(repository);
- onPermissionChanged(null, target);
- }
-
- }.add(new ConfirmBehavior("Are you sure you want to reset to the default permissions?")));
-
- add(new BookmarkablePageLink<Void>("teamslink", AccountTeamsPage.class)
- .setVisibilityAllowed(SecurityUtils.getSubject().isPermitted(Permission.ofUserAdmin(getAccount()))));
- }
-
- private Authorization getAuthorization(Team team) {
- for (Authorization each : getRepository().getAuthorizations()) {
- if (Objects.equal(each.getTeam(), team)) {
- return each;
- }
- }
-
- return null;
- }
-
- private GeneralOperation getOriginalPermission(Team team) {
- if (team.isOwners()) {
- return GeneralOperation.ADMIN;
- }
-
- Authorization auth = getAuthorization(team);
- if (auth != null) {
- return auth.getOperation();
- } else {
- return GitPlex.getInstance(TeamManager.class).getActualAuthorizedOperation(team);
- }
- }
-
- private GeneralOperation getTeamPermission(Team team) {
- GeneralOperation permission = getOriginalPermission(team);
- if (team.isOwners() || team.isAnonymous()) {
- return permission;
- }
-
- TeamManager tm = GitPlex.getInstance(TeamManager.class);
- Team anonymous = tm.getAnonymous(getAccount());
- GeneralOperation anonymousPermission = getOriginalPermission(anonymous);
- if (team.isLoggedIn()) {
- return GeneralOperation.mostPermissive(permission, anonymousPermission);
- }
-
- Team loggedIn = tm.getLoggedIn(getAccount());
- GeneralOperation op = GeneralOperation.mostPermissive(anonymousPermission, getOriginalPermission(loggedIn));
- return GeneralOperation.mostPermissive(permission, op);
- }
-
- private Component newTeamsTable() {
- List<IColumn<Team, String>> columns = Lists.newArrayList();
-
- IColumn<Team, String> column = new AbstractColumn<Team, String>(Model.of("Team")) {
-
- @Override
- public void populateItem(Item<ICellPopulator<Team>> cellItem,
- String componentId, IModel<Team> rowModel) {
- Fragment frag = new Fragment(componentId, "namefrag", PermissionSettingPage.this);
- Team team = rowModel.getObject();
- AbstractLink link = new BookmarkablePageLink<Void>("editlink",
- EditTeamPage.class,
- EditTeamPage.newParams(team));
- boolean enabled = SecurityUtils.getSubject().isPermitted(Permission.ofUserAdmin(getAccount()));
- link.setEnabled(enabled);
- link.add(new Label("name", team.getName()));
- link.add(new WebMarkupContainer("icon").setVisibilityAllowed(enabled));
- frag.add(link);
- cellItem.add(frag);
- }
- };
-
- columns.add(column);
-
- columns.add(new PermissionColumn(GeneralOperation.READ));
- columns.add(new PermissionColumn(GeneralOperation.WRITE));
- columns.add(new PermissionColumn(GeneralOperation.ADMIN));
- columns.add(new HeaderlessColumn<Team, String>() {
-
- @Override
- public void populateItem(Item<ICellPopulator<Team>> cellItem,
- String componentId, final IModel<Team> rowModel) {
- Fragment frag = new Fragment(componentId, "operationfrag", PermissionSettingPage.this);
-
- IModel<Authorization> model = new AbstractReadOnlyModel<Authorization>() {
-
- @Override
- public Authorization getObject() {
- Dao dao = GitPlex.getInstance(Dao.class);
- return dao.find(EntityCriteria.of(Authorization.class)
- .add(Restrictions.eq("team", rowModel.getObject()))
- .add(Restrictions.eq("repository", getRepository())));
- }
-
- };
-
- frag.add(new AjaxLink<Authorization>("btn", model) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Dao dao = GitPlex.getInstance(Dao.class);
- RepositoryManager pm = GitPlex.getInstance(RepositoryManager.class);
- Authorization auth = (Authorization) getDefaultModelObject();
- dao.remove(auth);
- Repository repository = getRepository();
- repository.getAuthorizations().remove(auth);
- pm.save(repository);
- onPermissionChanged(rowModel.getObject(), target);
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- boolean enabled = getDefaultModelObject() != null;
- this.setEnabled(enabled);
- }
- });
-
- cellItem.add(frag);
- }
-
- @Override
- public String getCssClass() {
- return "operations";
- }
- });
-
- IModel<List<Team>> teamsModel = new LoadableDetachableModel<List<Team>>() {
-
- @Override
- protected List<Team> load() {
- Dao dao = GitPlex.getInstance(Dao.class);
- return dao.query(EntityCriteria.of(Team.class)
- .add(Restrictions.eq("owner", getRepository().getOwner()))
- .addOrder(Order.asc("id")));
- }
-
- };
-
- EntityListProvider<Team> provider = new EntityListProvider<Team>(teamsModel);
- DataGrid<Team> table = new DataGrid<Team>("teamstable", columns, provider, Integer.MAX_VALUE);
- table.addTopToolbar(new HeadersToolbar<String>(table, provider));
-
- return table;
}
- private class PermissionColumn extends AbstractColumn<Team, String> {
-
- private final GeneralOperation operation;
-
- public PermissionColumn(GeneralOperation operation) {
- super(Model.of(operation.toString()));
- this.operation = operation;
- }
-
- @Override
- public void populateItem(Item<ICellPopulator<Team>> cellItem,
- String componentId, final IModel<Team> rowModel) {
- Team team = rowModel.getObject();
- boolean displayed = true;
- if (team.isAnonymous()) {
- displayed = operation == GeneralOperation.READ;
- } else if (team.isLoggedIn()) {
- displayed = operation != GeneralOperation.ADMIN;
- }
-
- if (!displayed) {
- cellItem.add(new WebMarkupContainer(componentId).setVisibilityAllowed(false));
- return;
- }
-
- Fragment frag = new Fragment(componentId, "permissionop", PermissionSettingPage.this);
- cellItem.add(frag);
-
- boolean enabled = true;
- if (team.isOwners()) {
- enabled = false; // cannot edit owners team permission
- } else if (team.isAnonymous() || operation == GeneralOperation.ADMIN) {
- enabled = true; // can always edit anonymous and admin column
- } else {
- TeamManager tm = GitPlex.getInstance(TeamManager.class);
- if (operation == GeneralOperation.READ) {
- GeneralOperation op = getTeamPermission(tm.getAnonymous(getAccount()));
- if (op == GeneralOperation.READ) {
- enabled = false;
- } else {
- // operation is NO_ACCESS
- op = getTeamPermission(tm.getLoggedIn(getAccount()));
- enabled = team.isLoggedIn() ? true : !op.can(GeneralOperation.READ);
- }
- } else if (operation == GeneralOperation.WRITE) {
- GeneralOperation op = getTeamPermission(tm.getLoggedIn(getAccount()));
- enabled = team.isLoggedIn() ? true : !op.can(GeneralOperation.WRITE);
- }
- }
-
- AbstractLink link = new AjaxLink<Void>("link") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- Team team = rowModel.getObject();
- GeneralOperation permission = getTeamPermission(rowModel.getObject());
- if (Objects.equal(operation, permission)) {
- permission = EnumUtils.dec(permission);
- } else if (operation.ordinal() < permission.ordinal()) {
- permission = EnumUtils.dec(operation);
- } else {
- permission = operation;
- }
-
- Dao dao = GitPlex.getInstance(Dao.class);
- Authorization auth = dao.find(EntityCriteria.of(Authorization.class)
- .add(Restrictions.eq("repository", getRepository()))
- .add(Restrictions.eq("team", rowModel.getObject())));
-
- if (auth == null) {
- auth = new Authorization();
- auth.setTeam(team);
- auth.setRepository(getRepository());
- }
-
- auth.setOperation(permission);
- dao.persist(auth);
- Repository repository = getRepository();
- repository.getAuthorizations().add(auth);
- GitPlex.getInstance(RepositoryManager.class).save(repository);
- onPermissionChanged(team, target);
-
- if (team.isAnonymous()) {
- send(getPage(), Broadcast.BREADTH, new RepositoryPubliclyAccessibleChanged(target));
- }
- }
-
- };
-
- link.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return operation.ordinal() > getTeamPermission(rowModel.getObject()).ordinal() ?
- "fa fa-check-square-o" : "fa fa-square-o";
- }
-
- })));
-
- link.setEnabled(enabled);
- frag.add(link);
- }
-
- @Override
- public String getCssClass() {
- return "permission-col";
- }
- }
-
- private void onPermissionChanged(Team team, AjaxRequestTarget target) {
- if (team == null || team.isAnonymous()) {
- send(this, Broadcast.BREADTH, new RepositoryPubliclyAccessibleChanged(target));
- }
-
- target.add(get("teamstable"));
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- }
-
@Override
protected String getPageTitle() {
return "Permissions - " + getRepository();
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/ContributorsPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/ContributorsPanel.html
deleted file mode 100644
index 394e161e44..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/ContributorsPanel.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <b wicket:id="contributorStat">2</b> contributors
- <wicket:container wicket:id="contributors">
- <span wicket:id="link"></span>
- </wicket:container>
- <wicket:container wicket:id="morecontainer">
- and more <a wicket:id="more" href="javascript:void(0)"><i class="fa fa-long-arrow-right"></i></a>
- <div wicket:id="moreDropdown"></div>
- </wicket:container>
-
- <wicket:fragment wicket:id="committers-dropdown">
- <div class="popup-content">
- <ul class="committer-list menu-ul">
- <li class="menu-item" wicket:id="committers"><span wicket:id="committer"></span></li>
- </ul>
- </div>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/ContributorsPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/ContributorsPanel.java
deleted file mode 100644
index 88957c07b5..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/ContributorsPanel.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.EnclosureContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.lib.PersonIdent;
-
-import com.google.common.collect.Lists;
-import com.pmease.commons.wicket.behavior.dropdown.DropdownBehavior;
-import com.pmease.commons.wicket.behavior.dropdown.DropdownPanel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.PersonLink;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
-import de.agilecoders.wicket.jquery.JQuery;
-
-@SuppressWarnings("serial")
-public class ContributorsPanel extends Panel {
-
- private final static int MAX_DISPLAYED_COMMITTERS = 20;
-
- public ContributorsPanel(String id, IModel<List<PersonIdent>> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new Label("contributorStat", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getContributors().size();
- }
-
- }));
-
- ListView<PersonIdent> contributorsView = new ListView<PersonIdent>("contributors",
- new AbstractReadOnlyModel<List<PersonIdent>>() {
-
- @Override
- public List<PersonIdent> getObject() {
- List<PersonIdent> committers = getContributors();
- if (committers.size() > MAX_DISPLAYED_COMMITTERS) {
- return Lists.newArrayList(committers.subList(0, MAX_DISPLAYED_COMMITTERS));
- } else {
- return committers;
- }
- }
-
- }) {
-
- @Override
- protected void populateItem(ListItem<PersonIdent> item) {
- item.add(new PersonLink("link", item.getModel(), AvatarMode.AVATAR).withTooltipConfig(new TooltipConfig()));
- }
- };
-
- add(contributorsView);
-
- WebMarkupContainer more = new WebMarkupContainer("more") {
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- this.setVisibilityAllowed(getContributors().size() > MAX_DISPLAYED_COMMITTERS);
- }
- };
-
- DropdownPanel dropdownPanel = new DropdownPanel("moreDropdown", false) {
-
- @SuppressWarnings("unchecked")
- @Override
- protected Component newContent(String id) {
- Fragment frag = new Fragment(id, "committers-dropdown", ContributorsPanel.this);
- frag.add(new ListView<PersonIdent>("committers",
- (IModel<List<PersonIdent>>) ContributorsPanel.this.getDefaultModel()) {
-
- @Override
- protected void populateItem(ListItem<PersonIdent> item) {
- item.add(new PersonLink("committer", item.getModel(), AvatarMode.NAME_AND_AVATAR));
- }
- });
-
- return frag;
- }
- };
- more.add(new DropdownBehavior(dropdownPanel));
-
- EnclosureContainer moreContainer = new EnclosureContainer("morecontainer", more);
- moreContainer.add(more);
- moreContainer.add(dropdownPanel);
-
- add(moreContainer);
- }
-
- @SuppressWarnings("unchecked")
- private List<PersonIdent> getContributors() {
- return (List<PersonIdent>) getDefaultModelObject();
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript(JQuery.$(this, ".has-tip").chain("tooltip").get()));
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.html
index e06dd2f2a4..0e5c1b9fae 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.html
@@ -1,28 +1,4 @@
-<html xmlns:wicket>
<wicket:extend>
- <div class="padder">
- <div wicket:id="breadcrumb"></div>
-
- <section class="source-blob">
- <div class="last-commit">
- <div class="commit-message">
- <pre class="title-message inline" wicket:id="shortMessage"></pre>
- <wicket:container wicket:id="detailedMessageContainer">
- <a class="btn btn-mini btn-gray" href="#" wicket:id="detailed-toggle"><i class="fa fa-ellipsis-h"></i></a>
- <pre class="detailed-message collapse" wicket:id="detailedMessage"></pre>
- </wicket:container>
- </div>
- <div class="persons text-muted">
- <div class="author">
- <span class="name" wicket:id="author"></span> authored <time class="age" wicket:id="author-date"></time>
- </div>
- </div>
- <div class="participants rounded-bottom" wicket:id="paticipants">
- </div>
- </div>
-
- <div wicket:id="source"></div>
- </section>
+ <div class="padder repo-commit">
</div>
</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.java
index a116b17df9..7858ba8b4e 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPage.java
@@ -1,170 +1,47 @@
package com.pmease.gitplex.web.page.repository.code.blob;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.EntityNotFoundException;
-
-import org.apache.wicket.Component;
import org.apache.wicket.RestartResponseException;
-import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.EnclosureContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.eclipse.jgit.lib.PersonIdent;
-import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.pmease.commons.git.Commit;
-import com.pmease.commons.git.Git;
-import com.pmease.commons.wicket.behavior.CollapseBehavior;
-import com.pmease.gitplex.web.component.label.AgeLabel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.PersonLink;
+import com.pmease.commons.git.GitPath;
+import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.web.page.repository.NoCommitsPage;
import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.code.component.SourceBreadcrumbPanel;
-import com.pmease.gitplex.web.service.FileBlob;
@SuppressWarnings("serial")
public class RepoBlobPage extends RepositoryPage {
- private final IModel<Commit> lastCommitModel;
- private final IModel<List<PersonIdent>> committersModel;
+ private static final String PARAM_REVISION = "revision";
+
+ private static final String PARAM_PATH = "path";
+
+ protected IModel<Repository> repoModel;
+
+ protected String revision;
+
+ protected String path;
public RepoBlobPage(PageParameters params) {
super(params);
if (!getRepository().git().hasCommits())
throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
-
- lastCommitModel = new LoadableDetachableModel<Commit>() {
-
- @Override
- protected Commit load() {
- Git git = getRepository().git();
- List<Commit> commits = git.log(null, getRepository().defaultBranchIfNull(getCurrentRevision()), getCurrentPath(), 1, 0);
- Commit commit = Iterables.getFirst(commits, null);
- if (commit == null) {
- throw new EntityNotFoundException(
- "Path: " + getCurrentPath() +
- ", revision: " + getRepository().defaultBranchIfNull(getCurrentRevision()) + " doesn't exist");
- }
- return commit;
- }
- };
- committersModel = new LoadableDetachableModel<List<PersonIdent>>() {
-
- @Override
- protected List<PersonIdent> load() {
- Git git = getRepository().git();
- List<Commit> commits = git.log(null, getRepository().defaultBranchIfNull(getCurrentRevision()), getCurrentPath(), 0, 0);
- Set<PersonIdent> users = Sets.newHashSet();
- for (Commit each : commits) {
- users.add(each.getAuthor());
- }
-
- return Lists.newArrayList(users);
- }
-
- };
+ revision = GitPath.normalize(params.get(PARAM_REVISION).toString());
+ path = GitPath.normalize(params.get(PARAM_PATH).toString());
}
@Override
- public void onInitialize() {
+ protected void onInitialize() {
super.onInitialize();
-
- add(new SourceBreadcrumbPanel("breadcrumb", repoModel, currentRevision, currentPath));
-
- add(new Label("shortMessage", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return getLastCommit().getSubject();
- }
- }));
-
- Label detailedMsg = new Label("detailedMessage", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return getLastCommit().getMessage();
- }
- }) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- if (Objects.equal(getLastCommit().getSubject(), getLastCommit().getMessage())) {
- this.setVisibilityAllowed(false);
- }
- }
- };
-
- EnclosureContainer detailedContainer = new EnclosureContainer("detailedMessageContainer", detailedMsg);
- add(detailedContainer);
- detailedContainer.add(detailedMsg);
-
- WebMarkupContainer detailedToggle = new WebMarkupContainer("detailed-toggle");
- detailedToggle.add(new CollapseBehavior(detailedMsg));
- detailedContainer.add(detailedToggle);
-
- add(new PersonLink("author", Model.of(getLastCommit().getAuthor()), AvatarMode.NAME_AND_AVATAR));
-
- add(new AgeLabel("author-date", new AbstractReadOnlyModel<Date>() {
-
- @Override
- public Date getObject() {
- return getLastCommit().getAuthor().getWhen();
- }
-
- }));
-
- add(new AjaxLazyLoadPanel("paticipants") {
-
- @Override
- public Component getLazyLoadComponent(String markupId) {
- return new ContributorsPanel(markupId, committersModel);
- }
- });
-
- add(new RepoBlobPanel("source", new LoadableDetachableModel<FileBlob>() {
-
- @Override
- protected FileBlob load() {
- return FileBlob.of(getRepository(), getRepository().defaultBranchIfNull(getCurrentRevision()), getCurrentPath());
- }
- }));
- }
-
- @Override
- protected String getPageTitle() {
- return getCurrentPath() + " at " + getRepository().defaultBranchIfNull(getCurrentRevision()) + " " + getRepository().getFQN();
}
- protected Commit getLastCommit() {
- return lastCommitModel.getObject();
+ public static PageParameters paramsOf(Repository repository, String revision, String path) {
+ PageParameters params = paramsOf(repository);
+ params.set(PARAM_REVISION, revision);
+ params.set(PARAM_PATH, path);
+ return params;
}
- @Override
- public void onDetach() {
- if (lastCommitModel != null) {
- lastCommitModel.detach();
- }
-
- if (committersModel != null) {
- committersModel.detach();
- }
-
- super.onDetach();
- }
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPanel.html
deleted file mode 100644
index 7d2cc66f4e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPanel.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="blob">
- <div class="blob-head clearfix">
- <div class="pull-left blob-meta">
- <span><i class="icon" wicket:id="typeicon"></i> <span wicket:id="mode"></span></span>
- <wicket:enclosure child="loc">
- <span><wicket:container wicket:id="loc"></wicket:container> lines (<wicket:container wicket:id="sloc"></wicket:container> sloc)</span>
- </wicket:enclosure>
- <span wicket:id="size"></span>
- </div>
- <div class="pull-right blob-actions btn-toolbar">
- <div class="btn-group">
- <a wicket:id="rawlink" class="btn btn-sm btn-default">Raw</a>
- <a wicket:id="historylink" class="btn btn-sm btn-default">History</a>
- </div>
-
- <div class="btn-group">
- <a class="btn btn-sm btn-danger">Delete</a>
- </div>
- </div>
- </div>
- <div class="blob-body" wicket:id="body">
- </div>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPanel.java
deleted file mode 100644
index 09f2f033dd..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/RepoBlobPanel.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob;
-
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.link.ResourceLink;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.lib.FileMode;
-
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.common.quantity.Data;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Icon;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.BlobRenderer;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.BlobRendererFactory;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.RawBlobResourceReference;
-import com.pmease.gitplex.web.page.repository.code.commits.RepoCommitsPage;
-import com.pmease.gitplex.web.service.FileBlob;
-
-@SuppressWarnings("serial")
-public class RepoBlobPanel extends Panel {
-
- public RepoBlobPanel(String id, IModel<FileBlob> blobModel) {
- super(id, blobModel);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new Label("mode", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- FileMode mode = getBlob().getMode();
- if (mode == FileMode.SYMLINK) {
- return "symbolic link";
- } else if (mode == FileMode.EXECUTABLE_FILE) {
- return "executable file";
- } else {
- return "file";
- }
- }
-
- }));
-
- add(new Icon("typeicon", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return "fa-file-text";
- }
- }));
-
- add(new Label("size", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return Data.formatBytes(getBlob().getSize(), Data.KB);
- }
-
- }));
-
- add(new Label("loc", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getBlob().getLines().size();
- }
-
- }).setVisibilityAllowed(getBlob().isText()));
-
- add(new Label("sloc", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- List<String> lines = getBlob().getLines();
- int sloc = 0;
- for (String each : lines) {
- if (!StringUtils.isBlank(each)) {
- sloc++;
- }
- }
-
- return sloc;
- }
-
- }));
-
- FileBlob blob = getBlob();
-
- Repository repository = GitPlex.getInstance(Dao.class).load(Repository.class, blob.getRepositoryId());
- add(new BookmarkablePageLink<Void>("historylink", RepoCommitsPage.class,
- RepoCommitsPage.paramsOf(
- repository,
- blob.getRevision(),
- blob.getFilePath(),
- 0)));
-
- add(new ResourceLink<Void>("rawlink", new RawBlobResourceReference(),
- RawBlobResourceReference.paramsOf(blob)));
-
- BlobRenderer renderer = getRenderer();
- add(renderer.render("body", (IModel<FileBlob>) getDefaultModel()));
- }
-
- private BlobRenderer getRenderer() {
- return GitPlex.getInstance(BlobRendererFactory.class).newRenderer(getBlob());
- }
-
- private FileBlob getBlob() {
- return (FileBlob) getDefaultModelObject();
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/Language.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/Language.java
deleted file mode 100644
index 22163e9604..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/Language.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.language;
-
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.Objects;
-import com.google.common.base.Strings;
-
-public class Language implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @JsonProperty
- String name;
-
- @JsonProperty
- private String[] mediaTypes;
-
- @JsonProperty
- private String mode;
-
- @JsonProperty
- private String aceMode;
-
- Language() {
- }
-
- public static final Language PLAIN_TEXT =
- new Language("Plain Text", "no-highlight", "text", new String[] { "text/plain"});
-
- public Language(final String name, final String mode, final String aceMode, final String[] mediaTypes) {
- this.name = name;
- this.mode = mode;
- this.aceMode = aceMode;
- this.mediaTypes = mediaTypes;
- }
-
- public String getName() {
- return name;
- }
-
- public String[] getMediaTypes() {
- return mediaTypes;
- }
-
- public String getMode() {
- return mode == null ? "no-highlight" : mode;
- }
-
- public String getAceMode() {
- return Strings.isNullOrEmpty(aceMode) ? "text" : aceMode;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name);
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper(this)
- .add("name", name)
- .add("mode", mode)
- .add("mimeTypes", mediaTypes)
- .toString();
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) return true;
- if (!(other instanceof Language)) return false;
-
- Language rhs = (Language) other;
- return Objects.equal(name, rhs.name);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/Languages.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/Languages.java
deleted file mode 100644
index a20421195d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/Languages.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.language;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.tika.mime.MediaType;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.web.util.StandardObjectMapper;
-
-public enum Languages {
- INSTANCE;
-
- Languages() {
- init();
- }
-
- private Map<String, Language> languages;
- private Map<String, Language> mediaTypeIndex = Maps.newHashMap();
-
- private void init() {
- InputStream in = Languages.class.getResourceAsStream("languages.json");
- try {
- List<Language> list = StandardObjectMapper.getInstance().readValue(in, new TypeReference<List<Language>>(){});
- languages = Maps.newHashMap();
- for (Language each : list) {
- languages.put(each.getName(), each);
- for (String mime : each.getMediaTypes()) {
- mediaTypeIndex.put(mime.toLowerCase(), each);
- }
- }
- } catch (JsonParseException e) {
- throw Throwables.propagate(e);
- } catch (JsonMappingException e) {
- throw Throwables.propagate(e);
- } catch (IOException e) {
- throw Throwables.propagate(e);
- } finally {
- IOUtils.closeQuietly(in);
- }
- }
-
- public Collection<Language> getLanguages() {
- return languages.values();
- }
-
- public @Nullable Language findByMediaType(String mime) {
- MediaType m = MediaType.parse(mime);
- return findByMediaType(m);
- }
-
- public @Nullable Language findByMediaType(MediaType mime) {
- Language lang = mediaTypeIndex.get(mime.toString());
- if (lang == null && MediaTypes.isXML(mime)) {
- return languages.get("xml");
- }
-
- return lang;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/languages.json b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/languages.json
deleted file mode 100644
index 23c0bfc6df..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/language/languages.json
+++ /dev/null
@@ -1,534 +0,0 @@
-[
- {
- name: "ABAP",
- mediaTypes: ["text/x-abap"],
- mode: "abap",
- aceMode: "abap"
- },
- {
- name: "ActionScript",
- mediaTypes: ["text/x-actionscript"],
- mode: "actionscript",
- aceMode: "actionscript"
- },
- {
- name: "Ada",
- mediaTypes: ["text/x-ada"],
- mode: "ada",
- aceMode: "ada"
- },
- {
- name: "Apache Conf",
- mediaTypes: ["text/x-apache-conf", "text/x-apache"],
- mode: "apache"
- },
- {
- name: "AppleScript",
- mediaTypes: ["text/x-applescript"],
- mode: "applescript"
- },
- {
- name: "ASCII Doc",
- mediaTypes: ["text/x-asciidoc"],
- mode: "asciidoc",
- aceMode: "asciidoc"
- },
- {
- name: "Assembly",
- mediaTypes: ["text/x-assembly"],
- aceMode: "assembly"
- },
- {
- name: "Autohotkey",
- mediaTypes: ["text/x-autohotkey"],
- aceMode: "autohotkey"
- },
- {
- name: "Avr ASM",
- mediaTypes: ["text/x-avrasm"],
- mode: "avrasm"
- },
- {
- name: "Axapta",
- mediaTypes: ["text/x-axapta"],
- mode: "axapta"
- },
- {
- name: "Bash",
- mediaTypes: ["text/x-sh", "application/x-sh"],
- mode: "bash",
- aceMode: "sh"
- },
- {
- name: "BrainFuck",
- mediaTypes: ["text/x-brainfuck"],
- mode: "brainfuck"
- },
- {
- name: "Clojure",
- mediaTypes: ["text/x-clojure"],
- mode: "clojure",
- aceMode: "clojure"
- },
- {
- name: "Cobol",
- mediaTypes: ["text/x-cobol"],
- aceMode: "cobol"
- },
- {
- name: "CMake",
- mediaTypes: ["text/x-cmake"],
- mode: "cmake"
- },
- {
- name: "Coffee Script",
- mediaTypes: ["text/x-coffeescript"],
- mode: "coffeescript",
- aceMode: "coffee"
- },
- {
- name: "C",
- mediaTypes: ["text/x-c", "text/x-csrc", "text/x-chdr"],
- mode: "cpp",
- aceMode: "c_cpp"
- },
- {
- name: "CPP",
- mediaTypes: ["text/x-c++src", "text-x-c++hdr"],
- mode: "cpp",
- aceMode: "c_cpp"
- },
- {
- name: "C#",
- mediaTypes: ["text/x-csharp"],
- mode: "cs",
- aceMode: "csharp"
- },
- {
- name: "CSS",
- mediaTypes: ["text/x-css", "text/css"],
- mode: "css",
- aceMode: "css"
- },
- {
- name: "Coldfusion",
- mediaTypes: ["text/x-coldfusion"],
- aceMode: "coldfusion"
- },
- {
- name: "Curly",
- mediaTypes: ["text/x-curly"],
- aceMode: "curly"
- },
- {
- name: "D",
- mediaTypes: ["text/x-d"],
- mode: "d",
- aceMode: "d"
- },
- {
- name: "Dart",
- mediaTypes: ["text/x-dart"],
- aceMode: "dart"
- },
- {
- name: "Delphi",
- mediaTypes: ["text/x-pascal", "text/x-delphi"],
- mode: "delphi"
- },
- {
- name: "Diff",
- mediaTypes: ["text/x-diff"],
- mode: "diff",
- aceMode: "diff"
- },
- {
- name: "Django",
- mediaTypes: ["text/x-django"],
- mode: "django",
- aceMode: "django"
- },
- {
- name: "DOS BAT",
- mediaTypes: ["text/x-dosbat"],
- mode: "dos",
- aceMode: "batchfile"
- },
- {
- name: "Erlang",
- mediaTypes: ["text/x-erlang"],
- mode: "erlang",
- aceMode: "erlang"
- },
- {
- name: "F#",
- mediaTypes: ["text/x-fsharp"],
- mode: "fsharp"
- },
- {
- name: "Forth",
- mediaTypes: ["text/x-forth"],
- aceMode: "forth"
- },
- {
- name: "FTL",
- mediaTypes: ["text/x-ftl"],
- aceMode: "ftl"
- },
- {
- name: "GLSL",
- mediaTypes: ["text/x-glsl"],
- mode: "glsl",
- aceMode: "glsl"
- },
- {
- name: "Go",
- mediaTypes: ["text/x-go"],
- aceMode: "go"
- },
- {
- name: "Groovy",
- mediaTypes: ["text/x-groovy"],
- aceMode: "groovy"
- },
- {
- name: "HAML",
- mediaTypes: ["text/x-haml"],
- mode: "haml",
- aceMode: "haml"
- },
- {
- name: "Handlebars",
- mediaTypes: ["text/x-handlebars"],
- mode: "handlebars",
- aceMode: "handlebars"
- },
- {
- name: "Haskell",
- mediaTypes: ["text/x-haskell"],
- mode: "haskell",
- aceMode: "haskell"
- },
- {
- name: "HTTP Headers",
- mediaTypes: ["text/x-http-headers"],
- mode: "http"
- },
- {
- name: "HTML",
- mediaTypes: ["text/html"],
- mode: "xml",
- aceMode: "html"
- },
- {
- name: "INI",
- mediaTypes: ["text/x-ini", "text/x-properties"],
- mode: "ini",
- aceMode: "ini"
- },
- {
- name: "Jade",
- mediaTypes: ["text/x-jade"],
- aceMode: "jade"
- },
- {
- name: "Jack",
- mediaTypes: ["text/x-jack"],
- aceMode: "jack"
- },
- {
- name: "Java",
- mediaTypes: ["text/x-java", "text/x-java-source"],
- mode: "java",
- aceMode: "java"
- },
- {
- name: "JavaScript",
- mediaTypes: [
- "text/javascript",
- "text/x-javascript",
- "application/javascript",
- "application/x-javascript"
- ],
- mode: "javascript",
- aceMode: "javascript"
- },
- {
- name: "ECMAScript",
- mediaTypes: [ "text/x-ecmascript", "application/x-ecmascript" ],
- mode: "javascript",
- aceMode: "javascript"
- },
- {
- name: "TypeScript",
- mediaTypes: [ "text/typescript", "application/typescript", "application/x-typescript" ],
- mode: "javascript",
- aceMode: "typescript"
- },
- {
- name: "JSON",
- mediaTypes: [ "text/x-json", "application/x-json", "application/json" ],
- mode: "javascript",
- aceMode: "json"
- },
- {
- name: "JSP",
- mediaTypes: ["text/x-jsp"],
- aceMode: "jsp"
- },
- {
- name: "JSX",
- mediaTypes: ["text/x-jsx"],
- aceMode: "jsx"
- },
- {
- name: "Lasso",
- mediaTypes: [ "text/x-lasso" ],
- mode: "lasso"
- },
- {
- name: "LISP",
- mediaTypes: [ "text/x-common-lisp", "text/x-emacs-lisp"],
- mode: "lisp",
- aceMode: "lisp"
- },
- {
- name: "LiveCode Server and revIgniter",
- mediaTypes: [ "text/x-livecode-server"]
- , mode: "livecodeserver"
- },
- {
- name: "LUA",
- mediaTypes: ["text/x-lua"],
- mode: "lua",
- aceMode: "lua"
- },
- {
- name: "Makefile",
- mediaTypes: ["text/x-makefile"],
- mode: "makefile",
- aceMode: "makefile"
- },
- {
- name: "Markdown",
- mediaTypes: ["text/x-markdown", "text/x-web-markdown"],
- mode: "markdown",
- aceMode: "markdown"
- },
- {
- name: "Mathematica",
- mediaTypes: ["text/x-mathematica"],
- mode: "mathematica"
- },
- {
- name: "MatLab",
- mediaTypes: ["text/x-matlab"],
- mode: "matlab",
- aceMode: "matlab"
- },
- {
- name: "MEL",
- mediaTypes: ["text/x-mel"],
- mode: "mel"
- },
- {
- name: "Mizar",
- mediaTypes: ["text/x-mizar"],
- mode: "mizar"
- },
- {
- name: "Nginx",
- mediaTypes: ["text/x-nginx", "text/x-nginx-conf", "text/nginx"],
- mode: "nginx"
- },
- {
- name: "Objective C",
- mediaTypes: ["text/x-objcsrc"],
- mode: "objectivec",
- aceMode: "objectivec"
- },
- {
- name: "OCaml",
- mediaTypes: ["text/x-ocaml"],
- mode: "ocaml",
- aceMode: "ocaml"
- },
- {
- name: "Oxygene",
- mediaTypes: ["text/x-oxygene"],
- mode: "oxygene"
- },
- {
- name: "Pascal",
- mediaTypes: ["text/x-pascal"],
- aceMode: "pascal"
- },
- {
- name: "Parser3",
- mediaTypes: ["text/x-parser3"],
- mode: "parser3"
- },
- {
- name: "Perl",
- mediaTypes: ["text/x-perl"],
- mode: "perl",
- aceMode: "perl"
- },
- {
- name: "PHP",
- mediaTypes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"],
- mode: "php",
- aceMode: "php"
- },
- {
- name: "Python Profile",
- mediaTypes: ["text/x-profile"],
- mode: "profile"
- },
- {
- name: "Python",
- mediaTypes: ["text/x-python"],
- mode: "python",
- aceMode: "python"
- },
- {
- name: "Protocol buffer",
- mediaTypes: ["text/x-protobuf"],
- aceMode: "protobuf"
- },
- {
- name: "R",
- mediaTypes: ["text/x-rsrc"],
- mode: "r",
- aceMode: "r"
- },
- {
- name: "RIB",
- mediaTypes: ["text/x-rib"],
- mode: "rib"
- },
- {
- name: "RSL",
- mediaTypes: ["text/x-rsl"],
- mode: "rsl"
- },
- {
- name: "Ruby",
- mediaTypes: ["text/x-ruby"],
- mode: "ruby",
- aceMode: "ruby"
- },
- {
- name: "Oracle Rules Language",
- mediaTypes: ["text/x-rules-language"],
- mode: "ruleslanguage"
- },
- {
- name: "Rust",
- mediaTypes: ["text/x-rust"],
- mode: "rust",
- aceMode: "rust"
- },
- {
- name: "Scala",
- mediaTypes: ["text/x-scala"],
- mode: "scala",
- aceMode: "scala"
- },
- {
- name: "Scilab",
- mediaTypes: ["text/x-scilab"],
- mode: "scilab"
- },
- {
- name: "SASS",
- mediaTypes: ["text/x-sass"],
- aceMode: "sass"
- },
- {
- name: "SCSS",
- mediaTypes: ["text/x-scss"],
- mode: "scss"
- },
- {
- name: "SOY Templates",
- mediaTypes: ["text/x-soy"],
- mode: "soy_template"
- },
- {
- name: "Smalltalk",
- mediaTypes: ["text/x-smalltalk", "text/x-stsrc"],
- mode: "smalltalk"
- },
- {
- name: "SQL",
- mediaTypes: ["text/x-sql"],
- mode: "sql",
- aceMode: "sql"
- },
- {
- name: "SVG Image",
- mediaTypes: ["image/svg+xml"],
- aceMode: "svg"
- },
- {
- name: "TCL/TK",
- mediaTypes: ["text/x-tcl"],
- aceMode: "tcl"
- },
- {
- name: "TEX",
- mediaTypes: ["text/x-stex", "text/x-latex"],
- mode: "tex",
- aceMode: "tex"
- },
- {
- name: "Textile",
- mediaTypes: ["text/x-textile"],
- aceMode: "textile"
- },
- {
- name: "VALA",
- mediaTypes: ["text/x-vala"],
- mode: "vala"
- },
- {
- name: "VB.NET",
- mediaTypes: ["text/x-vbdotnet", "text/x-vb", "text/x-basic", "text/x-vbasic"],
- mode: "vbnet",
- aceMode: "vbscript"
- },
- {
- name: "VBScript",
- mediaTypes: ["text/x-vbscript"],
- mode: "vbscript",
- aceMode: "vbscript"
- },
- {
- name: "Velocity Template",
- mediaTypes: ["text/x-velocity"],
- aceMode: "velocity"
- },
- {
- name: "VHDL",
- mediaTypes: ["text/x-vhdl"],
- mode: "vhdl",
- aceMode: "vhdl"
- },
- {
- name: "XML",
- mediaTypes: ["text/xml", "application/xml"],
- mode: "xml",
- aceMode: "xml"
- },
- {
- name: "YAML",
- mediaTypes: ["text/x-yaml"],
- aceMode: "yaml"
- },
- {
- name: "XQuery",
- mediaTypes: ["text/x-xquery"],
- aceMode: "xquery"
- }
-]
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/BlobRenderer.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/BlobRenderer.java
deleted file mode 100644
index a6e9195c01..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/BlobRenderer.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.web.service.FileBlob;
-
-public interface BlobRenderer {
-
- Panel render(String componentId, IModel<FileBlob> blob);
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/BlobRendererFactory.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/BlobRendererFactory.java
deleted file mode 100644
index 15d7252aa2..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/BlobRendererFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import javax.inject.Singleton;
-
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.web.service.FileBlob;
-
-@Singleton
-public class BlobRendererFactory {
-
- private static enum Registry {
- TEXT(new TextBlobRenderer()),
- IMAGE(new ImageBlobRenderer()),
- RAW(new RawBlobRenderer());
-
- final BlobRenderer renderer;
- Registry(BlobRenderer renderer) {
- this.renderer = renderer;
- }
- }
-
- public BlobRenderer newRenderer(FileBlob blob) {
- if (MediaTypes.isSafeInline(blob.getMediaType())) {
- if (blob.isImage()) {
- return Registry.IMAGE.renderer;
- } else if (blob.isText() && !blob.isLarge()) {
- return Registry.TEXT.renderer;
- }
- }
-
- return Registry.RAW.renderer;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/FileBlobImage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/FileBlobImage.java
deleted file mode 100644
index ec9ed02168..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/FileBlobImage.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.html.image.NonCachingImage;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.service.FileBlob;
-
-public class FileBlobImage extends NonCachingImage {
- private static final long serialVersionUID = 1L;
-
- public static PageParameters paramsOf(FileBlob blob) {
- Long repositoryId = blob.getRepositoryId();
- Repository repository = GitPlex.getInstance(Dao.class).load(Repository.class, repositoryId);
-
- return RepositoryPage.paramsOf(repository, blob.getRevision(), blob.getFilePath());
- }
-
- public FileBlobImage(String id, Repository repository, String revision, String path) {
- this(id, RepositoryPage.paramsOf(repository, revision, path));
- }
-
- public FileBlobImage(String id, PageParameters params) {
- super(id, new ImageBlobResourceReference(), params);
- }
-
- @Override
- protected boolean getStatelessHint() {
- return true;
- }
-
- @Override
- protected void onComponentTag(final ComponentTag tag) {
- super.onComponentTag(tag);
-//
-// ResourceReference rr = getImageResourceReference();
-// if (rr != null) {
-// ImageBlobResourceReference brr = (ImageBlobResourceReference) rr;
-// Dimension d = ((ImageBlobResource) brr.getResource()).getImageDimension();
-// tag.put("width", d.width);
-// tag.put("height", d.height);
-// }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobPanel.html
deleted file mode 100644
index 7525422587..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobPanel.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="blob-image">
- <img wicket:id="image" />
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobPanel.java
deleted file mode 100644
index 538f0d571f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobPanel.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.web.service.FileBlob;
-
-@SuppressWarnings("serial")
-public class ImageBlobPanel extends Panel {
-
- public ImageBlobPanel(String id, IModel<FileBlob> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- FileBlob blob = getBlob();
- add(new FileBlobImage("image", FileBlobImage.paramsOf(blob)));
- }
-
- private FileBlob getBlob() {
- return (FileBlob) getDefaultModelObject();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobRenderer.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobRenderer.java
deleted file mode 100644
index 1430f4b69c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobRenderer.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.web.service.FileBlob;
-
-class ImageBlobRenderer implements BlobRenderer {
-
- @Override
- public Panel render(String componentId, IModel<FileBlob> blob) {
- return new ImageBlobPanel(componentId, blob);
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobResource.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobResource.java
deleted file mode 100644
index 2edd33c9be..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobResource.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import java.awt.Dimension;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.lang.ref.SoftReference;
-import java.util.Iterator;
-
-import javax.imageio.ImageIO;
-import javax.imageio.ImageReader;
-import javax.imageio.stream.ImageInputStream;
-import javax.imageio.stream.MemoryCacheImageInputStream;
-import javax.persistence.EntityNotFoundException;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.request.resource.DynamicImageResource;
-import org.apache.wicket.util.time.Time;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.base.Throwables;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Files;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.exception.AccessDeniedException;
-import com.pmease.gitplex.web.page.account.AccountPage;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.service.FileBlob;
-
-public class ImageBlobResource extends DynamicImageResource {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Transient image data so that image only needs to be generated once per VM
- */
- private transient SoftReference<byte[]> imageData;
-
- @Override
- protected byte[] getImageData(Attributes attributes) {
- // get image data is always called in sync block
- return getImageBytes(attributes.getParameters());
- }
-
- private synchronized byte[] getImageBytes(PageParameters params) {
- byte[] data = null;
- if (imageData != null) {
- data = imageData.get();
- }
-
- if (data == null) {
- data = internalGetImageData(params);
- imageData = new SoftReference<byte[]>(data);
- setLastModifiedTime(Time.now());
- }
-
- return data;
- }
-
- // private byte[] imageData;
- private synchronized byte[] internalGetImageData(PageParameters params) {
- final String username = params.get(AccountPage.PARAM_USER).toString();
- final String repositoryName = params.get(RepositoryPage.PARAM_REPO).toString();
- final String revision = params.get(RepositoryPage.PARAM_REVISION).toString();
- final String path = params.get(RepositoryPage.PARAM_PATH).toString();
-
- Repository repository = GitPlex.getInstance(RepositoryManager.class).findBy(
- username, repositoryName);
- if (repository == null) {
- throw new EntityNotFoundException("Repository " + username + "/"
- + repositoryName + " doesn't exist");
- }
-
- Preconditions.checkState(!Strings.isNullOrEmpty(revision));
-
- Preconditions.checkState(!Strings.isNullOrEmpty(path));
-
- if (!SecurityUtils.getSubject().isPermitted(
- Permission.ofRepositoryRead(repository))) {
- throw new AccessDeniedException("Permission denied to access "
- + repository.getFQN() + " for user "
- + SecurityUtils.getSubject());
- }
-
- FileBlob blob = FileBlob.of(repository, revision, path);
- return blob.getData();
- }
-
- public Dimension getImageDimension(PageParameters params) {
- String path = params.get(RepositoryPage.PARAM_PATH).toString();
-
- Preconditions.checkState(!Strings.isNullOrEmpty(path));
- byte[] data = getImageBytes(params);
-
- String suffix = Files.getFileExtension(path);
- Iterator<ImageReader> iter = ImageIO.getImageReadersBySuffix(suffix);
-
- if (iter.hasNext()) {
- ImageReader reader = iter.next();
- try (BufferedInputStream is = (BufferedInputStream) ByteSource.wrap(data).openBufferedStream()) {
-
- reader.setInput(data);
- ImageInputStream stream = new MemoryCacheImageInputStream(is);
- reader.setInput(stream);
- int width = reader.getWidth(reader.getMinIndex());
- int height = reader.getHeight(reader.getMinIndex());
-
- return new Dimension(width, height);
- } catch (IOException e) {
- throw Throwables.propagate(e);
- } finally {
- reader.dispose();
- }
- }
-
- throw new IllegalArgumentException("Invalid image " + path);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobResourceReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobResourceReference.java
deleted file mode 100644
index 959942a1d1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/ImageBlobResourceReference.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.request.resource.IResource;
-
-public class ImageBlobResourceReference extends RawBlobResourceReference {
-
- private static final long serialVersionUID = 1L;
-
- public ImageBlobResourceReference() {
- }
-
- @Override
- public IResource getResource() {
- return new ImageBlobResource();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobPanel.html
deleted file mode 100644
index 37bc3c820b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobPanel.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="blob-general">
- <a wicket:id="link">View Raw</a>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobPanel.java
deleted file mode 100644
index 1cf407a1ab..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobPanel.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.markup.html.link.ResourceLink;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.web.service.FileBlob;
-
-@SuppressWarnings("serial")
-public class RawBlobPanel extends Panel {
-
- public RawBlobPanel(String id, IModel<FileBlob> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- FileBlob blob = (FileBlob) getDefaultModelObject();
-
- add(new ResourceLink<Void>("link",
- new RawBlobResourceReference(),
- RawBlobResourceReference.paramsOf(blob)));
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobRenderer.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobRenderer.java
deleted file mode 100644
index 839781d660..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobRenderer.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.web.service.FileBlob;
-
-class RawBlobRenderer implements BlobRenderer {
-
- @Override
- public Panel render(String componentId, IModel<FileBlob> blob) {
- return new RawBlobPanel(componentId, blob);
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobResource.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobResource.java
deleted file mode 100644
index c9907d0482..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobResource.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import java.io.IOException;
-
-import javax.persistence.EntityNotFoundException;
-
-import org.apache.commons.io.FilenameUtils;
-import org.apache.shiro.SecurityUtils;
-import org.apache.tika.io.IOUtils;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.request.resource.AbstractResource;
-import org.apache.wicket.request.resource.ContentDisposition;
-import org.eclipse.jgit.lib.ObjectStream;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.base.Throwables;
-import com.google.common.io.ByteStreams;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.exception.AccessDeniedException;
-import com.pmease.gitplex.web.page.account.AccountPage;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.service.FileBlob;
-import com.pmease.gitplex.web.service.FileBlobService;
-
-public class RawBlobResource extends AbstractResource {
- private static final long serialVersionUID = 1L;
-
- public RawBlobResource() {
- }
-
- @Override
- protected ResourceResponse newResourceResponse(Attributes attributes) {
- PageParameters params = attributes.getParameters();
-
- final String username = params.get(AccountPage.PARAM_USER).toString();
- final String repositoryName = params.get(RepositoryPage.PARAM_REPO).toString();
- final String revision = params.get(RepositoryPage.PARAM_REVISION).toString();
- final String path = params.get(RepositoryPage.PARAM_PATH).toString();
-
- Preconditions.checkArgument(username != null);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(repositoryName));
- Preconditions.checkArgument(!Strings.isNullOrEmpty(revision));
- Preconditions.checkArgument(path != null);
-
- Repository repository = GitPlex.getInstance(RepositoryManager.class).findBy(username, repositoryName);
- if (repository == null) {
- throw new EntityNotFoundException("Repository " + username + "/" + repositoryName + " doesn't exist");
- }
-
- if (!SecurityUtils.getSubject().isPermitted(Permission.ofRepositoryRead(repository))) {
- throw new AccessDeniedException("User " + SecurityUtils.getSubject()
- + " have no permission to access repository "
- + repository.getFQN());
- }
-
- ResourceResponse response = new ResourceResponse();
-
- if (response.dataNeedsToBeWritten(attributes)) {
- FileBlob blob = FileBlob.of(repository, revision, path);
- response.setContentLength(blob.getSize());
- String fileName = FilenameUtils.getName(blob.getFilePath());
- response.setFileName(fileName);
- response.setContentType(blob.getMediaType().toString());
-
- if (MediaTypes.isSafeInline(blob.getMediaType())) {
- response.setContentDisposition(ContentDisposition.INLINE);
- } else {
- response.setContentDisposition(ContentDisposition.ATTACHMENT);
- }
-
- final Long repositoryId = repository.getId();
- response.setWriteCallback(new WriteCallback() {
- @Override
- public void writeData(final Attributes attributes) {
- Repository repository = GitPlex.getInstance(Dao.class).load(Repository.class, repositoryId);
- ObjectStream os = GitPlex.getInstance(FileBlobService.class).openStream(repository, revision, path);
- try {
- ByteStreams.copy(os, attributes.getResponse().getOutputStream());
- } catch (IOException e) {
- throw Throwables.propagate(e);
- } finally {
- IOUtils.closeQuietly(os);
- }
- }
- });
- }
-
- return response;
- }
-
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobResourceReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobResourceReference.java
deleted file mode 100644
index 0fe0e2251f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/RawBlobResourceReference.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.request.resource.IResource;
-import org.apache.wicket.request.resource.ResourceReference;
-
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.service.FileBlob;
-
-@SuppressWarnings("serial")
-public class RawBlobResourceReference extends ResourceReference {
-
- public static final String RAW_BLOB_RESOURCE = "gitplex-raw-blob";
-
- public static PageParameters paramsOf(FileBlob blob) {
- return RepositoryPage.paramsOf(blob.getRepository(), blob.getRevision(), blob.getFilePath());
- }
-
- public RawBlobResourceReference() {
- super(RAW_BLOB_RESOURCE);
- }
-
- @Override
- public IResource getResource() {
- return new RawBlobResource();
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobPanel.html
deleted file mode 100644
index 0a9adec991..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobPanel.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <table class="table-blob">
- <tr>
- <wicket:container wicket:id="prepend">
- </wicket:container>
- <td class="blob-lineno">
- <wicket:container wicket:id="lineno"></wicket:container>
- </td>
- <td class="blob-code">
- <div class="code-highlight">
- <pre><code wicket:id="code"></code></pre>
- </div>
- </td>
- </tr>
- </table>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobPanel.java
deleted file mode 100644
index 8f1c00c86e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobPanel.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.web.page.repository.code.blob.language.Language;
-import com.pmease.gitplex.web.page.repository.code.blob.language.Languages;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.highlighter.AceHighlighter;
-import com.pmease.gitplex.web.service.FileBlob;
-
-@SuppressWarnings("serial")
-public class TextBlobPanel extends Panel {
-
- public TextBlobPanel(String id, IModel<FileBlob> model) {
- super(id, model);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new Label("lineno", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- List<String> lines = getBlob().getLines();
- int size = lines.size();
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < size; i++) {
- int lineno = i + 1;
- sb.append("<a id='LL" + lineno + "'>")
- .append(lineno)
- .append("</a>").append("\n");
- }
- return sb.toString();
- }
-
- }).setEscapeModelStrings(false));
-
- IModel<String> textModel = new AbstractReadOnlyModel<String>() {
- @Override
- public String getObject() {
- if (getBlob().isEmpty()) {
- return "This file is empty";
- }
- return getBlob().getStringContent();
- }
- };
-
- Label code = new Label("code", textModel);
- code.setOutputMarkupId(true);
-
- IModel<String> cssModel = new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- Language lang = Languages.INSTANCE.findByMediaType(getBlob().getMediaType());
- StringBuffer sb = new StringBuffer();
- if (lang == null) {
- if (MediaTypes.isXML(getBlob().getMediaType())) {
- sb.append("xml lang-xml");
- } else {
- sb.append("no-highlight lang-text");
- }
- } else {
- sb.append(lang.getMode()).append(" ").append("lang-" + lang.getAceMode());
- }
-
- return sb.toString();
- }
- };
-
- code.add(AttributeAppender.append("class", cssModel));
- code.add(new AceHighlighter());
- add(code);
-
- add(createPrependColumn("prepend"));
- }
-
- protected Component createPrependColumn(String id) {
- return new WebMarkupContainer(id).setVisibilityAllowed(false);
- }
-
- protected FileBlob getBlob() {
- return (FileBlob) getDefaultModelObject();
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobRenderer.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobRenderer.java
deleted file mode 100644
index 53c9947922..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/TextBlobRenderer.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.web.service.FileBlob;
-
-class TextBlobRenderer implements BlobRenderer {
-
- @Override
- public Panel render(String componentId, IModel<FileBlob> blob) {
- return new TextBlobPanel(componentId, blob);
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/AceHighlighter.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/AceHighlighter.java
deleted file mode 100644
index 2dfa0c403c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/AceHighlighter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer.highlighter;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-
-import com.google.common.base.Strings;
-
-public class AceHighlighter extends Behavior {
- private static final long serialVersionUID = 1L;
-
- private IModel<Boolean> hasLineId = Model.of(Boolean.TRUE);
- private IModel<String> selector = Model.of("");
-
- public AceHighlighter() {
- }
-
- @Override
- public void bind(Component component) {
- super.bind(component);
- }
-
- @Override
- public void renderHead(Component component, IHeaderResponse response) {
- super.renderHead(component, response);
-
- response.render(JavaScriptHeaderItem.forReference(AceHighlighterReference.instance()));
- response.render(OnDomReadyHeaderItem.forScript(String.format(
- "SourceHighlighter.highlight('%s', %s)",
- Strings.isNullOrEmpty(selector.getObject()) ? "#" + component.getMarkupId(true) : selector.getObject(),
- String.valueOf(hasLineId.getObject()))));
- }
-
- public AceHighlighter hasLineId(boolean hasLineId) {
- this.hasLineId.setObject(hasLineId);
- return this;
- }
-
- public AceHighlighter withSelector(String selector) {
- this.selector.setObject(selector);
- return this;
- }
-
- @Override
- public void detach(Component component) {
- if (hasLineId != null) {
- hasLineId.detach();
- }
- if (selector != null) {
- selector.detach();
- }
- super.detach(component);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/AceHighlighterReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/AceHighlighterReference.java
deleted file mode 100644
index c8e07e5b4b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/AceHighlighterReference.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer.highlighter;
-
-import org.apache.wicket.markup.head.HeaderItem;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-@SuppressWarnings("serial")
-public class AceHighlighterReference extends JavaScriptResourceReference {
-
- private static final AceHighlighterReference instance = new AceHighlighterReference();
-
- public AceHighlighterReference() {
- super(AceHighlighterReference.class, "acehighlighter.js");
- }
-
- @Override
- public Iterable<? extends HeaderItem> getDependencies() {
- return Iterables.concat(super.getDependencies(),
- ImmutableList.of(
- JavaScriptHeaderItem.forUrl("assets/js/vendor/ace-noconflict/ace.js"),
- JavaScriptHeaderItem.forUrl("assets/js/vendor/ace-noconflict/ext-static_highlight.js")
- ));
- }
-
- public static AceHighlighterReference instance() {
- return instance;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/CodeMirrorSyntax.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/CodeMirrorSyntax.java
deleted file mode 100644
index 8ce0d2e465..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/CodeMirrorSyntax.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer.highlighter;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import org.apache.tika.mime.MimeType;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-/**
- * Language mappings to CodeMirror modes and mime types
- *
- */
-public enum CodeMirrorSyntax {
- APL("text/apl", "apl"),
- ASTERISK("text/x-asterisk", "asterisk"),
- C(new String[] {"text/x-csrc", "text/x-c", "text/x-chdr"}, "clike"),
- CPP(new String[] { "text/x-c++src", "text/x-c++hdr" }, "clike"),
- JAVA(new String[] { "text/x-java", "text/x-java-source" }, "clike"),
- CSHARP(new String[] { "text/x-csharp", "text/x-cs" }, "clike"),
- SCALA(new String[] { "text/x-scala" }, "clike"),
- VERTEX(new String[] { "x-shader/x-vertex", "x-shader/x-fragment"}, "clike"),
- CLOJURE ("text/x-clojure", "clojure"),
- COBOL("text/x-cobol", "cobol"),
- COFFEESCRIPT("text/x-coffeescript", "coffeescript"),
- COMMONLISP("text/x-common-lisp", "commonlisp"),
- CSS(new String[] {"text/css", "text/x-scss"}, "css"),
- D("text/x-d", "d"),
- DIFF("text/x-diff", "diff"),
- DTD("application/xml-dtd", "dtd"),
- ECL("text/x-ecl", "ecl"),
- EIFFEL("text/x-eiffel", "eiffel"),
- ERLANG("text/x-erlang", "erlang"),
- FORTRAN("text/x-fortran", "fortran"),
- GAS("text/x-gas", "gas"), // TODO
- GFM("text/x-gfmBase", "gfm"), // TODO
- GHERKIN("text/x-feature", "gherkin"),
- GO("text/x-go", "go"),
- GROOVY("text/x-groovy", "groovy"),
- HAML("text/x-haml", "haml"),
- HASKELL("text/x-haskell", "haskell"),
- HAXE("text/x-haxe", "haxe"),
- HTTP("message/http", "http"),
- JADE("text/x-jade", "jade"),
- JAVASCRIPT(new String[] {"text/javascript",
- "text/ecmascript",
- "application/javascript",
- "application/ecmascript",
- "text/typescript",
- "application/typescript"},
- "javascript"),
- JSON(new String[] {"application/json", "application/x-json"}, "javascript"),
- JINJA2("text/x-jinja2", "jinja2"), // XXX
- JULIA("text/x-julia", "julia"),
- LESS("text/x-less", "less"),
- LIVESCRIPT("text/x-livescript", "livescript"),
- LUA("text/x-lua", "lua"),
- MARKDOWN("text/x-markdown", "markdown"),
- MIRC("text/mirc", "mirc"),
- NGINX(new String[] {"text/nginx", "text/x-nginx-conf"}, "nginx"),
- NTRIPLES("text/n-triples", "ntriples"),
- OCAML("text/x-ocaml", "ocaml"),
- OCTAVE("text/x-octave", "octave"),
- PASCAL("text/x-pascal", "pascal"),
- PEGJS("text/x-pegjs", "pegjs"), // XXX
- PERL("text/x-perl", "perl"),
- PHP(new String[] { "application/x-httpd-php",
- "application/x-httpd-php-open",
- "text/x-php"},
- "php"),
- PIG("text/x-pig", "pig"),
- PROPERTIES(new String[] { "text/x-properties", "text/x-ini" }, "properties"),
- PYTHON(new String[] { "text/x-python", "text/x-cython"}, "python"),
- Q("text/x-q", "q"),
- R(new String[] {"text/x-r", "text/x-rsrc"}, "r"),
- RPM_CHANGE(new String[] {"text/x-rpm-changes"}, "changes", "rpm"),
- RPM_SPEC(new String[] {"text/x-rpm-spec"}, "spec", "rpm"),
- RST("text/x-rst", "rst"),
- RUBY("text/x-ruby", "ruby"),
- RUST("text/x-rustsrc", "rust"),
- SASS("text/x-sass", "sass"),
- SCHEME("text/x-scheme", "scheme"),
- SHELL("text/x-sh", "shell"),
- SIEVE("application/sieve", "sieve"),
- SMALLTALK("text/x-stsrc", "smalltalk"),
- SMARTY("text/x-smarty", "smarty"),
- SMARTYMIXED("text/x-smarty", "smartymixed"),
- SPARQL("application/x-sparql-query", "sparql"),
- SQL(new String[] { "text/x-sql",
- "text/x-mssql",
- "text/x-mysql",
- "text/x-mariadb",
- "text/x-cassandra",
- "text/x-plsql"},
- "sql"),
- STEX(new String[] {"text/x-stex", "text/x-latex"}, "stex"),
- TCL("text/x-tcl", "tcl"),
- TIDDLYWIKI("text/x-tiddlywiki", "tiddlywiki"),
- TIKI("text/tiki", "tiki"),
- TOML("text/x-toml", "toml"),
- TURTLE("text/turtle", "turtle"),
- VB("text/x-vb", "vb"),
- VBSCRIPT("text/vbscript", "vbscript"),
- VELOCITY("text/velocity", "velocity"),
- XML(new String[] { "text/xml", "application/xml"}, "xml"),
- XQUERY("application/xquery", "xquery"),
- YAML("text/x-yaml", "yaml"),
- Z80("text/x-z80", "z80"),
-
- HTMLMIXED(new String[] {"text/html"}, "htmlmixed", null,
- CodeMirrorSyntax.XML,
- CodeMirrorSyntax.CSS,
- CodeMirrorSyntax.JAVASCRIPT),
- HTMLEMBEDDED(new String[] {"application/x-ejs",
- "application/x-aspx",
- "application/x-jsp",
- "application/x-erb"},
- "htmlembedded",
- null,
- CodeMirrorSyntax.HTMLMIXED)
- ;
-
-
-
- private final String[] mimes;
- private final String mode;
- private final String group;
- private final CodeMirrorSyntax[] dependencies;
- private final JavaScriptResourceReference resourceReference;
-
- CodeMirrorSyntax(String[] mimes, String mode) {
- this(mimes, mode, null);
- }
-
- CodeMirrorSyntax(String mime, String mode) {
- this(new String[] {mime}, mode);
- }
-
- CodeMirrorSyntax(String[] mimes, String mode, String group, CodeMirrorSyntax... dependencies) {
- this.mimes = mimes;
- this.mode = mode;
- this.group = group;
- this.dependencies = dependencies;
-
- this.resourceReference = new JavaScriptResourceReference(CodeMirrorSyntax.class,
- "res/codemirror/mode/" + getJsFilePath());
- }
-
- public String[] getMimes() {
- return mimes;
- }
-
- public String getMode() {
- return mode == null ? name().toLowerCase() : mode;
- }
-
- public String getGroup() {
- return group;
- }
-
- // mapping to CodeMirror mode directory
- public String getJsFilePath() {
- StringBuffer sb = new StringBuffer();
- if (group != null) {
- sb.append(group).append("/");
- }
- sb.append(getMode()).append("/");
- sb.append(getMode()).append(".js");
- return sb.toString();
- }
-
- public CodeMirrorSyntax[] getDependencies() {
- if (dependencies == null || dependencies.length == 0) {
- return new CodeMirrorSyntax[0];
- }
-
- Set<CodeMirrorSyntax> list = Sets.newLinkedHashSet();
- for (CodeMirrorSyntax each : dependencies) {
- list.addAll(Lists.newArrayList(each.getDependencies()));
- list.add(each);
- }
-
- return Iterables.toArray(list, CodeMirrorSyntax.class);
- }
-
- public JavaScriptResourceReference getResourceReference() {
- return resourceReference;
- }
-
-
-
- static Set<String> modes;
- static Map<String, CodeMirrorSyntax> mimeSyntaxMap;
-
- static {
- Set<String> set = Sets.newHashSet();
- Map<String, CodeMirrorSyntax> map = Maps.newHashMap();
- for (CodeMirrorSyntax each : CodeMirrorSyntax.values()) {
- set.add(each.getMode());
- for (String mime : each.mimes) {
- map.put(mime, each);
- }
- }
-
- modes = ImmutableSet.<String>copyOf(set);
- mimeSyntaxMap = ImmutableMap.<String, CodeMirrorSyntax>copyOf(map);
- }
-
- public static Set<String> getAllModes() {
- return modes;
- }
-
- public static @Nullable CodeMirrorSyntax findByMime(String mime) {
- return mimeSyntaxMap.get(mime);
- }
-
- public static @Nullable CodeMirrorSyntax findByMime(MimeType mime) {
- return findByMime(mime.getType().toString());
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/HighlightJsHighlighter.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/HighlightJsHighlighter.java
deleted file mode 100644
index d0a3ceb2f5..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/HighlightJsHighlighter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer.highlighter;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptReferenceHeaderItem;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-
-public class HighlightJsHighlighter extends Behavior {
- private static final long serialVersionUID = 1L;
-
- public HighlightJsHighlighter() {
- }
-
- @Override
- public void bind(Component component) {
- }
-
- @Override
- public void renderHead(Component component, IHeaderResponse response) {
- super.renderHead(component, response);
- response.render(JavaScriptReferenceHeaderItem.forReference(HighlightJsResourceReference.getInstance()));
- response.render(OnDomReadyHeaderItem.forScript(
- String.format("SourceHighLight.highlight($('#%s'));\n",
- component.getMarkupId(true))));
- }
-
- @Override
- public void detach(Component component) {
- super.detach(component);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/HighlightJsResourceReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/HighlightJsResourceReference.java
deleted file mode 100644
index cfdb6c458b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/HighlightJsResourceReference.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.blob.renderer.highlighter;
-
-import org.apache.wicket.markup.head.CssHeaderItem;
-import org.apache.wicket.markup.head.HeaderItem;
-import org.apache.wicket.request.resource.CssResourceReference;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class HighlightJsResourceReference extends JavaScriptResourceReference {
- private static final long serialVersionUID = 1L;
-
- public HighlightJsResourceReference() {
- super(HighlightJsResourceReference.class, "res/highlight/highlight.pack.js");
- }
-
-// private static final ResourceReference HIGHLIGHT_JS = new JavaScriptResourceReference(HighlightJsHighlighter.class, );
- private static final ResourceReference HIGHLIGHT_CSS = new CssResourceReference(HighlightJsHighlighter.class, "res/highlight/styles/textmate.css");
-
- @Override
- public Iterable<? extends HeaderItem> getDependencies() {
- return Iterables.concat(super.getDependencies(),
- ImmutableList.of(
-// (HeaderItem) JavaScriptHeaderItem.forReference(HIGHLIGHT_JS),
- (HeaderItem) CssHeaderItem.forReference(HIGHLIGHT_CSS)));
- }
-
- private static final JavaScriptResourceReference instance =
- new HighlightJsResourceReference();
-
- public static JavaScriptResourceReference getInstance() {
- return instance;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/acehighlighter.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/acehighlighter.js
deleted file mode 100644
index 33d287f18b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/acehighlighter.js
+++ /dev/null
@@ -1,35 +0,0 @@
-var SourceHighlighter = SourceHighlighter || {};
-
-SourceHighlighter.highlight = function(element, hasLineId) {
- var highlighter = ace.require("ace/ext/static_highlight");
- var dom = ace.require("ace/lib/dom")
- function qsa(sel) {
- return [].slice.call(document.querySelectorAll(sel));
- }
-
- qsa(element).forEach(function(el) {
- var m = el.className.match(/lang-(\w+)|(text)/);
- //if (!m) return
- //var mode = "ace/mode/" + (m[1] || m[2]);
- highlighter.highlight(el, {mode: "ace/mode/java", theme: "ace/theme/xcode", hasLineId: hasLineId});
- });
-
- $(function() {
- //This emulates a click on the correct button on page load
- if(document.location.hash){
- var lineNo = document.location.hash.substr(2);
- $("#LC" + lineNo).addClass("selected");
- }
-
- //Click a button to change the hash
- $(".blob-lineno a").click(function(){
- var oldLineNo = document.location.hash.substr(2);
- $("#LC" + oldLineNo).removeClass('selected');
- var currentLineNo = $(this).attr("id").substr("LL".length);
- $("#LC" + currentLineNo).addClass("selected");
- document.location.hash="L"+currentLineNo;
- //return false;
- });
- });
-};
-
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/highlightjs-highlighter.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/highlightjs-highlighter.js
deleted file mode 100644
index 1a5af5a472..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/highlightjs-highlighter.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var SourceHighLight = SourceHighLight || {};
-
-SourceHighLight.highlight = function($el) {
- hljs.highlightBlock($el[0], ' ', false)
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/LICENSE b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/LICENSE
deleted file mode 100644
index 422deb7350..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2006, Ivan Sagalaev
-All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of highlight.js nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/README.md b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/README.md
deleted file mode 100644
index 82a5d1f066..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/README.md
+++ /dev/null
@@ -1,167 +0,0 @@
-# Highlight.js
-
-Highlight.js highlights syntax in code examples on blogs, forums and,
-in fact, on any web page. It's very easy to use because it works
-automatically: finds blocks of code, detects a language, highlights it.
-
-Autodetection can be fine tuned when it fails by itself (see "Heuristics").
-
-
-## Basic usage
-
-Link the library and a stylesheet from your page and hook highlighting to
-the page load event:
-
-```html
-<link rel="stylesheet" href="styles/default.css">
-<script src="highlight.pack.js"></script>
-<script>hljs.initHighlightingOnLoad();</script>
-```
-
-This will highlight all code on the page marked up as `<pre><code> .. </code></pre>`.
-If you use different markup or need to apply highlighting dynamically, read
-"Custom initialization" below.
-
-- You can download your own customized version of "highlight.pack.js" or
- use the hosted one as described on the download page:
- <http://highlightjs.org/download/>
-
-- Style themes are available in the download package or as hosted files.
- To create a custom style for your site see the class reference in the file
- [classref.txt][cr] from the downloaded package.
-
-[cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt
-
-
-## node.js
-
-Highlight.js can be used under node.js. The package with all supported languages is
-installable from NPM:
-
- npm install highlight.js
-
-Alternatively, you can build it from the source with only languages you need:
-
- python3 tools/build.py -tnode lang1 lang2 ..
-
-Using the library:
-
-```javascript
-var hljs = require('highlight.js');
-
-// If you know the language
-hljs.highlight(lang, code).value;
-
-// Automatic language detection
-hljs.highlightAuto(code).value;
-```
-
-
-## AMD
-
-Highlight.js can be used with an AMD loader. You will need to build it from
-source in order to do so:
-
-```bash
-$ python3 tools/build.py -tamd lang1 lang2 ..
-```
-
-Which will generate a `build/highlight.pack.js` which will load as an AMD
-module with support for the built languages and can be used like so:
-
-```javascript
-require(["highlight.js/build/highlight.pack"], function(hljs){
-
- // If you know the language
- hljs.highlight(lang, code).value;
-
- // Automatic language detection
- hljs.highlightAuto(code).value;
-});
-```
-
-
-## Tab replacement
-
-You can replace TAB ('\x09') characters used for indentation in your code
-with some fixed number of spaces or with a `<span>` to give them special
-styling:
-
-```html
-<script type="text/javascript">
- hljs.tabReplace = ' '; // 4 spaces
- // ... or
- hljs.tabReplace = '<span class="indent">\t</span>';
-
- hljs.initHighlightingOnLoad();
-</script>
-```
-
-## Custom initialization
-
-If you use different markup for code blocks you can initialize them manually
-with `highlightBlock(code, tabReplace, useBR)` function. It takes a DOM element
-containing the code to highlight and optionally a string with which to replace
-TAB characters.
-
-Initialization using, for example, jQuery might look like this:
-
-```javascript
-$(document).ready(function() {
- $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
-});
-```
-
-You can use `highlightBlock` to highlight blocks dynamically inserted into
-the page. Just make sure you don't do it twice for already highlighted
-blocks.
-
-If your code container relies on `<br>` tags instead of line breaks (i.e. if
-it's not `<pre>`) pass `true` into the third parameter of `highlightBlock`
-to make highlight.js use `<br>` in the output:
-
-```javascript
-$('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)});
-```
-
-
-## Heuristics
-
-Autodetection of a code's language is done using a simple heuristic:
-the program tries to highlight a fragment with all available languages and
-counts all syntactic structures that it finds along the way. The language
-with greatest count wins.
-
-This means that in short fragments the probability of an error is high
-(and it really happens sometimes). In this cases you can set the fragment's
-language explicitly by assigning a class to the `<code>` element:
-
-```html
-<pre><code class="html">...</code></pre>
-```
-
-You can use class names recommended in HTML5: "language-html",
-"language-php". Classes also can be assigned to the `<pre>` element.
-
-To disable highlighting of a fragment altogether use "no-highlight" class:
-
-```html
-<pre><code class="no-highlight">...</code></pre>
-```
-
-
-## Export
-
-File export.html contains a little program that allows you to paste in a code
-snippet and then copy and paste the resulting HTML code generated by the
-highlighter. This is useful in situations when you can't use the script itself
-on a site.
-
-
-## Meta
-
-- Version: 7.5
-- URL: http://highlightjs.org/
-
-For the license terms see LICENSE files.
-For authors and contributors see AUTHORS.en.txt file.
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/README.ru.md b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/README.ru.md
deleted file mode 100644
index c87b3b3852..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/README.ru.md
+++ /dev/null
@@ -1,172 +0,0 @@
-# Highlight.js
-
-Highlight.js нужен для подсветки синтаксиса в примерах кода в блогах,
-форумах и вообще на любых веб-страницах. Пользоваться им очень просто,
-потому что работает он автоматически: сам находит блоки кода, сам
-определяет язык, сам подсвечивает.
-
-Автоопределением языка можно управлять, когда оно не справляется само (см.
-дальше "Эвристика").
-
-
-## Простое использование
-
-Подключите библиотеку и стиль на страницу и повесть вызов подсветки на
-загрузку страницы:
-
-```html
-<link rel="stylesheet" href="styles/default.css">
-<script src="highlight.pack.js"></script>
-<script>hljs.initHighlightingOnLoad();</script>
-```
-
-Весь код на странице, обрамлённый в теги `<pre><code> .. </code></pre>`
-будет автоматически подсвечен. Если вы используете другие теги или хотите
-подсвечивать блоки кода динамически, читайте "Инициализацию вручную" ниже.
-
-- Вы можете скачать собственную версию "highlight.pack.js" или сослаться
- на захостенный файл, как описано на странице загрузки:
- <http://highlightjs.org/download/>
-
-- Стилевые темы можно найти в загруженном архиве или также использовать
- захостенные. Чтобы сделать собственный стиль для своего сайта, вам
- будет полезен справочник классов в файле [classref.txt][cr], который тоже
- есть в архиве.
-
-[cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt
-
-
-## node.js
-
-Highlight.js можно использовать в node.js. Библиотеку со всеми возможными языками можно
-установить с NPM:
-
- npm install highlight.js
-
-Также её можно собрать из исходников с только теми языками, которые нужны:
-
- python3 tools/build.py -tnode lang1 lang2 ..
-
-Использование библиотеки:
-
-```javascript
-var hljs = require('highlight.js');
-
-// Если вы знаете язык
-hljs.highlight(lang, code).value;
-
-// Автоопределение языка
-hljs.highlightAuto(code).value;
-```
-
-
-## AMD
-
-Highlight.js можно использовать с загрузчиком AMD-модулей. Для этого его
-нужно собрать из исходников следующей командой:
-
-```bash
-$ python3 tools/build.py -tamd lang1 lang2 ..
-```
-
-Она создаст файл `build/highlight.pack.js`, который является загружаемым
-AMD-модулем и содержит все выбранные при сборке языки. Используется он так:
-
-```javascript
-require(["highlight.js/build/highlight.pack"], function(hljs){
-
- // Если вы знаете язык
- hljs.highlight(lang, code).value;
-
- // Автоопределение языка
- hljs.highlightAuto(code).value;
-});
-```
-
-
-## Замена TABов
-
-Также вы можете заменить символы TAB ('\x09'), используемые для отступов, на
-фиксированное количество пробелов или на отдельный `<span>`, чтобы задать ему
-какой-нибудь специальный стиль:
-
-```html
-<script type="text/javascript">
- hljs.tabReplace = ' '; // 4 spaces
- // ... or
- hljs.tabReplace = '<span class="indent">\t</span>';
-
- hljs.initHighlightingOnLoad();
-</script>
-```
-
-
-## Инициализация вручную
-
-Если вы используете другие теги для блоков кода, вы можете инициализировать их
-явно с помощью функции `highlightBlock(code, tabReplace, useBR)`. Она принимает
-DOM-элемент с текстом расцвечиваемого кода и опционально - строчку для замены
-символов TAB.
-
-Например с использованием jQuery код инициализации может выглядеть так:
-
-```javascript
-$(document).ready(function() {
- $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
-});
-```
-
-`highlightBlock` можно также использовать, чтобы подсветить блоки кода,
-добавленные на страницу динамически. Только убедитесь, что вы не делаете этого
-повторно для уже раскрашенных блоков.
-
-Если ваш блок кода использует `<br>` вместо переводов строки (т.е. если это не
-`<pre>`), передайте `true` третьим параметром в `highlightBlock`:
-
-```javascript
-$('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)});
-```
-
-
-## Эвристика
-
-Определение языка, на котором написан фрагмент, делается с помощью
-довольно простой эвристики: программа пытается расцветить фрагмент всеми
-языками подряд, и для каждого языка считает количество подошедших
-синтаксически конструкций и ключевых слов. Для какого языка нашлось больше,
-тот и выбирается.
-
-Это означает, что в коротких фрагментах высока вероятность ошибки, что
-периодически и случается. Чтобы указать язык фрагмента явно, надо написать
-его название в виде класса к элементу `<code>`:
-
-```html
-<pre><code class="html">...</code></pre>
-```
-
-Можно использовать рекомендованные в HTML5 названия классов:
-"language-html", "language-php". Также можно назначать классы на элемент
-`<pre>`.
-
-Чтобы запретить расцветку фрагмента вообще, используется класс "no-highlight":
-
-```html
-<pre><code class="no-highlight">...</code></pre>
-```
-
-
-## Экспорт
-
-В файле export.html находится небольшая программка, которая показывает и дает
-скопировать непосредственно HTML-код подсветки для любого заданного фрагмента кода.
-Это может понадобится например на сайте, на котором нельзя подключить сам скрипт
-highlight.js.
-
-
-## Координаты
-
-- Версия: 7.5
-- URL: http://highlightjs.org/
-
-Лицензионное соглашение читайте в файле LICENSE.
-Список авторов и соавторов читайте в файле AUTHORS.ru.txt
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/classref.txt b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/classref.txt
deleted file mode 100644
index 8113987d94..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/classref.txt
+++ /dev/null
@@ -1,733 +0,0 @@
-This is a full list of available classes corresponding to languages'
-syntactic structures. The parentheses after language name contain identifiers
-used as class names in `<code>` element.
-
-Python ("python"):
-
- keyword keyword
- built_in built-in objects (None, False, True and Ellipsis)
- number number
- string string (of any type)
- comment comment
- decorator @-decorator for functions
- function function header "def some_name(...):"
- class class header "class SomeName(...):"
- title name of a function or a class inside a header
- params everything inside parentheses in a function's or class' header
-
-Python profiler results ("profile"):
-
- number number
- string string
- built_in built-in function entry
- filename filename in an entry
- summary profiling summary
- header header of table of results
- keyword column header
- function function name in an entry (including parentheses)
- title actual name of a function in an entry (excluding parentheses)
- prompt interpreter prompt (>>> or ...)
-
-Ruby ("ruby"):
-
- keyword keyword
- string string
- subst in-string substitution (#{...})
- comment comment
- yardoctag YARD tag
- function function header "def some_name(...):"
- class class header "class SomeName(...):"
- title name of a function or a class inside a header
- parent name of a parent class
- symbol symbol
-
-Haml ("haml"):
-
- tag any tag starting with "%"
- title tag's name
- attribute tag's attribute
- keyword tag's attribute that is a keyword
- string attribute's value that is a string
- value attribute's value, shorthand id or class for tag
- comment comment
- doctype !!! declaration
- bullet line defined by variable
-
-Perl ("perl"):
-
- keyword keyword
- comment comment
- number number
- string string
- regexp regular expression
- sub subroutine header (from "sub" till "{")
- variable variable starting with "$", "%", "@"
- operator operator
- pod plain old doc
-
-PHP ("php"):
-
- keyword keyword
- number number
- string string (of any type)
- comment comment
- phpdoc phpdoc params in comments
- variable variable starting with "$"
- preprocessor preprocessor marks: "<?php" and "?>"
-
-Scala ("scala"):
-
- keyword keyword
- number number
- string string
- comment comment
- annotation annotation
- javadoc javadoc comment
- javadoctag @-tag in javadoc
- class class header
- title class name inside a header
- params everything in parentheses inside a class header
- inheritance keywords "extends" and "with" inside class header
-
-Go ("go"):
-
- comment comment
- string string constant
- number number
- keyword language keywords
- constant true false nil iota
- typename built-in plain types (int, string etc.)
- built_in built-in functions
-
-HTML, XML ("xml"):
-
- tag any tag from "<" till ">"
- attribute tag's attribute with or without value
- value attribute's value
- comment comment
- pi processing instruction (<? ... ?>)
- doctype <!DOCTYPE ... > declaration
- cdata CDATA section
-
-Lasso ("lasso"):
-
- preprocessor delimiters and interpreter flags
- shebang Lasso 9 shell script header
- comment single- or multi-line comment
- javadoc doc comment
- keyword keyword
- literal keyword representing a value
- built_in built-in types and variables
- number number
- string string
- variable variable reference starting with "#" or "$"
- tag tag literal
- attribute named or rest parameter in method signature
- class type, trait, or method header
- title name following "define" inside a header
-
-CSS ("css"):
-
- tag tag in selectors
- id #some_name in selectors
- class .some_name in selectors
- at_rule @-rule till first "{" or ";"
- attr_selector attribute selector (square brackets in a[href^=http://])
- pseudo pseudo classes and elemens (:after, ::after etc.)
- comment comment
- rules everything from "{" till "}"
- attribute property name inside a rule
- value property value inside a rule, from ":" till ";" or
- till the end of rule block
- number number within a value
- string string within a value
- hexcolor hex color (#FFFFFF) within a value
- function CSS function within a value
- important "!important" symbol
-
-SCSS ("scss"):
-
- tag tag in selectors
- id #some_name in selectors
- class .some_name in selectors
- at_rule @-rule till first "{" or ";"
- attr_selector attribute selector (square brackets in a[href^=http://])
- pseudo pseudo classes and elemens (:after, ::after etc.)
- comment comment
- rules everything from "{" till "}"
- attribute property name inside a rule
- value property value inside a rule, from ":" till ";" or
- till the end of rule block
- number number within a value
- string string within a value
- hexcolor hex color (#FFFFFF) within a value
- function CSS function within a value
- important "!important" symbol
- variable variable starting with "$"
- preprocessor keywords after @
-
-Markdown ("markdown"):
-
- header header
- bullet list bullet
- emphasis emphasis
- strong strong emphasis
- blockquote blockquote
- code code
- horizontal_rule horizontal rule
- link_label link label
- link_url link url
-
-AsciiDoc ("asciidoc"):
-
- header heading
- bullet list or labeled bullet
- emphasis emphasis
- strong strong emphasis
- blockquote blockquote
- code inline or block code
- horizontal_rule horizontal rule
- link_label link or image label
- link_url link or image url
- comment comment
- attribute document attribute, block attributes
- label admonition label
-
-Django ("django"):
-
- keyword HTML tag in HTML, default tags and default filters in templates
- tag any tag from "<" till ">"
- comment comment
- doctype <!DOCTYPE ... > declaration
- attribute tag's attribute with or withou value
- value attribute's value
- template_tag template tag {% .. %}
- variable template variable {{ .. }}
- template_comment template comment, both {# .. #} and {% comment %}
- filter filter from "|" till the next filter or the end of tag
- argument filter argument
-
-Handlebars ("handlebars"):
-
- expression expression to be evaluated
- variable variable
- begin-block the beginning of a block
- end-block the ending of a block
- string string
-
-JSON ("json"):
-
- number number
- literal "true", "false" and "null"
- string string value
- attribute name of an object property
- value value of an object property
-
-JavaScript ("javascript"):
-
- keyword keyword
- comment comment
- number number
- literal special literal: "true", "false" and "null"
- string string
- regexp regular expression
- function header of a function
- title name of a function inside a header
- params parentheses and everything inside them in a function's header
-
-CoffeeScript ("coffeescript"):
-
- keyword keyword
- comment comment
- number number
- literal special literal: "true", "false" and "null"
- built_in built-in objects and functions ("window", "console", "require", etc...)
- string string
- subst #{ ... } interpolation in double-quoted strings
- regexp regular expression
- function header of a function
- class header of a class
- title name of a function variable inside a header
- params parentheses and everything inside them in a function's header
- property @-property within class and functions
-
-ActionScript ("actionscript"):
-
- comment comment
- string string
- number number
- keyword keywords
- literal literal
- reserved reserved keyword
- title name of declaration (package, class or function)
- preprocessor preprocessor directive (import, include)
- type type of returned value (for functions)
- package package (named or not)
- class class/interface
- function function
- param params of function
- rest_arg rest argument of function
-
-VBScript ("vbscript"):
-
- keyword keyword
- number number
- string string
- comment comment
- built_in built-in function
-
-VB.Net ("vbnet"):
-
- keyword keyword
- built_in built-in types
- literal "true", "false" and "nothing"
- string string
- comment comment
- xmlDocTag xmldoc tag ("'''", "<!--", "-->", "<..>")
- preprocessor preprocessor directive
-
-HTTP ("http"):
-
- request first line of a request
- status first line of a response
- attribute header name
- string header value or query string in a request line
- number status code
-
-Lua ("lua"):
-
- keyword keyword
- number number
- string string
- comment comment
- built_in built-in operator
- function header of a function
- title name of a function inside a header
- params everything inside parentheses in a function's header
- long_brackets multiline string in [=[ .. ]=]
-
-Delphi ("delphi"):
-
- keyword keyword
- comment comment (of any type)
- number number
- string string
- function header of a function, procedure, constructor and destructor
- title name of a function, procedure, constructor or destructor
- inside a header
- params everything inside parentheses in a function's header
- class class' body from "= class" till "end;"
-
-Java ("java"):
-
- keyword keyword
- number number
- string string
- comment commment
- annotaion annotation
- javadoc javadoc comment
- class class header from "class" till "{"
- title class name inside a header
- params everything in parentheses inside a class header
- inheritance keywords "extends" and "implements" inside class header
-
-C++ ("cpp"):
-
- keyword keyword
- number number
- string string and character
- comment comment
- preprocessor preprocessor directive
- stl_container instantiation of STL containers ("vector<...>")
-
-Objective C ("objectivec"):
-
- keyword keyword
- built_in Cocoa/Cocoa Touch constants and classes
- number number
- string string
- comment comment
- preprocessor preprocessor directive
- class interface/implementation, protocol and forward class declaration
- variable properties and struct accesors
-
-Vala ("vala"):
-
- keyword keyword
- number number
- string string
- comment comment
- class class definitions
- title in class definition
- constant ALL_UPPER_CASE
-
-C# ("cs"):
-
- keyword keyword
- number number
- string string
- comment commment
- xmlDocTag xmldoc tag ("///", "<!--", "-->", "<..>")
-
-F# ("fsharp"):
-
- keywords keyword
- number number
- string string
- commment comment
- class any custom F# type
- title the name of a custom F# type
- annotation any attribute
-
-OCaml ("ocaml"):
- keywords keyword
- number number
- string string
- commment comment
- class any custom OCaml type
- title the name of a custom OCaml type
- annotation any attribute
-
-D ("d"):
-
- comment comment
- string string constant
- number number
- keyword language keywords (including @attributes)
- constant true false null
- built_in built-in plain types (int, string etc.)
-
-RenderMan RSL ("rsl"):
-
- keyword keyword
- number number
- string string (including @"..")
- comment comment
- preprocessor preprocessor directive
- shader sahder keywords
- shading shading keywords
- built_in built-in function
-
-RenderMan RIB ("rib"):
-
- keyword keyword
- number number
- string string
- comment comment
- commands command
-
-Maya Embedded Language ("mel"):
-
- keyword keyword
- number number
- string string
- comment comment
- variable variable
-
-SQL ("sql"):
-
- keyword keyword (mostly SQL'92 and SQL'99)
- number number
- string string (of any type: "..", '..', `..`)
- comment comment
- aggregate aggregate function
-
-Smalltalk ("smalltalk"):
-
- keyword keyword
- number number
- string string
- comment commment
- symbol symbol
- array array
- class name of a class
- char char
- localvars block of local variables
-
-Lisp ("lisp"):
-
- keyword keyword
- number number
- string string
- comment commment
- variable variable
- literal b, t and nil
- list non-quoted list
- title first symbol in a non-quoted list
- body remainder of the non-quoted list
- quoted quoted list, both "(quote .. )" and "'(..)"
-
-Clojure ("clojure"):
-
- comment comments and hints
- string string
- number number
- collection collections
- attribute :keyword
- title function name (built-in or user defined)
- built_in built-in function name
-
-Ini ("ini"):
-
- title title of a section
- value value of a setting of any type
- string string
- number number
- keyword boolean value keyword
-
-Apache ("apache"):
-
- keyword keyword
- number number
- comment commment
- literal On and Off
- sqbracket variables in rewrites "%{..}"
- cbracket options in rewrites "[..]"
- tag begin and end of a configuration section
-
-Nginx ("nginx"):
-
- title directive title
- string string
- number number
- comment comment
- built_in built-in constant
- variable $-variable
- regexp regexp
-
-Diff ("diff"):
-
- header file header
- chunk chunk header within a file
- addition added lines
- deletion deleted lines
- change changed lines
-
-DOS ("dos"):
-
- keyword keyword
- flow batch control keyword
- stream DOS special files ("con", "prn", ...)
- winutils some commands (see dos.js specifically)
- envvar environment variables
-
-Bash ("bash"):
-
- keyword keyword
- string string
- number number
- comment comment
- literal special literal: "true" и "false"
- variable variable
- shebang script interpreter header
-
-Makefile ("makefile"):
-
- keyword keyword ".PHONY" within the phony line
- string string
- comment comment
- variable $(..) variable
- title target title
- constant constant within the initial definition
-
-CMake ("cmake"):
-
- keyword keyword
- number number
- string string
- comment commment
- envvar $-variable
- operator operator (LESS, STREQUAL, MATCHES, etc)
-
-Axapta ("axapta"):
-
- keyword keyword
- number number
- string string
- comment commment
- class class header from "class" till "{"
- title class name inside a header
- params everything in parentheses inside a class header
- inheritance keywords "extends" and "implements" inside class header
- preprocessor preprocessor directive
-
-Oracle Rules Language ("ruleslanguage"):
-
- comment comment
- string string constant
- number number
- keyword language keywords
- built_in built-in functions
- array array stem
-
-1C ("1c"):
-
- keyword keyword
- number number
- date date
- string string
- comment commment
- function header of function or procudure
- title function name inside a header
- params everything in parentheses inside a function header
- preprocessor preprocessor directive
-
-AVR assembler ("avrasm"):
-
- keyword keyword
- built_in pre-defined register
- number number
- string string
- comment commment
- label label
- preprocessor preprocessor directive
- localvars substitution in .macro
-
-VHDL ("vhdl"):
-
- keyword keyword
- number number
- string string
- comment commment
- literal signal logical value
- typename typename
- attribute signal attribute
-
-Parser3 ("parser3"):
-
- keyword keyword
- number number
- comment commment
- variable variable starting with "$"
- preprocessor preprocessor directive
- title user-defined name starting with "@"
-
-LiveCode Server ("livecodeserver"):
-
- variable variable starting with "g", "t", "p", "s", "$_"
- string string
- comment comment
- number number
- title name of a command or a function
- keyword keyword
- constant constant
- operator operator
- built_in built_in functions and commands
- function header of a function
- command header of a command
- preprocessor preprocessor marks: "<?", "<?rev", "<?lc", "<?livecode" and "?>"
-
-TeX ("tex"):
-
- comment comment
- number number
- command command
- parameter parameter
- formula formula
- special special symbol
-
-Haskell ("haskell"):
-
- comment comment
- pragma GHC pragma
- preprocessor CPP preprocessor directive
- keyword keyword
- number number
- string string
- title function or variable name
- type value, type or type class constructor name (i.e. capitalized)
- container (..., ...) or {...; ...} list in declaration or record
- module module declaration
- import import declaration
- class type class or instance declaration
- typedef type declaration (type, newtype, data)
- default default declaration
- infix infix declaration
- foreign FFI declaration
- shebang shebang line
-
-Erlang ("erlang"):
-
- comment comment
- string string
- number number
- keyword keyword
- record_name record access (#record_name)
- title name of declaration function
- variable variable (starts with capital letter or with _)
- pp.keywords module's attribute (-attribute)
- function_name atom or atom:atom in case of function call
-
-Rust ("rust"):
-
- comment comment
- string string
- number number
- keyword keyword
- title name of declaration
- preprocessor preprocessor directive
-
-Matlab ("matlab"):
-
- comment comment
- string string
- number number
- keyword keyword
- title function name
- function function
- param params of function
- matrix matrix in [ .. ]
- cell cell in { .. }
-
-Scilab ("scilab"):
-
- comment comment
- string string
- number number
- keyword keyword
- title function name
- function function
- param params of function
- matrix matrix in [ .. ]
-
-R ("r"):
-
- comment comment
- string string constant
- number number
- keyword language keywords (function, if) plus "structural"
- functions (attach, require, setClass)
- literal special literal: TRUE, FALSE, NULL, NA, etc.
-
-OpenGL Shading Language ("glsl"):
-
- comment comment
- number number
- preprocessor preprocessor directive
- keyword keyword
- built_in GLSL built-in functions and variables
- literal true false
-
-AppleScript ("applescript"):
-
- keyword keyword
- command core AppleScript command
- constant AppleScript built in constant
- type AppleScript variable type (integer, etc.)
- property Applescript built in property (length, etc.)
- number number
- string string
- comment comment
- title name of a handler
-
-Brainfuck ("brainfuck"):
-
- title Brainfuck while loop command
- literal Brainfuck inc and dec commands
- comment comment
- string Brainfuck input and output commands
-
-Mizar ("mizar"):
-
- keyword keyword
- comment comment
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/highlight.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/highlight.js
deleted file mode 100644
index d750ae221d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/highlight.js
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
-Syntax highlighting with language autodetection.
-http://highlightjs.org/
-*/
-
-function() {
- var self = this;
-
- /* Utility functions */
-
- function escape(value) {
- return value.replace(/&/gm, '&amp;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;');
- }
-
- function blockText(block, ignoreNewLines) {
- return Array.prototype.map.call(block.childNodes, function(node) {
- if (node.nodeType == 3) {
- return ignoreNewLines ? node.nodeValue.replace(/\n/g, '') : node.nodeValue;
- }
- if (node.nodeName.toUpperCase () == 'BR') {
- return '\n';
- }
- return blockText(node, ignoreNewLines);
- }).join('');
- }
-
- function blockLanguage(block) {
- var classes = (block.className + ' ' + (block.parentNode ? block.parentNode.className : '')).split(/\s+/);
- classes = classes.map(function(c) {return c.replace(/^language-/, '');});
- for (var i = 0; i < classes.length; i++) {
- if (languages[classes[i]] || aliases[classes[i]] || classes[i] == 'no-highlight') {
- return classes[i];
- }
- }
- }
-
- function inherit(parent, obj) {
- var result = {};
- for (var key in parent)
- result[key] = parent[key];
- if (obj)
- for (var key in obj)
- result[key] = obj[key];
- return result;
- };
-
- /* Stream merging */
-
- function nodeStream(node) {
- var result = [];
- (function _nodeStream(node, offset) {
- for (var child = node.firstChild; child; child = child.nextSibling) {
- if (child.nodeType == 3)
- offset += child.nodeValue.length;
- else if (child.nodeName.toUpperCase() == 'BR')
- offset += 1;
- else if (child.nodeType == 1) {
- result.push({
- event: 'start',
- offset: offset,
- node: child
- });
- offset = _nodeStream(child, offset);
- result.push({
- event: 'stop',
- offset: offset,
- node: child
- });
- }
- }
- return offset;
- })(node, 0);
- return result;
- }
-
- function mergeStreams(original, highlighted, value) {
- var processed = 0;
- var result = '';
- var nodeStack = [];
-
- function selectStream() {
- if (!original.length || !highlighted.length) {
- return original.length ? original : highlighted;
- }
- if (original[0].offset != highlighted[0].offset) {
- return (original[0].offset < highlighted[0].offset) ? original : highlighted;
- }
-
- /*
- To avoid starting the stream just before it should stop the order is
- ensured that original always starts first and closes last:
-
- if (event1 == 'start' && event2 == 'start')
- return original;
- if (event1 == 'start' && event2 == 'stop')
- return highlighted;
- if (event1 == 'stop' && event2 == 'start')
- return original;
- if (event1 == 'stop' && event2 == 'stop')
- return highlighted;
-
- ... which is collapsed to:
- */
- return highlighted[0].event == 'start' ? original : highlighted;
- }
-
- function open(node) {
- function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"';}
- result += '<' + node.nodeName.toLowerCase() + Array.prototype.map.call(node.attributes, attr_str).join('') + '>';
- }
-
- function close(node) {
- result += '</' + node.nodeName.toLowerCase() + '>';
- }
-
- function render(event) {
- (event.event == 'start' ? open : close)(event.node);
- }
-
- while (original.length || highlighted.length) {
- var stream = selectStream();
- result += escape(value.substr(processed, stream[0].offset - processed));
- processed = stream[0].offset;
- if (stream == original) {
- /*
- On any opening or closing tag of the original markup we first close
- the entire highlighted node stack, then render the original tag along
- with all the following original tags at the same offset and then
- reopen all the tags on the highlighted stack.
- */
- nodeStack.reverse().forEach(close);
- do {
- render(stream.splice(0, 1)[0]);
- stream = selectStream();
- } while (stream == original && stream.length && stream[0].offset == processed);
- nodeStack.reverse().forEach(open);
- } else {
- if (stream[0].event == 'start') {
- nodeStack.push(stream[0].node);
- } else {
- nodeStack.pop();
- }
- render(stream.splice(0, 1)[0]);
- }
- }
- return result + escape(value.substr(processed));
- }
-
- /* Initialization */
-
- function compileLanguage(language) {
-
- function reStr(re) {
- return (re && re.source) || re;
- }
-
- function langRe(value, global) {
- return RegExp(
- reStr(value),
- 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')
- );
- }
-
- function compileMode(mode, parent) {
- if (mode.compiled)
- return;
- mode.compiled = true;
-
- mode.keywords = mode.keywords || mode.beginKeywords;
- if (mode.keywords) {
- var compiled_keywords = {};
-
- function flatten(className, str) {
- if (language.case_insensitive) {
- str = str.toLowerCase();
- }
- str.split(' ').forEach(function(kw) {
- var pair = kw.split('|');
- compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1];
- });
- }
-
- mode.lexemesRe = langRe(mode.lexemes || /[A-Za-z0-9_\\.]+/, true);
- if (typeof mode.keywords == 'string') { // string
- flatten('keyword', mode.keywords);
- } else {
- for (var className in mode.keywords) {
- if (!mode.keywords.hasOwnProperty(className))
- continue;
- flatten(className, mode.keywords[className]);
- }
- }
- mode.keywords = compiled_keywords;
- }
-
- if (parent) {
- if (mode.beginKeywords) {
- mode.begin = '\\b(' + mode.beginKeywords.split(/\s+/).join('|') + ')\\b(?!\\.)\\s*';
- }
- mode.beginRe = langRe(mode.begin ? mode.begin : '\\B|\\b');
- if (!mode.end && !mode.endsWithParent)
- mode.end = '\\B|\\b';
- if (mode.end)
- mode.endRe = langRe(mode.end);
- mode.terminator_end = reStr(mode.end) || '';
- if (mode.endsWithParent && parent.terminator_end)
- mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end;
- }
- if (mode.illegal)
- mode.illegalRe = langRe(mode.illegal);
- if (mode.relevance === undefined)
- mode.relevance = 1;
- if (!mode.contains) {
- mode.contains = [];
- }
- var expanded_contains = [];
- mode.contains.forEach(function(c) {
- if (c.variants) {
- c.variants.forEach(function(v) {expanded_contains.push(inherit(c, v));});
- } else {
- expanded_contains.push(c == 'self' ? mode : c);
- }
- });
- mode.contains = expanded_contains;
- mode.contains.forEach(function(c) {compileMode(c, mode);});
-
- if (mode.starts) {
- compileMode(mode.starts, parent);
- }
-
- var terminators = [];
- for (var i = 0; i < mode.contains.length; i++) {
- terminators.push(reStr(mode.contains[i].begin));
- }
- if (mode.terminator_end) {
- terminators.push(reStr(mode.terminator_end));
- }
- if (mode.illegal) {
- terminators.push(reStr(mode.illegal));
- }
- mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(s) {return null;}};
-
- mode.continuation = {};
- }
-
- compileMode(language);
- }
-
- /*
- Core highlighting function. Accepts a language name, or an alias, and a
- string with the code to highlight. Returns an object with the following
- properties:
-
- - relevance (int)
- - value (an HTML string with highlighting markup)
-
- */
- function highlight(name, value, ignore_illegals, continuation) {
-
- function subMode(lexeme, mode) {
- for (var i = 0; i < mode.contains.length; i++) {
- var match = mode.contains[i].beginRe.exec(lexeme);
- if (match && match.index == 0) {
- return mode.contains[i];
- }
- }
- }
-
- function endOfMode(mode, lexeme) {
- if (mode.end && mode.endRe.test(lexeme)) {
- return mode;
- }
- if (mode.endsWithParent) {
- return endOfMode(mode.parent, lexeme);
- }
- }
-
- function isIllegal(lexeme, mode) {
- return !ignore_illegals && mode.illegal && mode.illegalRe.test(lexeme);
- }
-
- function keywordMatch(mode, match) {
- var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0];
- return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str];
- }
-
- function buildSpan(classname, insideSpan, leaveOpen, noPrefix) {
- var classPrefix = noPrefix ? '': self.classPrefix,
- openSpan = '<span class="' + classPrefix,
- closeSpan = leaveOpen ? '' : '</span>';
-
- openSpan += classname + '">';
-
- return openSpan + insideSpan + closeSpan;
- }
-
- function processKeywords() {
- var buffer = escape(mode_buffer);
- if (!top.keywords)
- return buffer;
- var result = '';
- var last_index = 0;
- top.lexemesRe.lastIndex = 0;
- var match = top.lexemesRe.exec(buffer);
- while (match) {
- result += buffer.substr(last_index, match.index - last_index);
- var keyword_match = keywordMatch(top, match);
- if (keyword_match) {
- relevance += keyword_match[1];
- result += buildSpan(keyword_match[0], match[0]);
- } else {
- result += match[0];
- }
- last_index = top.lexemesRe.lastIndex;
- match = top.lexemesRe.exec(buffer);
- }
- return result + buffer.substr(last_index);
- }
-
- function processSubLanguage() {
- if (top.subLanguage && !languages[top.subLanguage]) {
- return escape(mode_buffer);
- }
- var result = top.subLanguage ? highlight(top.subLanguage, mode_buffer, true, top.continuation.top) : highlightAuto(mode_buffer);
- // Counting embedded language score towards the host language may be disabled
- // with zeroing the containing mode relevance. Usecase in point is Markdown that
- // allows XML everywhere and makes every XML snippet to have a much larger Markdown
- // score.
- if (top.relevance > 0) {
- relevance += result.relevance;
- }
- if (top.subLanguageMode == 'continuous') {
- top.continuation.top = result.top;
- }
- return buildSpan(result.language, result.value, false, true);
- }
-
- function processBuffer() {
- return top.subLanguage !== undefined ? processSubLanguage() : processKeywords();
- }
-
- function startNewMode(mode, lexeme) {
- var markup = mode.className? buildSpan(mode.className, '', true): '';
- if (mode.returnBegin) {
- result += markup;
- mode_buffer = '';
- } else if (mode.excludeBegin) {
- result += escape(lexeme) + markup;
- mode_buffer = '';
- } else {
- result += markup;
- mode_buffer = lexeme;
- }
- top = Object.create(mode, {parent: {value: top}});
- }
-
- function processLexeme(buffer, lexeme) {
- mode_buffer += buffer;
- if (lexeme === undefined) {
- result += processBuffer();
- return 0;
- }
-
- var new_mode = subMode(lexeme, top);
- if (new_mode) {
- result += processBuffer();
- startNewMode(new_mode, lexeme);
- return new_mode.returnBegin ? 0 : lexeme.length;
- }
-
- var end_mode = endOfMode(top, lexeme);
- if (end_mode) {
- var origin = top;
- if (!(origin.returnEnd || origin.excludeEnd)) {
- mode_buffer += lexeme;
- }
- result += processBuffer();
- do {
- if (top.className) {
- result += '</span>';
- }
- relevance += top.relevance;
- top = top.parent;
- } while (top != end_mode.parent);
- if (origin.excludeEnd) {
- result += escape(lexeme);
- }
- mode_buffer = '';
- if (end_mode.starts) {
- startNewMode(end_mode.starts, '');
- }
- return origin.returnEnd ? 0 : lexeme.length;
- }
-
- if (isIllegal(lexeme, top))
- throw new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '<unnamed>') + '"');
-
- /*
- Parser should not reach this point as all types of lexemes should be caught
- earlier, but if it does due to some bug make sure it advances at least one
- character forward to prevent infinite looping.
- */
- mode_buffer += lexeme;
- return lexeme.length || 1;
- }
-
- var language = getLanguage(name);
- if (!language) {
- throw new Error('Unknown language: "' + name + '"');
- }
-
- compileLanguage(language);
- var top = continuation || language;
- var result = '';
- for(var current = top; current != language; current = current.parent) {
- if (current.className) {
- result = buildSpan(current.className, result, true);
- }
- }
- var mode_buffer = '';
- var relevance = 0;
- try {
- var match, count, index = 0;
- while (true) {
- top.terminators.lastIndex = index;
- match = top.terminators.exec(value);
- if (!match)
- break;
- count = processLexeme(value.substr(index, match.index - index), match[0]);
- index = match.index + count;
- }
- processLexeme(value.substr(index));
- for(var current = top; current.parent; current = current.parent) { // close dangling modes
- if (current.className) {
- result += '</span>';
- }
- };
- return {
- relevance: relevance,
- value: result,
- language: name,
- top: top
- };
- } catch (e) {
- if (e.message.indexOf('Illegal') != -1) {
- return {
- relevance: 0,
- value: escape(value)
- };
- } else {
- throw e;
- }
- }
- }
-
- /*
- Highlighting with language detection. Accepts a string with the code to
- highlight. Returns an object with the following properties:
-
- - language (detected language)
- - relevance (int)
- - value (an HTML string with highlighting markup)
- - second_best (object with the same structure for second-best heuristically
- detected language, may be absent)
-
- */
- function highlightAuto(text) {
- var result = {
- relevance: 0,
- value: escape(text)
- };
- var second_best = result;
- for (var key in languages) {
- if (!languages.hasOwnProperty(key))
- continue;
- var current = highlight(key, text, false);
- current.language = key;
- if (current.relevance > second_best.relevance) {
- second_best = current;
- }
- if (current.relevance > result.relevance) {
- second_best = result;
- result = current;
- }
- }
- if (second_best.language) {
- result.second_best = second_best;
- }
- return result;
- }
-
- /*
- Post-processing of the highlighted markup:
-
- - replace TABs with something more useful
- - replace real line-breaks with '<br>' for non-pre containers
-
- */
- function fixMarkup(value, tabReplace, useBR) {
- if (tabReplace) {
- value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) {
- return p1.replace(/\t/g, tabReplace);
- });
- }
- if (useBR) {
- value = value.replace(/\n/g, '<br>');
- }
- return value;
- }
-
- /*
- Applies highlighting to a DOM node containing code. Accepts a DOM node and
- two optional parameters for fixMarkup.
- */
- function highlightBlock(block, tabReplace, useBR) {
- var text = blockText(block, useBR);
- var language = blockLanguage(block);
- if (language == 'no-highlight')
- return;
- var result = language ? highlight(language, text, true) : highlightAuto(text);
- var original = nodeStream(block);
- if (original.length) {
- var pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre');
- pre.innerHTML = result.value;
- result.value = mergeStreams(original, nodeStream(pre), text);
- }
- result.value = fixMarkup(result.value, tabReplace, useBR);
-
- block.innerHTML = result.value;
- block.className += ' hljs ' + (!language && result.language || '');
- block.result = {
- language: result.language,
- re: result.relevance
- };
- if (result.second_best) {
- block.second_best = {
- language: result.second_best.language,
- re: result.second_best.relevance
- };
- }
- }
-
- /*
- Applies highlighting to all <pre><code>..</code></pre> blocks on a page.
- */
- function initHighlighting() {
- if (initHighlighting.called)
- return;
- initHighlighting.called = true;
-
- var blocks = document.querySelectorAll('pre code');
-
- Array.prototype.forEach.call(blocks, function(block){
- highlightBlock(block, self.tabReplace);
- });
- }
-
- /*
- Attaches highlighting to the page load event.
- */
- function initHighlightingOnLoad() {
- addEventListener('DOMContentLoaded', initHighlighting, false);
- addEventListener('load', initHighlighting, false);
- }
-
- var languages = {};
- var aliases = {};
-
- function registerLanguage(name, language) {
- var lang = languages[name] = language(self);
-
- if (lang.aliases) {
- lang.aliases.forEach(function(alias) {aliases[alias] = name;});
- }
- }
-
- function getLanguage(name) {
- return languages[name] || languages[aliases[name]];
- }
-
- /* Interface definition */
-
- this.highlight = highlight;
- this.highlightAuto = highlightAuto;
- this.fixMarkup = fixMarkup;
- this.highlightBlock = highlightBlock;
- this.initHighlighting = initHighlighting;
- this.initHighlightingOnLoad = initHighlightingOnLoad;
- this.classPrefix = 'hljs-';
- this.registerLanguage = registerLanguage;
- this.getLanguage = getLanguage;
- this.inherit = inherit;
-
- // Common regexps
- this.IDENT_RE = '[a-zA-Z][a-zA-Z0-9_]*';
- this.UNDERSCORE_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*';
- this.NUMBER_RE = '\\b\\d+(\\.\\d+)?';
- this.C_NUMBER_RE = '(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float
- this.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b...
- this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';
-
- // Common modes
- this.BACKSLASH_ESCAPE = {
- begin: '\\\\[\\s\\S]', relevance: 0
- };
- this.APOS_STRING_MODE = {
- className: 'string',
- begin: '\'', end: '\'',
- illegal: '\\n',
- contains: [this.BACKSLASH_ESCAPE]
- };
- this.QUOTE_STRING_MODE = {
- className: 'string',
- begin: '"', end: '"',
- illegal: '\\n',
- contains: [this.BACKSLASH_ESCAPE]
- };
- this.C_LINE_COMMENT_MODE = {
- className: 'comment',
- begin: '//', end: '$'
- };
- this.C_BLOCK_COMMENT_MODE = {
- className: 'comment',
- begin: '/\\*', end: '\\*/'
- };
- this.HASH_COMMENT_MODE = {
- className: 'comment',
- begin: '#', end: '$'
- };
- this.NUMBER_MODE = {
- className: 'number',
- begin: this.NUMBER_RE,
- relevance: 0
- };
- this.C_NUMBER_MODE = {
- className: 'number',
- begin: this.C_NUMBER_RE,
- relevance: 0
- };
- this.BINARY_NUMBER_MODE = {
- className: 'number',
- begin: this.BINARY_NUMBER_RE,
- relevance: 0
- };
- this.REGEXP_MODE = {
- className: 'regexp',
- begin: /\//, end: /\/[gim]*/,
- illegal: /\n/,
- contains: [
- this.BACKSLASH_ESCAPE,
- {
- begin: /\[/, end: /\]/,
- relevance: 0,
- contains: [this.BACKSLASH_ESCAPE]
- }
- ]
- };
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/highlight.pack.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/highlight.pack.js
deleted file mode 100644
index ddae207316..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/highlight.pack.js
+++ /dev/null
@@ -1 +0,0 @@
-var hljs=new function(){function l(o){return o.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName.toUpperCase()=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName.toUpperCase()=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+(q.parentNode?q.parentNode.className:"")).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName.toUpperCase()=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(p,r,v){var q=0;var y="";var s=[];function u(){if(!p.length||!r.length){return p.length?p:r}if(p[0].offset!=r[0].offset){return(p[0].offset<r[0].offset)?p:r}return r[0].event=="start"?p:r}function t(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}y+="<"+A.nodeName.toLowerCase()+Array.prototype.map.call(A.attributes,z).join("")+">"}function x(z){y+="</"+z.nodeName.toLowerCase()+">"}function o(z){(z.event=="start"?t:x)(z.node)}while(p.length||r.length){var w=u();y+=l(v.substr(q,w[0].offset-q));q=w[0].offset;if(w==p){s.reverse().forEach(x);do{o(w.splice(0,1)[0]);w=u()}while(w==p&&w.length&&w[0].offset==q);s.reverse().forEach(t)}else{if(w[0].event=="start"){s.push(w[0].node)}else{s.pop()}o(w.splice(0,1)[0])}}return y+l(v.substr(q))}function f(r){function o(s){return(s&&s.source)||s}function p(t,s){return RegExp(o(t),"m"+(r.cI?"i":"")+(s?"g":""))}function q(z,x){if(z.compiled){return}z.compiled=true;var u=[];if(z.k){var s={};function A(B,t){if(r.cI){t=t.toLowerCase()}t.split(" ").forEach(function(C){var D=C.split("|");s[D[0]]=[B,D[1]?Number(D[1]):1];u.push(D[0])})}z.lR=p(z.l||"\\b"+hljs.IR+"\\b(?!\\.)",true);if(typeof z.k=="string"){A("keyword",z.k)}else{for(var y in z.k){if(!z.k.hasOwnProperty(y)){continue}A(y,z.k[y])}}z.k=s}if(x){if(z.bWK){z.b="\\b("+u.join("|")+")\\b(?!\\.)\\s*"}z.bR=p(z.b?z.b:"\\B|\\b");if(!z.e&&!z.eW){z.e="\\B|\\b"}if(z.e){z.eR=p(z.e)}z.tE=o(z.e)||"";if(z.eW&&x.tE){z.tE+=(z.e?"|":"")+x.tE}}if(z.i){z.iR=p(z.i)}if(z.r===undefined){z.r=1}if(!z.c){z.c=[]}for(var w=0;w<z.c.length;w++){if(z.c[w]=="self"){z.c[w]=z}q(z.c[w],z)}if(z.starts){q(z.starts,x)}var v=[];for(var w=0;w<z.c.length;w++){v.push(o(z.c[w].b))}if(z.tE){v.push(o(z.tE))}if(z.i){v.push(o(z.i))}z.t=v.length?p(v.join("|"),true):{exec:function(t){return null}}}q(r)}function d(E,G,C,M){function o(r,P){for(var O=0;O<P.c.length;O++){var N=P.c[O].bR.exec(r);if(N&&N.index==0){return P.c[O]}}}function s(N,r){if(N.e&&N.eR.test(r)){return N}if(N.eW){return s(N.parent,r)}}function t(r,N){return !C&&N.i&&N.iR.test(r)}function y(O,r){var N=H.cI?r[0].toLowerCase():r[0];return O.k.hasOwnProperty(N)&&O.k[N]}function I(){var N=l(w);if(!B.k){return N}var r="";var Q=0;B.lR.lastIndex=0;var O=B.lR.exec(N);while(O){r+=N.substr(Q,O.index-Q);var P=y(B,O);if(P){v+=P[1];r+='<span class="'+P[0]+'">'+O[0]+"</span>"}else{r+=O[0]}Q=B.lR.lastIndex;O=B.lR.exec(N)}return r+N.substr(Q)}function z(){if(B.sL&&!e[B.sL]){return l(w)}var N=B.subLanguageMode=="continuous"?B.top:undefined;var r=B.sL?d(B.sL,w,true,N):g(w);if(B.r>0){v+=r.keyword_count;A+=r.r}B.top=r.top;return'<span class="'+r.language+'">'+r.value+"</span>"}function L(){return B.sL!==undefined?z():I()}function K(O,r){var N=O.cN?'<span class="'+O.cN+'">':"";if(O.rB){x+=N;w=""}else{if(O.eB){x+=l(r)+N;w=""}else{x+=N;w=r}}B=Object.create(O,{parent:{value:B}})}function D(N,r){w+=N;if(r===undefined){x+=L();return 0}var P=o(r,B);if(P){x+=L();K(P,r);return P.rB?0:r.length}var Q=s(B,r);if(Q){var O=B;if(!(O.rE||O.eE)){w+=r}x+=L();do{if(B.cN){x+="</span>"}A+=B.r;B=B.parent}while(B!=Q.parent);if(O.eE){x+=l(r)}w="";if(Q.starts){K(Q.starts,"")}return O.rE?0:r.length}if(t(r,B)){throw new Error('Illegal lexem "'+r+'" for mode "'+(B.cN||"<unnamed>")+'"')}w+=r;return r.length||1}var H=e[E];if(!H){throw new Error('Unknown language: "'+E+'"')}f(H);var B=M||H;var x="";for(var F=B;F!=H;F=F.parent){if(F.cN){x='<span class="'+F.cN+'">'+x}}var w="";var A=0;var v=0;try{var u,q,p=0;while(true){B.t.lastIndex=p;u=B.t.exec(G);if(!u){break}q=D(G.substr(p,u.index-p),u[0]);p=u.index+q}D(G.substr(p));for(var F=B;F.parent;F=F.parent){if(F.cN){x+="</span>"}}return{r:A,keyword_count:v,value:x,language:E,top:B}}catch(J){if(J.message.indexOf("Illegal")!=-1){return{r:0,keyword_count:0,value:l(G)}}else{throw J}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s,false);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v,true):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElementNS("http://www.w3.org/1999/xhtml","pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.bash=function(a){var c={cN:"variable",b:/\$[\w\d#@][\w\d_]*/};var b={cN:"variable",b:/\$\{(.*?)\}/};var e={cN:"string",b:/"/,e:/"/,c:[a.BE,c,b,{cN:"variable",b:/\$\(/,e:/\)/,c:a.BE}],r:0};var d={cN:"string",b:/'/,e:/'/,r:0};return{l:/-?[a-z]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[{cN:"title",b:/\w[\w\d_]*/}],r:0},a.HCM,a.NM,e,d,c,b]}}(hljs);hljs.LANGUAGES.erlang=function(i){var c="[a-z'][a-zA-Z0-9_']*";var o="("+c+":"+c+"|"+c+")";var f={keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun let not of orelse|10 query receive rem try when xor",literal:"false true"};var l={cN:"comment",b:"%",e:"$",r:0};var e={cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0};var g={b:"fun\\s+"+c+"/\\d+"};var n={b:o+"\\(",e:"\\)",rB:true,r:0,c:[{cN:"function_name",b:o,r:0},{b:"\\(",e:"\\)",eW:true,rE:true,r:0}]};var h={cN:"tuple",b:"{",e:"}",r:0};var a={cN:"variable",b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0};var m={cN:"variable",b:"[A-Z][a-zA-Z0-9_]*",r:0};var b={b:"#"+i.UIR,r:0,rB:true,c:[{cN:"record_name",b:"#"+i.UIR,r:0},{b:"{",e:"}",r:0}]};var k={k:f,b:"(fun|receive|if|try|case)",e:"end"};k.c=[l,g,i.inherit(i.ASM,{cN:""}),k,n,i.QSM,e,h,a,m,b];var j=[l,g,k,n,i.QSM,e,h,a,m,b];n.c[1].c=j;h.c=j;b.c[1].c=j;var d={cN:"params",b:"\\(",e:"\\)",c:j};return{k:f,i:"(</|\\*=|\\+=|-=|/=|/\\*|\\*/|\\(\\*|\\*\\))",c:[{cN:"function",b:"^"+c+"\\s*\\(",e:"->",rB:true,i:"\\(|#|//|/\\*|\\\\|:",c:[d,{cN:"title",b:c}],starts:{e:";|\\.",k:f,c:j}},l,{cN:"pp",b:"^-",e:"\\.",r:0,eE:true,rB:true,l:"-"+i.IR,k:"-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn -import -include -include_lib -compile -define -else -endif -file -behaviour -behavior",c:[d]},e,i.QSM,b,a,m,h]}}(hljs);hljs.LANGUAGES.cs=function(a){return{k:"abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async await ascending descending from get group into join let orderby partial select set value var where yield",c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},a.CLCM,a.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a.ASM,a.QSM,a.CNM]}}(hljs);hljs.LANGUAGES.brainfuck=function(a){return{c:[{cN:"comment",b:"[^\\[\\]\\.,\\+\\-<> \r\n]",rE:true,e:"[\\[\\]\\.,\\+\\-<> \r\n]",r:0},{cN:"title",b:"[\\[\\]]",r:0},{cN:"string",b:"[\\.,]",r:0},{cN:"literal",b:"[\\+\\-]"}]}}(hljs);hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10},{cN:"string",b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r{",e:"}[a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r\\(",e:"\\)[a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r!",e:"![a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r\\[",e:"\\][a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.rust=function(b){var d={cN:"title",b:b.UIR};var c={cN:"number",b:"\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)",r:0};var a="assert bool break char check claim comm const cont copy dir do drop else enum extern export f32 f64 fail false float fn for i16 i32 i64 i8 if impl int let log loop match mod move mut priv pub pure ref return self static str struct task true trait type u16 u32 u64 u8 uint unsafe use vec while";return{k:a,i:"</",c:[b.CLCM,b.CBLCLM,b.inherit(b.QSM,{i:null}),b.ASM,c,{cN:"function",bWK:true,e:"(\\(|<)",k:"fn",c:[d]},{cN:"preprocessor",b:"#\\[",e:"\\]"},{bWK:true,e:"(=|<)",k:"type",c:[d],i:"\\S"},{bWK:true,e:"({|<)",k:"trait enum",c:[d],i:"\\S"}]}}(hljs);hljs.LANGUAGES.ruleslanguage=function(a){return{k:{keyword:"BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 INTDCREATEHANDLE|5 INTDCREATEMASK|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE NOVALUE SECTION WARN DELETE SAVE SAVE_UPDATE CLEAR DETERMINANT LABEL REPORT REVENUE ABORT CALL DONE LEAVE EACH IN LIST NOVALUE FROM TOTAL CHARGE BLOCK AND OR CSV_FILE BILL_PERIOD RATE_CODE AUXILIARY_DEMAND UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM ABORT WARN NUMDAYS RATE_CODE READ_DATE STAGING",built_in:"IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME"},c:[a.CLCM,a.CBLCLM,a.ASM,a.QSM,a.CNM,{cN:"array",b:"#[a-zA-Z .]+"}]}}(hljs);hljs.LANGUAGES.rib=function(a){return{k:"ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry Hider Hyperboloid Identity Illuminate Imager Interior LightSource MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd TransformPoints Translate TrimCurve WorldBegin WorldEnd",i:"</",c:[a.HCM,a.CNM,a.ASM,a.QSM]}}(hljs);hljs.LANGUAGES.diff=function(a){return{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}(hljs);hljs.LANGUAGES.haml=function(a){return{cI:true,c:[{cN:"doctype",b:"^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$",r:10},{cN:"comment",b:"^\\s*(-#|/).*$",r:0},{b:"^\\s*-(?!#)",starts:{e:"\\n",sL:"ruby"},r:0},{cN:"tag",b:"^\\s*%",c:[{cN:"title",b:"\\w+",r:0},{cN:"value",b:"[#\\.]\\w+",r:0},{b:"{\\s*",e:"\\s*}",eE:true,c:[{b:":\\w+\\s*=>",e:",\\s+",rB:true,eW:true,r:0,c:[{cN:"symbol",b:":\\w+",r:0},{cN:"string",b:'"',e:'"',r:0},{cN:"string",b:"'",e:"'",r:0},{b:"\\w+",r:0}]},],r:0},{b:"\\(\\s*",e:"\\s*\\)",eE:true,c:[{b:"\\w+\\s*=",e:"\\s+",rB:true,eW:true,r:0,c:[{cN:"attribute",b:"\\w+",r:0},{cN:"string",b:'"',e:'"',r:0},{cN:"string",b:"'",e:"'",r:0},{b:"\\w+",r:0}]},],r:0}],r:10},{cN:"bullet",b:"^\\s*[=~]\\s*",r:0},{b:"#{",starts:{e:"}",sL:"ruby"},r:0}]}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,sL:"xml"}],r:0},{cN:"function",bWK:true,e:/{/,k:"function",c:[{cN:"title",b:/[A-Za-z$_][0-9A-Za-z$_]*/},{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/}]}}(hljs);hljs.LANGUAGES.glsl=function(a){return{k:{keyword:"atomic_uint attribute bool break bvec2 bvec3 bvec4 case centroid coherent const continue default discard dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 do double dvec2 dvec3 dvec4 else flat float for highp if iimage1D iimage1DArray iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray image2DRect image3D imageBuffer imageCube imageCubeArray in inout int invariant isampler1D isampler1DArray isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 layout lowp mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 mediump noperspective out patch precision readonly restrict return sample sampler1D sampler1DArray sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow smooth struct subroutine switch uimage1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect uimage3D uimageBuffer uimageCube uimageCubeArray uint uniform usampler1D usampler1DArray usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D usamplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 varying vec2 vec3 vec4 void volatile while writeonly",built_in:"gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial gl_FrontSecondaryColor gl_InstanceID gl_InvocationID gl_Layer gl_LightModel gl_LightSource gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms gl_MaxVertexOutputComponents gl_MaxVertexTextureImageUnits gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffsetgl_ModelViewMatrix gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_Normal gl_NormalMatrix gl_NormalScale gl_ObjectPlaneQ gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_PerVertex gl_Point gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_TexCoord gl_TextureEnvColor gl_TextureMatrixInverseTranspose gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_in gl_out EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin asinh atan atanh atomicCounter atomicCounterDecrement atomicCounterIncrement barrier bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan greaterThanEqual imageAtomicAdd imageAtomicAnd imageAtomicCompSwap imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log log2 matrixCompMult max memoryBarrier min mix mod modf noise1 noise2 noise3 noise4 normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset textureProjLod textureProjLodOffset textureProjOffset textureQueryLod textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow gl_TextureMatrix gl_TextureMatrixInverse",literal:"true false"},i:'"',c:[a.CLCM,a.CBLCLM,a.CNM,{cN:"preprocessor",b:"#",e:"$"}]}}(hljs);hljs.LANGUAGES.rsl=function(a){return{k:{keyword:"float color point normal vector matrix while for if do return else break extern continue",built_in:"abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp faceforward filterstep floor format fresnel incident length lightsource log match max min mod noise normalize ntransform opposite option phong pnoise pow printf ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan texture textureinfo trace transform vtransform xcomp ycomp zcomp"},i:"</",c:[a.CLCM,a.CBLCLM,a.QSM,a.ASM,a.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"shader",bWK:true,e:"\\(",k:"surface displacement light volume imager"},{cN:"shading",bWK:true,e:"\\(",k:"illuminate illuminance gather"}]}}(hljs);hljs.LANGUAGES.lua=function(b){var a="\\[=*\\[";var e="\\]=*\\]";var c={b:a,e:e,c:["self"]};var d=[{cN:"comment",b:"--(?!"+a+")",e:"$"},{cN:"comment",b:"--"+a,e:e,c:[c],r:10}];return{l:b.UIR,k:{keyword:"and break do else elseif end false for if in local nil not or repeat return then true until while",built_in:"_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug io math os package string table"},c:d.concat([{cN:"function",bWK:true,e:"\\)",k:"function",c:[{cN:"title",b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"},{cN:"params",b:"\\(",eW:true,c:d}].concat(d)},b.CNM,b.ASM,b.QSM,{cN:"string",b:a,e:e,c:[c],r:10}])}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,r:0,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",r:0,c:[{cN:"title",b:"[^ /><]+"},b]}]}}(hljs);hljs.LANGUAGES.markdown=function(a){return{c:[{cN:"header",b:"^#{1,3}",e:"$"},{cN:"header",b:"^.+?\\n[=-]{2,}$"},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",b:"\\*.+?\\*"},{cN:"emphasis",b:"_.+?_",r:0},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",b:"`.+?`"},{cN:"code",b:"^ ",e:"$",r:0},{cN:"horizontal_rule",b:"^-{3,}",e:"$"},{b:"\\[.+?\\]\\(.+?\\)",rB:true,c:[{cN:"link_label",b:"\\[.+\\]"},{cN:"link_url",b:"\\(",e:"\\)",eB:true,eE:true}]}]}}(hljs);hljs.LANGUAGES.css=function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*";var c={cN:"function",b:b+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]};return{cI:true,i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:true,eE:true,r:0,c:[c,a.ASM,a.QSM,a.NM]}]},{cN:"tag",b:b,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[c,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}}(hljs);hljs.LANGUAGES.lisp=function(i){var l="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*";var m="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?";var k={cN:"shebang",b:"^#!",e:"$"};var a={cN:"literal",b:"\\b(t{1}|nil)\\b"};var d=[{cN:"number",b:m,r:0},{cN:"number",b:"#b[0-1]+(/[0-1]+)?"},{cN:"number",b:"#o[0-7]+(/[0-7]+)?"},{cN:"number",b:"#x[0-9a-f]+(/[0-9a-f]+)?"},{cN:"number",b:"#c\\("+m+" +"+m,e:"\\)"}];var h={cN:"string",b:'"',e:'"',c:[i.BE],r:0};var n={cN:"comment",b:";",e:"$"};var g={cN:"variable",b:"\\*",e:"\\*"};var o={cN:"keyword",b:"[:&]"+l};var b={b:"\\(",e:"\\)",c:["self",a,h].concat(d)};var e={cN:"quoted",b:"['`]\\(",e:"\\)",c:d.concat([h,g,o,b])};var c={cN:"quoted",b:"\\(quote ",e:"\\)",k:{title:"quote"},c:d.concat([h,g,o,b])};var j={cN:"list",b:"\\(",e:"\\)"};var f={eW:true,r:0};j.c=[{cN:"title",b:l},f];f.c=[e,c,j,a].concat(d).concat([h,n,g,o]);return{i:/\S/,c:d.concat([k,a,h,n,e,c,j])}}(hljs);hljs.LANGUAGES.profile=function(a){return{c:[a.CNM,{cN:"built_in",b:"{",e:"}$",eB:true,eE:true,c:[a.ASM,a.QSM],r:0},{cN:"filename",b:"[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}",e:":",eE:true},{cN:"header",b:"(ncalls|tottime|cumtime)",e:"$",k:"ncalls tottime|10 cumtime|10 filename",r:10},{cN:"summary",b:"function calls",e:"$",c:[a.CNM],r:10},a.ASM,a.QSM,{cN:"function",b:"\\(",e:"\\)$",c:[{cN:"title",b:a.UIR,r:0}],r:0}]}}(hljs);hljs.LANGUAGES.http=function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}}(hljs);hljs.LANGUAGES.java=function(a){return{k:"false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}],r:10},a.CLCM,a.CBLCLM,a.ASM,a.QSM,{cN:"class",bWK:true,e:"{",k:"class interface",eE:true,i:":",c:[{bWK:true,k:"extends implements",r:10},{cN:"title",b:a.UIR}]},a.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}}(hljs);hljs.LANGUAGES.fsharp=function(a){return{k:"abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override private public rec return sig static struct then to true try type upcast use val void when while with yield",c:[{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},{cN:"string",b:'"""',e:'"""'},{cN:"comment",b:"\\(\\*",e:"\\*\\)"},{cN:"class",bWK:true,e:"\\(|=|$",k:"type",c:[{cN:"title",b:a.UIR}]},{cN:"annotation",b:"\\[<",e:">\\]"},{cN:"attribute",b:"\\B('[A-Za-z])\\b",c:[a.BE]},a.CLCM,a.inherit(a.QSM,{i:null}),a.CNM]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,l:a.UIR,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",b:"__halt_compiler.+?;",eW:true,k:"__halt_compiler",l:a.UIR},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.haskell=function(f){var h={cN:"comment",b:"--",e:"$"};var g={cN:"comment",c:["self"],b:"{-",e:"-}"};var e={cN:"pragma",b:"{-#",e:"#-}"};var b={cN:"preprocessor",b:"^#",e:"$"};var d={cN:"type",b:"\\b[A-Z][\\w']*",r:0};var c={cN:"container",b:"\\(",e:"\\)",i:'"',c:[e,h,g,b,{cN:"type",b:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},{cN:"title",b:"[_a-z][\\w']*"}]};var a={cN:"container",b:"{",e:"}",c:c.c};return{k:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec",c:[{cN:"module",b:"\\bmodule ",e:"where",k:"module where",c:[c,g],i:"\\W\\.|;"},{cN:"import",b:"\\bimport ",e:"$",k:"import qualified as hiding",c:[c,h,g],i:"\\W\\.|;"},{cN:"class",b:"\\b(class |instance )",e:"where",k:"class family instance where",c:[d,c,g]},{cN:"typedef",b:"\\b(data |(new)?type )",e:"$",k:"data family type newtype deriving",c:[e,h,g,d,c,a]},{cN:"default",b:"\\bdefault ",e:"$",k:"default",c:[d,c,h,g]},{cN:"infix",b:"\\b(infix |infixl |infixr )",e:"$",k:"infix infixl infixr",c:[f.CNM,h,g]},{cN:"foreign",b:"\\bforeign ",e:"$",k:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe",c:[d,f.QSM,h,g]},{cN:"shebang",b:"#!\\/usr\\/bin\\/env runhaskell",e:"$"},e,h,g,b,f.QSM,f.CNM,d,{cN:"title",b:"^[_a-z][\\w']*"},{b:"->|<-"}]}}(hljs);hljs.LANGUAGES["1c"]=function(b){var f="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*";var c="возврат дата для если и или иначе иначеесли исключение конецесли конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл число экспорт";var e="ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты установитьтана установитьтапо фиксшаблон формат цел шаблон";var a={cN:"dquote",b:'""'};var d={cN:"string",b:'"',e:'"|$',c:[a],r:0};var g={cN:"string",b:"\\|",e:'"|$',c:[a]};return{cI:true,l:f,k:{keyword:c,built_in:e},c:[b.CLCM,b.NM,d,g,{cN:"function",b:"(процедура|функция)",e:"$",l:f,k:"процедура функция",c:[{cN:"title",b:f},{cN:"tail",eW:true,c:[{cN:"params",b:"\\(",e:"\\)",l:f,k:"знач",c:[d,g]},{cN:"export",b:"экспорт",eW:true,l:f,k:"экспорт",c:[b.CLCM]}]},b.CLCM]},{cN:"preprocessor",b:"#",e:"$"},{cN:"date",b:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:/^(>>>|\.\.\.) /};var c=[{cN:"string",b:/(u|b)?r?'''/,e:/'''/,c:[f],r:10},{cN:"string",b:/(u|b)?r?"""/,e:/"""/,c:[f],r:10},{cN:"string",b:/(u|r|ur)'/,e:/'/,c:[a.BE],r:10},{cN:"string",b:/(u|r|ur)"/,e:/"/,c:[a.BE],r:10},{cN:"string",b:/(b|br)'/,e:/'/,c:[a.BE]},{cN:"string",b:/(b|br)"/,e:/"/,c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:/\(/,e:/\)/,c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:/:/,i:/[${=;\n]/,c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}])}}(hljs);hljs.LANGUAGES.smalltalk=function(a){var b="[a-z][a-zA-Z0-9_]*";var d={cN:"char",b:"\\$.{1}"};var c={cN:"symbol",b:"#"+a.UIR};return{k:"self super nil true false thisContext",c:[{cN:"comment",b:'"',e:'"',r:0},a.ASM,{cN:"class",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},{cN:"method",b:b+":"},a.CNM,c,d,{cN:"localvars",b:"\\|\\s*"+b+"(\\s+"+b+")*\\s*\\|"},{cN:"array",b:"\\#\\(",e:"\\)",c:[a.ASM,d,a.CNM,c]}]}}(hljs);hljs.LANGUAGES.tex=function(a){var d={cN:"command",b:"\\\\[a-zA-Zа-яА-я]+[\\*]?"};var c={cN:"command",b:"\\\\[^a-zA-Zа-яА-я0-9]"};var b={cN:"special",b:"[{}\\[\\]\\&#~]",r:0};return{c:[{b:"\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",rB:true,c:[d,c,{cN:"number",b:" *=",e:"-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",eB:true}],r:10},d,c,b,{cN:"formula",b:"\\$\\$",e:"\\$\\$",c:[d,c,b],r:0},{cN:"formula",b:"\\$",e:"\\$",c:[d,c,b],r:0},{cN:"comment",b:"%",e:"$",r:0}]}}(hljs);hljs.LANGUAGES.actionscript=function(a){var d="[a-zA-Z_$][a-zA-Z0-9_$]*";var c="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)";var e={cN:"rest_arg",b:"[.]{3}",e:d,r:10};var b={cN:"title",b:d};return{k:{keyword:"as break case catch class const continue default delete do dynamic each else extends final finally for function get if implements import in include instanceof interface internal is namespace native new override package private protected public return set static super switch this throw try typeof use var void while with",literal:"true false null undefined"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{cN:"package",bWK:true,e:"{",k:"package",c:[b]},{cN:"class",bWK:true,e:"{",k:"class interface",c:[{bWK:true,k:"extends implements"},b]},{cN:"preprocessor",bWK:true,e:";",k:"import include"},{cN:"function",bWK:true,e:"[{;]",k:"function",i:"\\S",c:[b,{cN:"params",b:"\\(",e:"\\)",c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,e]},{cN:"type",b:":",e:c,r:10}]}]}}(hljs);hljs.LANGUAGES.sql=function(a){return{cI:true,c:[{cN:"operator",b:"(begin|end|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)",e:";",eW:true,k:{keyword:"all partial global month current_timestamp using go revoke smallint indicator end-exec disconnect zone with character assertion to add current_user usage input local alter match collate real then rollback get read timestamp session_user not integer bit unique day minute desc insert execute like ilike|2 level decimal drop continue isolation found where constraints domain right national some module transaction relative second connect escape close system_user for deferred section cast current sqlstate allocate intersect deallocate numeric public preserve full goto initially asc no key output collation group by union session both last language constraint column of space foreign deferrable prior connection unknown action commit view or first into float year primary cascaded except restrict set references names table outer open select size are rows from prepare distinct leading create only next inner authorization schema corresponding option declare precision immediate else timezone_minute external varying translation true case exception join hour default double scroll value cursor descriptor values dec fetch procedure delete and false int is describe char as at in varchar null trailing any absolute current_time end grant privileges when cross check write current_date pad begin temporary exec time update catalog user sql date on identity timezone_hour natural whenever interval work order cascade diagnostics nchar having left call do handler load replace truncate start lock show pragma exists number trigger if before after each row",aggregate:"count sum min max avg"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM]},a.CBLCLM,{cN:"comment",b:"--",e:"$"}]}}(hljs);hljs.LANGUAGES.handlebars=function(b){var a="each in with if else unless bindattr action collection debugger log outlet template unbound view yield";return{cI:true,sL:"xml",subLanguageMode:"continuous",c:[{cN:"expression",b:"{{",e:"}}",c:[{cN:"begin-block",b:"#[a-zA-Z .]+",k:a},{cN:"string",b:'"',e:'"'},{cN:"end-block",b:"\\/[a-zA-Z .]+",k:a},{cN:"variable",b:"[a-zA-Z.]+",k:a}]}]}}(hljs);hljs.LANGUAGES.vala=function(a){return{k:{keyword:"char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var",built_in:"DBus GLib CCode Gee Object",literal:"false true null"},c:[{cN:"class",bWK:true,e:"{",k:"class interface delegate namespace",i:"[^,:\\n\\s\\.]",c:[{cN:"title",b:a.UIR}]},a.CLCM,a.CBLCLM,{cN:"string",b:'"""',e:'"""',r:5},a.ASM,a.QSM,a.CNM,{cN:"preprocessor",b:"^#",e:"$",r:2},{cN:"constant",b:" [A-Z_]+ ",r:0}]}}(hljs);hljs.LANGUAGES.ini=function(a){return{cI:true,i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM],r:0}]}]}}(hljs);hljs.LANGUAGES.livecodeserver=function(a){var f={cN:"variable",b:"\\b[gtps][A-Z]+[A-Za-z0-9_\\-]*\\b|\\$_[A-Z]+",r:0};var b=[a.inherit(a.ASM),a.inherit(a.QSM)];var d=[a.inherit(a.CBLCLM),{cN:"comment",b:"--",e:"$"},{cN:"comment",b:"[^:]//",e:"\\n"},{cN:"comment",b:"#",e:"\\n"}];var c=[a.BNM,a.CNM];var e=[{cN:"title",b:"\\b_*rig[A-Z]+[A-Za-z0-9_\\-]*"},{cN:"title",b:"\\b_[a-z0-9\\-]+"}];return{cI:false,k:{keyword:"after byte bytes english the until http forever descending using line real8 with seventh for stdout finally element word fourth before black ninth sixth characters chars stderr uInt1 uInt1s uInt2 uInt2s stdin string lines relative rel any fifth items from middle mid at else of catch then third it file milliseconds seconds second secs sec int1 int1s int4 int4s internet int2 int2s normal text item last long detailed effective uInt4 uInt4s repeat end repeat URL in try into switch to words https token binfile each tenth as ticks tick system real4 by dateItems without char character ascending eighth whole dateTime numeric short first ftp integer abbreviated abbr abbrev private case while if",constant:"SIX TEN FORMFEED NINE ZERO NONE SPACE FOUR FALSE COLON CRLF PI COMMA ENDOFFILE EOF EIGHT FIVE QUOTE EMPTY ONE TRUE RETURN CR LINEFEED RIGHT BACKSLASH NULL SEVEN TAB THREE TWO six ten formfeed nine zero none space four false colon crlf pi comma endoffile eof eight five quote empty one true return cr linefeed right backslash null seven tab three two RIVERSION RISTATE FILE_READ_MODE FILE_WRITE_MODE FILE_WRITE_MODE DIR_WRITE_MODE FILE_READ_UMASK FILE_WRITE_UMASK DIR_READ_UMASK DIR_WRITE_UMASK",operator:"div mod wrap and or bitAnd bitNot bitOr bitXor among not in a an within contains ends with begins the keys of keys",built_in:"put abs acos aliasReference annuity arrayDecode arrayEncode asin atan atan2 average avg base64Decode base64Encode baseConvert binaryDecode binaryEncode byteToNum cachedURL cachedURLs charToNum cipherNames commandNames compound compress constantNames cos date dateFormat decompress directories diskSpace DNSServers exp exp1 exp2 exp10 extents files flushEvents folders format functionNames global globals hasMemory hostAddress hostAddressToName hostName hostNameToAddress isNumber ISOToMac itemOffset keys len length libURLErrorData libUrlFormData libURLftpCommand libURLLastHTTPHeaders libURLLastRHHeaders libUrlMultipartFormAddPart libUrlMultipartFormData libURLVersion lineOffset ln ln1 localNames log log2 log10 longFilePath lower macToISO matchChunk matchText matrixMultiply max md5Digest median merge millisec millisecs millisecond milliseconds min monthNames num number numToByte numToChar offset open openfiles openProcesses openProcessIDs openSockets paramCount param params peerAddress pendingMessages platform processID random randomBytes replaceText result revCreateXMLTree revCreateXMLTreeFromFile revCurrentRecord revCurrentRecordIsFirst revCurrentRecordIsLast revDatabaseColumnCount revDatabaseColumnIsNull revDatabaseColumnLengths revDatabaseColumnNames revDatabaseColumnNamed revDatabaseColumnNumbered revDatabaseColumnTypes revDatabaseConnectResult revDatabaseCursors revDatabaseID revDatabaseTableNames revDatabaseType revDataFromQuery revdb_closeCursor revdb_columnbynumber revdb_columncount revdb_columnisnull revdb_columnlengths revdb_columnnames revdb_columntypes revdb_commit revdb_connect revdb_connections revdb_connectionerr revdb_currentrecord revdb_cursorconnection revdb_cursorerr revdb_cursors revdb_dbtype revdb_disconnect revdb_execute revdb_iseof revdb_isbof revdb_movefirst revdb_movelast revdb_movenext revdb_moveprev revdb_query revdb_querylist revdb_recordcount revdb_rollback revdb_tablenames revGetDatabaseDriverPath revNumberOfRecords revOpenDatabase revOpenDatabases revQueryDatabase revQueryDatabaseBlob revQueryResult revQueryIsAtStart revQueryIsAtEnd revUnixFromMacPath revXMLAttribute revXMLAttributes revXMLAttributeValues revXMLChildContents revXMLChildNames revXMLFirstChild revXMLMatchingNode revXMLNextSibling revXMLNodeContents revXMLNumberOfChildren revXMLParent revXMLPreviousSibling revXMLRootNode revXMLRPC_CreateRequest revXMLRPC_Documents revXMLRPC_Error revXMLRPC_Execute revXMLRPC_GetHost revXMLRPC_GetMethod revXMLRPC_GetParam revXMLText revXMLRPC_GetParamCount revXMLRPC_GetParamNode revXMLRPC_GetParamType revXMLRPC_GetPath revXMLRPC_GetPort revXMLRPC_GetProtocol revXMLRPC_GetRequest revXMLRPC_GetResponse revXMLRPC_GetSocket revXMLTree revXMLTrees revXMLValidateDTD revZipDescribeItem revZipEnumerateItems revZipOpenArchives round sec secs seconds sha1Digest shell shortFilePath sin specialFolderPath sqrt standardDeviation statRound stdDev sum sysError systemVersion tan tempName tick ticks time to toLower toUpper transpose trunc uniDecode uniEncode upper URLDecode URLEncode URLStatus value variableNames version waitDepth weekdayNames wordOffset add breakpoint cancel clear local variable file word line folder directory URL close socket process combine constant convert create new alias folder directory decrypt delete variable word line folder directory URL dispatch divide do encrypt filter get include intersect kill libURLDownloadToFile libURLFollowHttpRedirects libURLftpUpload libURLftpUploadFile libURLresetAll libUrlSetAuthCallback libURLSetCustomHTTPHeaders libUrlSetExpect100 libURLSetFTPListCommand libURLSetFTPMode libURLSetFTPStopTime libURLSetStatusCallback load multiply socket process post seek rel relative read from process rename replace require resetAll revAddXMLNode revAppendXML revCloseCursor revCloseDatabase revCommitDatabase revCopyFile revCopyFolder revCopyXMLNode revDeleteFolder revDeleteXMLNode revDeleteAllXMLTrees revDeleteXMLTree revExecuteSQL revGoURL revInsertXMLNode revMoveFolder revMoveToFirstRecord revMoveToLastRecord revMoveToNextRecord revMoveToPreviousRecord revMoveToRecord revMoveXMLNode revPutIntoXMLNode revRollBackDatabase revSetDatabaseDriverPath revSetXMLAttribute revXMLRPC_AddParam revXMLRPC_DeleteAllDocuments revXMLAddDTD revXMLRPC_Free revXMLRPC_FreeAll revXMLRPC_DeleteDocument revXMLRPC_DeleteParam revXMLRPC_SetHost revXMLRPC_SetMethod revXMLRPC_SetPort revXMLRPC_SetProtocol revXMLRPC_SetSocket revZipAddItemWithData revZipAddItemWithFile revZipAddUncompressedItemWithData revZipAddUncompressedItemWithFile revZipCancel revZipCloseArchive revZipDeleteItem revZipExtractItemToFile revZipExtractItemToVariable revZipSetProgressCallback revZipRenameItem revZipReplaceItemWithData revZipReplaceItemWithFile revZipOpenArchive send set sort split subtract union unload wait write"},c:[f,{cN:"keyword",b:"\\bend\\sif\\b"},{cN:"function",bWK:true,e:"$",k:"function",c:[f,{cN:"title",b:"\\b([A-Za-z0-9_\\-]+)\\b"}].concat(b).concat(c).concat(e)},{cN:"function",bWK:true,e:"$",k:"end",c:[{cN:"title",b:"\\b([A-Za-z0-9_\\-]+)\\b"}].concat(e)},{cN:"command",bWK:true,e:"$",k:"command on",c:[f,{cN:"title",b:"\\b([A-Za-z0-9_\\-]+)\\b"}].concat(b).concat(c).concat(e)},{cN:"command",bWK:true,e:"$",k:"end",c:[{cN:"title",b:"\\b([A-Za-z0-9_\\-]+)\\b"}].concat(e)},{cN:"preprocessor",b:"<\\?rev|<\\?lc|<\\?livecode",r:10},{cN:"preprocessor",b:"<\\?"},{cN:"preprocessor",b:"\\?>"}].concat(d).concat(b).concat(c).concat(e),i:";$|^\\[|^="}}(hljs);hljs.LANGUAGES.d=function(x){var b={keyword:"abstract alias align asm assert auto body break byte case cast catch class const continue debug default delete deprecated do else enum export extern final finally for foreach foreach_reverse|10 goto if immutable import in inout int interface invariant is lazy macro mixin module new nothrow out override package pragma private protected public pure ref return scope shared static struct super switch synchronized template this throw try typedef typeid typeof union unittest version void volatile while with __FILE__ __LINE__ __gshared|10 __thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__",built_in:"bool cdouble cent cfloat char creal dchar delegate double dstring float function idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar wstring",literal:"false null true"};var c="(0|[1-9][\\d_]*)",q="(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)",h="0[bB][01_]+",v="([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)",y="0[xX]"+v,p="([eE][+-]?"+q+")",o="("+q+"(\\.\\d*|"+p+")|\\d+\\."+q+q+"|\\."+c+p+"?)",k="(0[xX]("+v+"\\."+v+"|\\.?"+v+")[pP][+-]?"+q+")",l="("+c+"|"+h+"|"+y+")",n="("+k+"|"+o+")";var z="\\\\(['\"\\?\\\\abfnrtv]|u[\\dA-Fa-f]{4}|[0-7]{1,3}|x[\\dA-Fa-f]{2}|U[\\dA-Fa-f]{8})|&[a-zA-Z\\d]{2,};";var m={cN:"number",b:"\\b"+l+"(L|u|U|Lu|LU|uL|UL)?",r:0};var j={cN:"number",b:"\\b("+n+"([fF]|L|i|[fF]i|Li)?|"+l+"(i|[fF]i|Li))",r:0};var s={cN:"string",b:"'("+z+"|.)",e:"'",i:"."};var r={b:z,r:0};var w={cN:"string",b:'"',c:[r],e:'"[cwd]?',r:0};var f={cN:"string",b:'[rq]"',e:'"[cwd]?',r:5};var u={cN:"string",b:"`",e:"`[cwd]?"};var i={cN:"string",b:'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',r:10};var t={cN:"string",b:'q"\\{',e:'\\}"'};var e={cN:"shebang",b:"^#!",e:"$",r:5};var g={cN:"preprocessor",b:"#(line)",e:"$",r:5};var d={cN:"keyword",b:"@[a-zA-Z_][a-zA-Z_\\d]*"};var a={cN:"comment",b:"\\/\\+",c:["self"],e:"\\+\\/",r:10};return{l:x.UIR,k:b,c:[x.CLCM,x.CBLCLM,a,i,w,f,u,t,j,m,s,e,g,d]}}(hljs);hljs.LANGUAGES.vbnet=function(a){return{cI:true,k:{keyword:"addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass namespace narrowing new next not notinheritable notoverridable of off on operator option optional or order orelse overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim rem removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly xor",built_in:"boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype date decimal directcast double gettype getxmlnamespace iif integer long object sbyte short single string trycast typeof uinteger ulong ushort",literal:"true false nothing"},i:"//|{|}|endif|gosub|variant|wend",c:[a.inherit(a.QSM,{c:[{b:'""'}]}),{cN:"comment",b:"'",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"'''|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"},]},a.CNM,{cN:"preprocessor",b:"#",e:"$",k:"if else elseif end region externalsource"},]}}(hljs);hljs.LANGUAGES.axapta=function(a){return{k:"false int abstract private char boolean static null if for true while long throw finally protected final return void enum else break new catch byte super case short default double public try this switch continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count order group by asc desc index hint like dispaly edit client server ttsbegin ttscommit str real date container anytype common div mod",c:[a.CLCM,a.CBLCLM,a.ASM,a.QSM,a.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"class",bWK:true,e:"{",i:":",k:"class interface",c:[{cN:"inheritance",bWK:true,k:"extends implements",r:10},{cN:"title",b:a.UIR}]}]}}(hljs);hljs.LANGUAGES.perl=function(e){var a="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var d={cN:"subst",b:"[$@]\\{",e:"\\}",k:a,r:10};var b={cN:"variable",b:"\\$\\d"};var i={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var f=[e.BE,d,b,i];var h={b:"->",c:[{b:e.IR},{b:"{",e:"}"}]};var g={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var c=[b,i,e.HCM,g,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},h,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[e.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[e.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"("+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,g,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bWK:true,e:"(\\s*\\(.*?\\))?[;{]",k:"sub",r:5},{cN:"operator",b:"-\\w\\b",r:0}];d.c=c;h.c[1].c=c;return{k:a,c:c}}(hljs);hljs.LANGUAGES.scala=function(a){var c={cN:"annotation",b:"@[A-Za-z]+"};var b={cN:"string",b:'u?r?"""',e:'"""',r:10};return{k:"type yield lazy override def with val var false true sealed abstract private trait object null if for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},a.CLCM,a.CBLCLM,b,a.ASM,a.QSM,{cN:"class",b:"((case )?class |object |trait )",e:"({|$)",i:":",k:"case class trait object",c:[{bWK:true,k:"extends with",r:10},{cN:"title",b:a.UIR},{cN:"params",b:"\\(",e:"\\)",c:[a.ASM,a.QSM,b,c]}]},a.CNM,c]}}(hljs);hljs.LANGUAGES.cmake=function(a){return{cI:true,k:{keyword:"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_minimum_required cmake_policy configure_file create_test_sourcelist define_property else elseif enable_language enable_testing endforeach endfunction endif endmacro endwhile execute_process export find_file find_library find_package find_path find_program fltk_wrap_ui foreach function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property if include include_directories include_external_msproject include_regular_expression install link_directories load_cache load_command macro mark_as_advanced message option output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_link_libraries try_compile try_run unset variable_watch while build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or",operator:"equal less greater strless strgreater strequal matches"},c:[{cN:"envvar",b:"\\${",e:"}"},a.HCM,a.QSM,a.NM]}}(hljs);hljs.LANGUAGES.ocaml=function(a){return{k:{keyword:"and as assert asr begin class constraint do done downto else end exception external false for fun function functor if in include inherit initializer land lazy let lor lsl lsr lxor match method mod module mutable new object of open or private rec ref sig struct then to true try type val virtual when while with parser value",built_in:"bool char float int list unit array exn option int32 int64 nativeint format4 format6 lazy_t in_channel out_channel string",},i:/\/\//,c:[{cN:"string",b:'"""',e:'"""'},{cN:"comment",b:"\\(\\*",e:"\\*\\)",c:["self"]},{cN:"class",bWK:true,e:"\\(|=|$",k:"type",c:[{cN:"title",b:a.UIR}]},{cN:"annotation",b:"\\[<",e:">\\]"},a.CBLCLM,a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),a.CNM]}}(hljs);hljs.LANGUAGES.objectivec=function(a){var b={keyword:"int float while private char catch export sizeof typedef const struct for union unsigned long volatile static protected bool mutable if public do return goto void enum else break extern asm case short default double throw register explicit signed typename try this switch continue wchar_t inline readonly assign property self synchronized end synthesize id optional required nonatomic super unichar finally dynamic IBOutlet IBAction selector strong weak readonly",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController UINavigationBar UINavigationController UITabBarController UIPopoverController UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor UIFont UIApplication NSNotFound NSNotificationCenter NSNotification UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection UIInterfaceOrientation MPMoviePlayerController dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"};return{k:b,i:"</",c:[a.CLCM,a.CBLCLM,a.CNM,a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"preprocessor",b:"#import",e:"$",c:[{cN:"title",b:'"',e:'"'},{cN:"title",b:"<",e:">"}]},{cN:"preprocessor",b:"#",e:"$"},{cN:"class",bWK:true,e:"({|$)",k:"interface class protocol implementation",c:[{cN:"id",b:a.UIR}]},{cN:"variable",b:"\\."+a.UIR,r:0}]}}(hljs);hljs.LANGUAGES.avrasm=function(a){return{cI:true,k:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf"},c:[a.CBLCLM,{cN:"comment",b:";",e:"$"},a.CNM,a.BNM,{cN:"number",b:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"label",b:"^[A-Za-z0-9_.$]+:"},{cN:"preprocessor",b:"#",e:"$"},{cN:"preprocessor",b:"\\.[a-zA-Z]+"},{cN:"localvars",b:"@[0-9]+"}]}}(hljs);hljs.LANGUAGES.vhdl=function(a){return{cI:true,k:{keyword:"abs access after alias all and architecture array assert attribute begin block body buffer bus case component configuration constant context cover disconnect downto default else elsif end entity exit fairness file for force function generate generic group guarded if impure in inertial inout is label library linkage literal loop map mod nand new next nor not null of on open or others out package port postponed procedure process property protected pure range record register reject release rem report restrict restrict_guarantee return rol ror select sequence severity shared signal sla sll sra srl strong subtype then to transport type unaffected units until use variable vmode vprop vunit wait when while with xnor xor",typename:"boolean bit character severity_level integer time delay_length natural positive string bit_vector file_open_kind file_open_status std_ulogic std_ulogic_vector std_logic std_logic_vector unsigned signed boolean_vector integer_vector real_vector time_vector"},i:"{",c:[a.CBLCLM,{cN:"comment",b:"--",e:"$"},a.QSM,a.CNM,{cN:"literal",b:"'(U|X|0|1|Z|W|L|H|-)'",c:[a.BE]},{cN:"attribute",b:"'[A-Za-z](_?[A-Za-z0-9])*",c:[a.BE]}]}}(hljs);hljs.LANGUAGES.coffeescript=function(c){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module exports global window document"};var a="[A-Za-z$_][0-9A-Za-z$_]*";var f={cN:"title",b:a};var e={cN:"subst",b:"#\\{",e:"}",k:b,};var d=[c.BNM,c.inherit(c.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",b:"'''",e:"'''",c:[c.BE]},{cN:"string",b:"'",e:"'",c:[c.BE],r:0},{cN:"string",b:'"""',e:'"""',c:[c.BE,e]},{cN:"string",b:'"',e:'"',c:[c.BE,e],r:0},{cN:"regexp",b:"///",e:"///",c:[c.HCM]},{cN:"regexp",b:"//[gim]*",r:0},{cN:"regexp",b:"/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"},{cN:"property",b:"@"+a},{b:"`",e:"`",eB:true,eE:true,sL:"javascript"}];e.c=d;return{k:b,c:d.concat([{cN:"comment",b:"###",e:"###"},c.HCM,{cN:"function",b:"("+a+"\\s*=\\s*)?(\\(.*\\))?\\s*[-=]>",e:"[-=]>",rB:true,c:[f,{cN:"params",b:"\\(",rB:true,c:[{b:/\(/,e:/\)/,k:b,c:["self"].concat(d)}]}]},{cN:"class",bWK:true,k:"class",e:"$",i:"[:\\[\\]]",c:[{bWK:true,k:"extends",eW:true,i:":",c:[f]},f]},{cN:"attribute",b:a+":",e:":",rB:true,eE:true}])}}(hljs);hljs.LANGUAGES.mizar=function(a){return{k:["environ vocabularies notations constructors definitions registrations theorems schemes requirements","begin end definition registration cluster existence pred func defpred deffunc theorem proof","let take assume then thus hence ex for st holds consider reconsider such that and in provided of as from","be being by means equals implies iff redefine define now not or attr is mode suppose per cases set","thesis contradiction scheme reserve struct","correctness compatibility coherence symmetry assymetry reflexivity irreflexivity","connectedness uniqueness commutativity idempotence involutiveness projectivity"].join(" "),c:[{cN:"comment",b:"::",e:"$"}]}}(hljs);hljs.LANGUAGES.nginx=function(b){var c=[{cN:"variable",b:"\\$\\d+"},{cN:"variable",b:"\\${",e:"}"},{cN:"variable",b:"[\\$\\@]"+b.UIR}];var a={eW:true,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[b.HCM,{cN:"string",b:'"',e:'"',c:[b.BE].concat(c),r:0},{cN:"string",b:"'",e:"'",c:[b.BE].concat(c),r:0},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:true,eE:true},{cN:"regexp",b:"\\s\\^",e:"\\s|{|;",rE:true,c:[b.BE].concat(c)},{cN:"regexp",b:"~\\*?\\s+",e:"\\s|{|;",rE:true,c:[b.BE].concat(c)},{cN:"regexp",b:"\\*(\\.[a-z\\-]+)+",c:[b.BE].concat(c)},{cN:"regexp",b:"([a-z\\-]+\\.)+\\*",c:[b.BE].concat(c)},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0}].concat(c)};return{c:[b.HCM,{b:b.UIR+"\\s",e:";|{",rB:true,c:[{cN:"title",b:b.UIR,starts:a}],r:0}],i:"[^\\s\\}]"}}(hljs);hljs.LANGUAGES["erlang-repl"]=function(a){return{k:{special_functions:"spawn spawn_link self",reserved:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},c:[{cN:"prompt",b:"^[0-9]+> ",r:10},{cN:"comment",b:"%",e:"$"},{cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},a.ASM,a.QSM,{cN:"constant",b:"\\?(::)?([A-Z]\\w*(::)?)+"},{cN:"arrow",b:"->"},{cN:"ok",b:"ok"},{cN:"exclamation_mark",b:"!"},{cN:"function_or_atom",b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{cN:"variable",b:"[A-Z][a-zA-Z0-9_']*",r:0}]}}(hljs);hljs.LANGUAGES.r=function(a){var b="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[a.HCM,{b:b,l:b,k:{keyword:"function if in break next repeat else for return switch while try tryCatch|10 stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...|10",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",b:'"',e:'"',c:[a.BE],r:0},{cN:"string",b:"'",e:"'",c:[a.BE],r:0}]}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);hljs.LANGUAGES.django=function(a){var b={cN:"filter",b:/\|[A-Za-z]+\:?/,k:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone",c:[{cN:"argument",b:/"/,e:/"/},{cN:"argument",b:/'/,e:/'/}]};return{cI:true,sL:"xml",subLanguageMode:"continuous",c:[{cN:"template_comment",b:/{%\s*comment\s*%}/,e:/{%\s*endcomment\s*%}/},{cN:"template_comment",b:/{#/,e:/#}/},{cN:"template_tag",b:/{%/,e:/%}/,k:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor in ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup by as ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim",c:[b]},{cN:"variable",b:/{{/,e:/}}/,c:[b]}]}}(hljs);hljs.LANGUAGES.delphi=function(b){var f="and safecall cdecl then string exports library not pascal set virtual file in array label packed end. index while const raise for to implementation with except overload destructor downto finally program exit unit inherited override if type until function do begin repeat goto nil far initialization object else var uses external resourcestring interface end finalization class asm mod case on shr shl of register xorwrite threadvar try record near stored constructor stdcall inline div out or procedure";var e="safecall stdcall pascal stored const implementation finalization except to finally program inherited override then exports string read not mod shr try div shl set library message packed index for near overload label downto exit public goto interface asm on of constructor or private array unit raise destructor var type until function else external with case default record while protected property procedure published and cdecl do threadvar file in if end virtual write far out begin repeat nil initialization object uses resourcestring class register xorwrite inline static";var a={cN:"comment",b:"{",e:"}",r:0};var g={cN:"comment",b:"\\(\\*",e:"\\*\\)",r:10};var c={cN:"string",b:"'",e:"'",c:[{b:"''"}],r:0};var d={cN:"string",b:"(#\\d+)+"};var h={cN:"function",bWK:true,e:"[:;]",k:"function constructor|10 destructor|10 procedure|10",c:[{cN:"title",b:b.IR},{cN:"params",b:"\\(",e:"\\)",k:f,c:[c,d]},a,g]};return{cI:true,k:f,i:'("|\\$[G-Zg-z]|\\/\\*|</)',c:[a,g,b.CLCM,c,d,b.NM,h,{cN:"class",b:"=\\bclass\\b",e:"end;",k:e,c:[c,d,a,g,b.CLCM,h]}]}}(hljs);hljs.LANGUAGES.vbscript=function(a){return{cI:true,k:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},i:"//",c:[a.inherit(a.QSM,{c:[{b:'""'}]}),{cN:"comment",b:"'",e:"$"},a.CNM]}}(hljs);hljs.LANGUAGES.mel=function(a){return{k:"int float string vector matrix if else switch case default while do for in break continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor animDisplay animView annotate appendStringArray applicationName applyAttrPreset applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem componentEditor compositingInterop computePolysetVolume condition cone confirmDialog connectAttr connectControl connectDynamic connectJoint connectionInfo constrain constrainValue constructionHistory container containsMultibyte contextInfo control convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse currentCtx currentTime currentTimeCtx currentUnit currentUnit curve curveAddPtCtx curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected displayColor displayCull displayLevelOfDetail displayPref displayRGBColor displaySmoothness displayStats displayString displaySurface distanceDimContext distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor editorTemplate effector emit emitter enableDevice encodeString endString endsWith env equivalent equivalentTol erf error eval eval evalDeferred evalEcho event exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo filetest filletCurve filter filterCurve filterExpand filterStudioImport findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss geometryConstraint getApplicationVersionAsFloat getAttr getClassification getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation listNodeTypes listPanelCategories listRelatives listSets listTransforms listUnselected listerEditor loadFluid loadNewShelf loadPlugin loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration panelHistory paramDimContext paramDimension paramLocator parent parentConstraint particle particleExists particleInstancer particleRenderInfo partition pasteKey pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE registerPluginResource rehash reloadImage removeJoint removeMultiInstance removePanelCategory rename renameAttr renameSelectionList renameUI render renderGlobalsNode renderInfo renderLayerButton renderLayerParent renderLayerPostProcess renderLayerUnparent renderManip renderPartition renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor renderWindowSelectContext renderer reorder reorderDeformers requires reroot resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType selectedNodes selectionConnection separator setAttr setAttrEnumResource setAttrMapping setAttrNiceNameResource setConstraintRestPosition setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField shortNameOf showHelp showHidden showManipCtx showSelectionInTitle showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString stringToStringArray strip stripPrefixFromName stroke subdAutoProjection subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList textToShelf textureDisplacePlane textureHairColor texturePlacementContext textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper trace track trackCtx transferAttributes transformCompare transformLimits translator trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform",i:"</",c:[a.CNM,a.ASM,a.QSM,{cN:"string",b:"`",e:"`",c:[a.BE]},{cN:"variable",b:"\\$\\d",r:5},{cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+|[^\\s\\w{]|{\\w+}|\\w+)"},a.CLCM,a.CBLCLM]}}(hljs);hljs.LANGUAGES.dos=function(a){return{cI:true,k:{flow:"if else goto for in do call exit not exist errorlevel defined equ neq lss leq gtr geq",keyword:"shift cd dir echo setlocal endlocal set pause copy",stream:"prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux",winutils:"ping net ipconfig taskkill xcopy ren del"},c:[{cN:"envvar",b:"%%[^ ]"},{cN:"envvar",b:"%[^ ]+?%"},{cN:"envvar",b:"![^ ]+?!"},{cN:"number",b:"\\b\\d+",r:0},{cN:"comment",b:"@?rem",e:"$"}]}}(hljs);hljs.LANGUAGES.apache=function(a){var b={cN:"number",b:"[\\$%]\\d+"};return{cI:true,c:[a.HCM,{cN:"tag",b:"</?",e:">"},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",b]},b,a.QSM]}}],i:/\S/}}(hljs);hljs.LANGUAGES.scss=function(a){var c="[a-zA-Z-][a-zA-Z0-9_-]*";var d={cN:"function",b:c+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]};var b={cN:"hexcolor",b:"#[0-9A-Fa-f]+"};var e={cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[d,b,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"important",b:"!important"}]}};return{cI:true,i:"[=/|']",c:[a.CLCM,a.CBLCLM,{cN:"function",b:c+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]},{cN:"id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{cN:"pseudo",b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{cN:"pseudo",b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{cN:"value",b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{cN:"value",b:":",e:";",c:[b,a.NM,a.QSM,a.ASM,{cN:"important",b:"!important"}]},{cN:"at_rule",b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[d,a.QSM,a.ASM,b,a.NM,{cN:"preprocessor",b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}}(hljs);hljs.LANGUAGES.applescript=function(a){var b=a.inherit(a.QSM,{i:""});var e={cN:"title",b:a.UIR};var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,b]};var c=[{cN:"comment",b:"--",e:"$",},{cN:"comment",b:"\\(\\*",e:"\\*\\)",c:["self",{b:"--",e:"$"}]},a.HCM];return{k:{keyword:"about above after against and around as at back before beginning behind below beneath beside between but by considering contain contains continue copy div does eighth else end equal equals error every exit fifth first for fourth from front get given global if ignoring in into is it its last local me middle mod my ninth not of on onto or over prop property put ref reference repeat returning script second set seventh since sixth some tell tenth that the then third through thru timeout times to transaction try until where while whose with without",constant:"AppleScript false linefeed return pi quote result space tab true",type:"alias application boolean class constant date file integer list number real record string text",command:"activate beep count delay launch log offset read round run say summarize write",property:"character characters contents day frontmost id item length month name paragraph paragraphs rest reverse running time version weekday word words year"},c:[b,a.CNM,{cN:"type",b:"\\bPOSIX file\\b"},{cN:"command",b:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{cN:"constant",b:"\\b(text item delimiters|current application|missing value)\\b"},{cN:"keyword",b:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\b"},{cN:"property",b:"\\b(POSIX path|(date|time) string|quoted form)\\b"},{cN:"function_start",bWK:true,k:"on",i:"[${=;\\n]",c:[e,d]}].concat(c),i:"//"}}(hljs);hljs.LANGUAGES.lasso=function(d){var b="[a-zA-Z_][a-zA-Z0-9_.]*";var i="<\\?(lasso(script)?|=)";var c="\\]|\\?>";var g={literal:"true false none minimal full all void and or not bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null bytes list queue set stack staticarray tie local var variable global data self inherited",keyword:"error_code error_msg error_pop error_push error_reset cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"};var a={cN:"comment",b:"<!--",e:"-->",r:0};var j={cN:"preprocessor",b:"\\[noprocess\\]",starts:{cN:"markup",e:"\\[/noprocess\\]",rE:true,c:[a]}};var e={cN:"preprocessor",b:"\\[/noprocess|"+i};var h={cN:"variable",b:"'"+b+"'"};var f=[d.CLCM,{cN:"javadoc",b:"/\\*\\*!",e:"\\*/"},d.CBLCLM,d.inherit(d.CNM,{b:d.CNR+"|-?(infinity|nan)\\b"}),d.inherit(d.ASM,{i:null}),d.inherit(d.QSM,{i:null}),{cN:"string",b:"`",e:"`"},{cN:"variable",b:"[#$]"+b},{cN:"variable",b:"#",e:"\\d+",i:"\\W"},{cN:"tag",b:"::\\s*",e:b,i:"\\W"},{cN:"attribute",b:"\\.\\.\\.|-"+d.UIR},{cN:"subst",b:"->\\s*",c:[h]},{cN:"subst",b:":=|[-+*/%=<>&|!?\\\\]+",r:0},{cN:"built_in",b:"\\.\\.?",r:0,c:[h]},{cN:"class",bWK:true,k:"define",rE:true,e:"\\(|=>",c:[{cN:"title",b:d.UIR+"(=(?!>))?"}]}];return{cI:true,l:b+"|&[lg]t;",k:g,c:[{cN:"preprocessor",b:c,r:0,starts:{cN:"markup",e:"\\[|"+i,rE:true,c:[a]}},j,e,{cN:"preprocessor",b:"\\[no_square_brackets",starts:{e:"\\[/no_square_brackets\\]",l:b+"|&[lg]t;",k:g,c:[{cN:"preprocessor",b:c,r:0,starts:{cN:"markup",e:i,rE:true,c:[a]}},j,e].concat(f)}},{cN:"preprocessor",b:"\\[",r:0},{cN:"shebang",b:"^#!.+lasso9\\b",r:10}].concat(f)}}(hljs);hljs.LANGUAGES.cpp=function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr"};return{k:b,i:"</",c:[a.CLCM,a.CBLCLM,a.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},a.CNM,{cN:"preprocessor",b:"#",e:"$",c:[{b:"<",e:">",i:"\\n"},a.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10,c:["self"]}]}}(hljs);hljs.LANGUAGES.matlab=function(a){var b=[a.CNM,{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}],r:0}];return{k:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},i:'(//|"|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bWK:true,e:"$",k:"function",c:[{cN:"title",b:a.UIR},{cN:"params",b:"\\(",e:"\\)"},{cN:"params",b:"\\[",e:"\\]"}]},{cN:"transposed_variable",b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:""},{cN:"matrix",b:"\\[",e:"\\]'*[\\.']*",c:b},{cN:"cell",b:"\\{",e:"\\}'*[\\.']*",c:b},{cN:"comment",b:"\\%",e:"$"}].concat(b)}}(hljs);hljs.LANGUAGES.scilab=function(a){var b=[a.CNM,{cN:"string",b:"'|\"",e:"'|\"",c:[a.BE,{b:"''"}],r:0}];return{k:{keyword:"abort break case clear catch continue do elseif else endfunction end for functionglobal if pause return resume select try then while%f %F %t %T %pi %eps %inf %nan %e %i %z %s",built_in:"abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp errorexec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isemptyisinfisnan isvector lasterror length load linspace list listfiles log10 log2 logmax min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand realround sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tantype typename warning zeros matrix"},i:'("|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bWK:true,e:"$",k:"function endfunction|10",c:[{cN:"title",b:a.UIR},{cN:"params",b:"\\(",e:"\\)"},],},{cN:"transposed_variable",b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:""},{cN:"matrix",b:"\\[",e:"\\]'*[\\.']*",c:b},{cN:"comment",b:"//",e:"$"}].concat(b)}}(hljs);hljs.LANGUAGES.makefile=function(a){var b={cN:"variable",b:/\$\(/,e:/\)/,c:a.BE};return{c:[a.HCM,{b:/^\w+\s*\W*=/,rB:true,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:true,starts:{e:/$/,r:0,c:[b],}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,c:[a.QSM,b]}]}}(hljs);hljs.LANGUAGES.asciidoc=function(a){return{c:[{cN:"comment",b:"^/{4,}\\n",e:"\\n/{4,}$",r:10},{cN:"comment",b:"^//",e:"$",r:0},{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"header",b:"^(={1,5}) .+?( \\1)?$",r:10},{cN:"header",b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$",r:10},{cN:"attribute",b:"^:.+?:",e:"\\s",eE:true,r:10},{cN:"attribute",b:"^\\[.+?\\]$",r:0},{cN:"blockquote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"label",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"smartquote",b:"``.+?''",r:10},{cN:"smartquote",b:"`.+?'",r:10},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{cN:"horizontal_rule",b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:true,c:[{b:"(link|image:?):",r:0},{cN:"link_url",b:"\\w",e:"[^\\[]+",r:0},{cN:"link_label",b:"\\[",e:"\\]",eB:true,eE:true,r:0}],r:10}]}}(hljs);hljs.LANGUAGES.parser3=function(a){return{sL:"xml",r:0,c:[{cN:"comment",b:"^#",e:"$"},{cN:"comment",b:"\\^rem{",e:"}",r:10,c:[{b:"{",e:"}",c:["self"]}]},{cN:"preprocessor",b:"^@(?:BASE|USE|CLASS|OPTIONS)$",r:10},{cN:"title",b:"@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$"},{cN:"variable",b:"\\$\\{?[\\w\\-\\.\\:]+\\}?"},{cN:"keyword",b:"\\^[\\w\\-\\.\\:]+"},{cN:"number",b:"\\^#[0-9a-fA-F]+"},a.CNM]}}(hljs);hljs.LANGUAGES.clojure=function(l){var e={built_in:"def cond apply if-not if-let if not not= = &lt; < > &lt;= <= >= == + / * - rem quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last drop-while while intern condp case reduced cycle split-at split-with repeat replicate iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter monitor-exit defmacro defn defn- macroexpand macroexpand-1 for doseq dosync dotimes and or when when-not when-let comp juxt partial sequence memoize constantly complement identity assert peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import intern refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! assoc! dissoc! pop! disj! import use class type num float double short byte boolean bigint biginteger bigdec print-method print-dup throw-if throw printf format load compile get-in update-in pr pr-on newline flush read slurp read-line subvec with-open memfn time ns assert re-find re-groups rand-int rand mod locking assert-valid-fdecl alias namespace resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! new next conj set! memfn to-array future future-call into-array aset gen-class reduce merge map filter find empty hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize"};var f="[a-zA-Z_0-9\\!\\.\\?\\-\\+\\*\\/\\<\\=\\>\\&\\#\\$';]+";var a="[\\s:\\(\\{]+\\d+(\\.\\d+)?";var d={cN:"number",b:a,r:0};var j={cN:"string",b:'"',e:'"',c:[l.BE],r:0};var o={cN:"comment",b:";",e:"$",r:0};var n={cN:"collection",b:"[\\[\\{]",e:"[\\]\\}]"};var c={cN:"comment",b:"\\^"+f};var b={cN:"comment",b:"\\^\\{",e:"\\}"};var h={cN:"attribute",b:"[:]"+f};var m={cN:"list",b:"\\(",e:"\\)"};var g={eW:true,k:{literal:"true false nil"},r:0};var i={k:e,l:f,cN:"title",b:f,starts:g};m.c=[{cN:"comment",b:"comment"},i,g];g.c=[m,j,c,b,o,h,n,d];n.c=[m,j,c,o,h,n,d];return{i:/\S/,c:[o,m]}}(hljs);hljs.LANGUAGES.go=function(a){var b={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer",constant:"true false iota nil",typename:"bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{k:b,i:"</",c:[a.CLCM,a.CBLCLM,a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"string",b:"`",e:"`"},{cN:"number",b:"[^a-zA-Z_0-9](\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?",r:0},a.CNM]}}(hljs);
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/arta.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/arta.css
deleted file mode 100644
index e224db8753..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/arta.css
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-Date: 17.V.2011
-Author: pumbur <[email protected]>
-*/
-
-pre code
-{
- display: block; padding: 0.5em;
- background: #222;
-}
-
-pre .profile .header *,
-pre .ini .title,
-pre .nginx .title
-{
- color: #fff;
-}
-
-pre .comment,
-pre .javadoc,
-pre .preprocessor,
-pre .preprocessor .title,
-pre .pragma,
-pre .shebang,
-pre .profile .summary,
-pre .diff,
-pre .pi,
-pre .doctype,
-pre .tag,
-pre .template_comment,
-pre .css .rules,
-pre .tex .special
-{
- color: #444;
-}
-
-pre .string,
-pre .symbol,
-pre .diff .change,
-pre .regexp,
-pre .xml .attribute,
-pre .smalltalk .char,
-pre .xml .value,
-pre .ini .value,
-pre .clojure .attribute,
-pre .coffeescript .attribute
-{
- color: #ffcc33;
-}
-
-pre .number,
-pre .addition
-{
- color: #00cc66;
-}
-
-pre .built_in,
-pre .literal,
-pre .vhdl .typename,
-pre .go .constant,
-pre .go .typename,
-pre .ini .keyword,
-pre .lua .title,
-pre .perl .variable,
-pre .php .variable,
-pre .mel .variable,
-pre .django .variable,
-pre .css .funtion,
-pre .smalltalk .method,
-pre .hexcolor,
-pre .important,
-pre .flow,
-pre .inheritance,
-pre .parser3 .variable
-{
- color: #32AAEE;
-}
-
-pre .keyword,
-pre .tag .title,
-pre .css .tag,
-pre .css .class,
-pre .css .id,
-pre .css .pseudo,
-pre .css .attr_selector,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .winutils,
-pre .tex .command,
-pre .request,
-pre .status
-{
- color: #6644aa;
-}
-
-pre .title,
-pre .ruby .constant,
-pre .vala .constant,
-pre .parent,
-pre .deletion,
-pre .template_tag,
-pre .css .keyword,
-pre .objectivec .class .id,
-pre .smalltalk .class,
-pre .lisp .keyword,
-pre .apache .tag,
-pre .nginx .variable,
-pre .envvar,
-pre .bash .variable,
-pre .go .built_in,
-pre .vbscript .built_in,
-pre .lua .built_in,
-pre .rsl .built_in,
-pre .tail,
-pre .avrasm .label,
-pre .tex .formula,
-pre .tex .formula *
-{
- color: #bb1166;
-}
-
-pre .yardoctag,
-pre .phpdoc,
-pre .profile .header,
-pre .ini .title,
-pre .apache .tag,
-pre .parser3 .title
-{
- font-weight: bold;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata
-{
- opacity: 0.6;
-}
-
-pre code,
-pre .javascript,
-pre .css,
-pre .xml,
-pre .subst,
-pre .diff .chunk,
-pre .css .value,
-pre .css .attribute,
-pre .lisp .string,
-pre .lisp .number,
-pre .tail .params,
-pre .container,
-pre .haskell *,
-pre .erlang *,
-pre .erlang_repl *
-{
- color: #aaa;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/ascetic.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/ascetic.css
deleted file mode 100644
index 63349b7fc6..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/ascetic.css
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
-Original style from softwaremaniacs.org (c) Ivan Sagalaev <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: white; color: black;
-}
-
-pre .string,
-pre .tag .value,
-pre .filter .argument,
-pre .addition,
-pre .change,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .nginx .built_in,
-pre .tex .formula {
- color: #888;
-}
-
-pre .comment,
-pre .template_comment,
-pre .shebang,
-pre .doctype,
-pre .pi,
-pre .javadoc,
-pre .deletion,
-pre .apache .sqbracket {
- color: #CCC;
-}
-
-pre .keyword,
-pre .tag .title,
-pre .ini .title,
-pre .lisp .title,
-pre .clojure .title,
-pre .http .title,
-pre .nginx .title,
-pre .css .tag,
-pre .winutils,
-pre .flow,
-pre .apache .tag,
-pre .tex .command,
-pre .request,
-pre .status {
- font-weight: bold;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/brown_paper.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/brown_paper.css
deleted file mode 100644
index 46ce452bc2..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/brown_paper.css
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-
-Brown Paper style from goldblog.com.ua (c) Zaripov Yura <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background:#b7a68e url(./brown_papersq.png);
-}
-
-pre .keyword,
-pre .literal,
-pre .change,
-pre .winutils,
-pre .flow,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .nginx .title,
-pre .tex .special,
-pre .request,
-pre .status {
- color:#005599;
- font-weight:bold;
-}
-
-pre code,
-pre .subst,
-pre .tag .keyword {
- color: #363C69;
-}
-
-pre .string,
-pre .title,
-pre .haskell .type,
-pre .tag .value,
-pre .css .rules .value,
-pre .preprocessor,
-pre .pragma,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .ruby .class .parent,
-pre .built_in,
-pre .sql .aggregate,
-pre .django .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .javadoc,
-pre .ruby .string,
-pre .django .filter .argument,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .attr_selector,
-pre .pseudo,
-pre .addition,
-pre .stream,
-pre .envvar,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .tex .number {
- color: #2C009F;
-}
-
-pre .comment,
-pre .java .annotation,
-pre .python .decorator,
-pre .template_comment,
-pre .pi,
-pre .doctype,
-pre .deletion,
-pre .shebang,
-pre .apache .sqbracket,
-pre .nginx .built_in,
-pre .tex .formula {
- color: #802022;
-}
-
-pre .keyword,
-pre .literal,
-pre .css .id,
-pre .phpdoc,
-pre .title,
-pre .haskell .type,
-pre .vbscript .built_in,
-pre .sql .aggregate,
-pre .rsl .built_in,
-pre .smalltalk .class,
-pre .diff .header,
-pre .chunk,
-pre .winutils,
-pre .bash .variable,
-pre .apache .tag,
-pre .tex .command {
- font-weight: bold;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.8;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/brown_papersq.png b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/brown_papersq.png
deleted file mode 100644
index 3813903dbf..0000000000
Binary files a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/brown_papersq.png and /dev/null differ
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/dark.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/dark.css
deleted file mode 100644
index 07fd56e9ae..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/dark.css
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-
-Dark style from softwaremaniacs.org (c) Ivan Sagalaev <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #444;
-}
-
-pre .keyword,
-pre .literal,
-pre .change,
-pre .winutils,
-pre .flow,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .nginx .title,
-pre .tex .special {
- color: white;
-}
-
-pre code,
-pre .subst {
- color: #DDD;
-}
-
-pre .string,
-pre .title,
-pre .haskell .type,
-pre .ini .title,
-pre .tag .value,
-pre .css .rules .value,
-pre .preprocessor,
-pre .pragma,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .ruby .class .parent,
-pre .built_in,
-pre .sql .aggregate,
-pre .django .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .javadoc,
-pre .ruby .string,
-pre .django .filter .argument,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .attr_selector,
-pre .pseudo,
-pre .addition,
-pre .stream,
-pre .envvar,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .tex .command,
-pre .prompt,
-pre .coffeescript .attribute {
- color: #D88;
-}
-
-pre .comment,
-pre .java .annotation,
-pre .python .decorator,
-pre .template_comment,
-pre .pi,
-pre .doctype,
-pre .deletion,
-pre .shebang,
-pre .apache .sqbracket,
-pre .tex .formula {
- color: #777;
-}
-
-pre .keyword,
-pre .literal,
-pre .title,
-pre .css .id,
-pre .phpdoc,
-pre .haskell .type,
-pre .vbscript .built_in,
-pre .sql .aggregate,
-pre .rsl .built_in,
-pre .smalltalk .class,
-pre .diff .header,
-pre .chunk,
-pre .winutils,
-pre .bash .variable,
-pre .apache .tag,
-pre .tex .special,
-pre .request,
-pre .status {
- font-weight: bold;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/default.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/default.css
deleted file mode 100644
index f46bcac35f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/default.css
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
-
-Original style from softwaremaniacs.org (c) Ivan Sagalaev <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #F0F0F0;
-}
-
-pre code,
-pre .subst,
-pre .tag .title,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .nginx .title {
- color: black;
-}
-
-pre .string,
-pre .title,
-pre .constant,
-pre .parent,
-pre .tag .value,
-pre .rules .value,
-pre .rules .value .number,
-pre .preprocessor,
-pre .pragma,
-pre .haml .symbol,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .aggregate,
-pre .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .addition,
-pre .flow,
-pre .stream,
-pre .bash .variable,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .tex .command,
-pre .tex .special,
-pre .erlang_repl .function_or_atom,
-pre .asciidoc .header,
-pre .markdown .header,
-pre .coffeescript .attribute {
- color: #800;
-}
-
-pre .smartquote,
-pre .comment,
-pre .annotation,
-pre .template_comment,
-pre .diff .header,
-pre .chunk,
-pre .asciidoc .blockquote,
-pre .markdown .blockquote {
- color: #888;
-}
-
-pre .number,
-pre .date,
-pre .regexp,
-pre .literal,
-pre .hexcolor,
-pre .smalltalk .symbol,
-pre .smalltalk .char,
-pre .go .constant,
-pre .change,
-pre .lasso .variable,
-pre .makefile .variable,
-pre .asciidoc .bullet,
-pre .markdown .bullet,
-pre .asciidoc .link_url,
-pre .markdown .link_url {
- color: #080;
-}
-
-pre .label,
-pre .javadoc,
-pre .ruby .string,
-pre .decorator,
-pre .filter .argument,
-pre .localvars,
-pre .array,
-pre .attr_selector,
-pre .important,
-pre .pseudo,
-pre .pi,
-pre .haml .bullet,
-pre .doctype,
-pre .deletion,
-pre .envvar,
-pre .shebang,
-pre .apache .sqbracket,
-pre .nginx .built_in,
-pre .tex .formula,
-pre .erlang_repl .reserved,
-pre .prompt,
-pre .asciidoc .link_label,
-pre .markdown .link_label,
-pre .vhdl .attribute,
-pre .clojure .attribute,
-pre .asciidoc .attribute,
-pre .lasso .attribute,
-pre .coffeescript .property,
-pre .makefile .phony {
- color: #88F
-}
-
-pre .keyword,
-pre .id,
-pre .title,
-pre .built_in,
-pre .aggregate,
-pre .css .tag,
-pre .javadoctag,
-pre .phpdoc,
-pre .yardoctag,
-pre .smalltalk .class,
-pre .winutils,
-pre .bash .variable,
-pre .apache .tag,
-pre .go .typename,
-pre .tex .command,
-pre .asciidoc .strong,
-pre .markdown .strong,
-pre .request,
-pre .status {
- font-weight: bold;
-}
-
-pre .asciidoc .emphasis,
-pre .markdown .emphasis {
- font-style: italic;
-}
-
-pre .nginx .built_in {
- font-weight: normal;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .lasso .markup,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/docco.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/docco.css
deleted file mode 100644
index e0b6f8cb57..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/docco.css
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-Docco style used in http://jashkenas.github.com/docco/ converted by Simon Madine (@thingsinjars)
-*/
-
-pre code {
- display: block; padding: 0.5em;
- color: #000;
- background: #f8f8ff
-}
-
-pre .comment,
-pre .template_comment,
-pre .diff .header,
-pre .javadoc {
- color: #408080;
- font-style: italic
-}
-
-pre .keyword,
-pre .assignment,
-pre .literal,
-pre .css .rule .keyword,
-pre .winutils,
-pre .javascript .title,
-pre .lisp .title,
-pre .subst {
- color: #954121;
-}
-
-pre .number,
-pre .hexcolor {
- color: #40a070
-}
-
-pre .string,
-pre .tag .value,
-pre .phpdoc,
-pre .tex .formula {
- color: #219161;
-}
-
-pre .title,
-pre .id {
- color: #19469D;
-}
-pre .params {
- color: #00F;
-}
-
-pre .javascript .title,
-pre .lisp .title,
-pre .subst {
- font-weight: normal
-}
-
-pre .class .title,
-pre .haskell .label,
-pre .tex .command {
- color: #458;
- font-weight: bold
-}
-
-pre .tag,
-pre .tag .title,
-pre .rules .property,
-pre .django .tag .keyword {
- color: #000080;
- font-weight: normal
-}
-
-pre .attribute,
-pre .variable,
-pre .instancevar,
-pre .lisp .body {
- color: #008080
-}
-
-pre .regexp {
- color: #B68
-}
-
-pre .class {
- color: #458;
- font-weight: bold
-}
-
-pre .symbol,
-pre .ruby .symbol .string,
-pre .ruby .symbol .keyword,
-pre .ruby .symbol .keymethods,
-pre .lisp .keyword,
-pre .tex .special,
-pre .input_number {
- color: #990073
-}
-
-pre .builtin,
-pre .constructor,
-pre .built_in,
-pre .lisp .title {
- color: #0086b3
-}
-
-pre .preprocessor,
-pre .pragma,
-pre .pi,
-pre .doctype,
-pre .shebang,
-pre .cdata {
- color: #999;
- font-weight: bold
-}
-
-pre .deletion {
- background: #fdd
-}
-
-pre .addition {
- background: #dfd
-}
-
-pre .diff .change {
- background: #0086b3
-}
-
-pre .chunk {
- color: #aaa
-}
-
-pre .tex .formula {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/far.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/far.css
deleted file mode 100644
index 728c2df09e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/far.css
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-FAR Style (c) MajestiC <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #000080;
-}
-
-pre code,
-pre .subst {
- color: #0FF;
-}
-
-pre .string,
-pre .ruby .string,
-pre .haskell .type,
-pre .tag .value,
-pre .css .rules .value,
-pre .css .rules .value .number,
-pre .preprocessor,
-pre .pragma,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .built_in,
-pre .sql .aggregate,
-pre .django .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .addition,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .tex .command,
-pre .clojure .title,
-pre .coffeescript .attribute {
- color: #FF0;
-}
-
-pre .keyword,
-pre .css .id,
-pre .title,
-pre .haskell .type,
-pre .vbscript .built_in,
-pre .sql .aggregate,
-pre .rsl .built_in,
-pre .smalltalk .class,
-pre .xml .tag .title,
-pre .winutils,
-pre .flow,
-pre .change,
-pre .envvar,
-pre .bash .variable,
-pre .tex .special,
-pre .clojure .built_in {
- color: #FFF;
-}
-
-pre .comment,
-pre .phpdoc,
-pre .javadoc,
-pre .java .annotation,
-pre .template_comment,
-pre .deletion,
-pre .apache .sqbracket,
-pre .tex .formula {
- color: #888;
-}
-
-pre .number,
-pre .date,
-pre .regexp,
-pre .literal,
-pre .smalltalk .symbol,
-pre .smalltalk .char,
-pre .clojure .attribute {
- color: #0F0;
-}
-
-pre .python .decorator,
-pre .django .filter .argument,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .attr_selector,
-pre .pseudo,
-pre .xml .pi,
-pre .diff .header,
-pre .chunk,
-pre .shebang,
-pre .nginx .built_in,
-pre .prompt {
- color: #008080;
-}
-
-pre .keyword,
-pre .css .id,
-pre .title,
-pre .haskell .type,
-pre .vbscript .built_in,
-pre .sql .aggregate,
-pre .rsl .built_in,
-pre .smalltalk .class,
-pre .winutils,
-pre .flow,
-pre .apache .tag,
-pre .nginx .built_in,
-pre .tex .command,
-pre .tex .special,
-pre .request,
-pre .status {
- font-weight: bold;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/foundation.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/foundation.css
deleted file mode 100644
index b74d0d3415..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/foundation.css
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Description: Foundation 4 docs style for highlight.js
-Author: Dan Allen <[email protected]>
-Website: http://foundation.zurb.com/docs/
-Version: 1.0
-Date: 2013-04-02
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #eee;
-}
-
-pre .header,
-pre .decorator,
-pre .annotation {
- color: #000077;
-}
-
-pre .horizontal_rule,
-pre .link_url,
-pre .emphasis,
-pre .attribute {
- color: #070;
-}
-
-pre .emphasis {
- font-style: italic;
-}
-
-pre .link_label,
-pre .strong,
-pre .value,
-pre .string,
-pre .scss .value .string {
- color: #d14;
-}
-
-pre .strong {
- font-weight: bold;
-}
-
-pre .blockquote,
-pre .comment {
- color: #998;
- font-style: italic;
-}
-
-pre .asciidoc .title,
-pre .function .title {
- color: #900;
-}
-
-pre .class {
- color: #458;
-}
-
-pre .id,
-pre .pseudo,
-pre .constant,
-pre .hexcolor {
- color: teal;
-}
-
-pre .variable {
- color: #336699;
-}
-
-pre .bullet,
-pre .javadoc {
- color: #997700;
-}
-
-pre .pi,
-pre .doctype {
- color: #3344bb;
-}
-
-pre .code,
-pre .number {
- color: #099;
-}
-
-pre .important {
- color: #f00;
-}
-
-pre .smartquote,
-pre .label {
- color: #970;
-}
-
-pre .preprocessor,
-pre .pragma {
- color: #579;
-}
-
-pre .reserved,
-pre .keyword,
-pre .scss .value {
- color: #000;
-}
-
-pre .regexp {
- background-color: #fff0ff;
- color: #880088;
-}
-
-pre .symbol {
- color: #990073;
-}
-
-pre .symbol .string {
- color: #a60;
-}
-
-pre .tag {
- color: #007700;
-}
-
-pre .at_rule,
-pre .at_rule .keyword {
- color: #088;
-}
-
-pre .at_rule .preprocessor {
- color: #808;
-}
-
-pre .scss .tag,
-pre .scss .attribute {
- color: #339;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/github.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/github.css
deleted file mode 100644
index f31bfdc519..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/github.css
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-
-github.com style (c) Vasily Polovnyov <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- color: #333;
- background: #f8f8ff
-}
-
-pre .comment,
-pre .template_comment,
-pre .diff .header,
-pre .javadoc {
- color: #998;
- font-style: italic
-}
-
-pre .keyword,
-pre .css .rule .keyword,
-pre .winutils,
-pre .javascript .title,
-pre .nginx .title,
-pre .subst,
-pre .request,
-pre .status {
- color: #333;
- font-weight: bold
-}
-
-pre .number,
-pre .hexcolor,
-pre .ruby .constant {
- color: #099;
-}
-
-pre .string,
-pre .tag .value,
-pre .phpdoc,
-pre .tex .formula {
- color: #d14
-}
-
-pre .title,
-pre .id,
-pre .coffeescript .params,
-pre .scss .preprocessor {
- color: #900;
- font-weight: bold
-}
-
-pre .javascript .title,
-pre .lisp .title,
-pre .clojure .title,
-pre .subst {
- font-weight: normal
-}
-
-pre .class .title,
-pre .haskell .type,
-pre .vhdl .literal,
-pre .tex .command {
- color: #458;
- font-weight: bold
-}
-
-pre .tag,
-pre .tag .title,
-pre .rules .property,
-pre .django .tag .keyword {
- color: #000080;
- font-weight: normal
-}
-
-pre .attribute,
-pre .variable,
-pre .lisp .body {
- color: #008080
-}
-
-pre .regexp {
- color: #009926
-}
-
-pre .class {
- color: #458;
- font-weight: bold
-}
-
-pre .symbol,
-pre .ruby .symbol .string,
-pre .lisp .keyword,
-pre .tex .special,
-pre .prompt {
- color: #990073
-}
-
-pre .built_in,
-pre .lisp .title,
-pre .clojure .built_in {
- color: #0086b3
-}
-
-pre .preprocessor,
-pre .pragma,
-pre .pi,
-pre .doctype,
-pre .shebang,
-pre .cdata {
- color: #999;
- font-weight: bold
-}
-
-pre .deletion {
- background: #fdd
-}
-
-pre .addition {
- background: #dfd
-}
-
-pre .diff .change {
- background: #0086b3
-}
-
-pre .chunk {
- color: #aaa
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/googlecode.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/googlecode.css
deleted file mode 100644
index 9ef1c1d61f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/googlecode.css
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-
-Google Code style (c) Aahan Krish <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: white; color: black;
-}
-
-pre .comment,
-pre .template_comment,
-pre .javadoc,
-pre .comment * {
- color: #800;
-}
-
-pre .keyword,
-pre .method,
-pre .list .title,
-pre .clojure .built_in,
-pre .nginx .title,
-pre .tag .title,
-pre .setting .value,
-pre .winutils,
-pre .tex .command,
-pre .http .title,
-pre .request,
-pre .status {
- color: #008;
-}
-
-pre .envvar,
-pre .tex .special {
- color: #660;
-}
-
-pre .string,
-pre .tag .value,
-pre .cdata,
-pre .filter .argument,
-pre .attr_selector,
-pre .apache .cbracket,
-pre .date,
-pre .regexp,
-pre .coffeescript .attribute {
- color: #080;
-}
-
-pre .sub .identifier,
-pre .pi,
-pre .tag,
-pre .tag .keyword,
-pre .decorator,
-pre .ini .title,
-pre .shebang,
-pre .prompt,
-pre .hexcolor,
-pre .rules .value,
-pre .css .value .number,
-pre .literal,
-pre .symbol,
-pre .ruby .symbol .string,
-pre .number,
-pre .css .function,
-pre .clojure .attribute {
- color: #066;
-}
-
-pre .class .title,
-pre .haskell .type,
-pre .smalltalk .class,
-pre .javadoctag,
-pre .yardoctag,
-pre .phpdoc,
-pre .typename,
-pre .tag .attribute,
-pre .doctype,
-pre .class .id,
-pre .built_in,
-pre .setting,
-pre .params,
-pre .variable,
-pre .clojure .title {
- color: #606;
-}
-
-pre .css .tag,
-pre .rules .property,
-pre .pseudo,
-pre .subst {
- color: #000;
-}
-
-pre .css .class, pre .css .id {
- color: #9B703F;
-}
-
-pre .value .important {
- color: #ff7700;
- font-weight: bold;
-}
-
-pre .rules .keyword {
- color: #C5AF75;
-}
-
-pre .annotation,
-pre .apache .sqbracket,
-pre .nginx .built_in {
- color: #9B859D;
-}
-
-pre .preprocessor,
-pre .preprocessor *,
-pre .pragma {
- color: #444;
-}
-
-pre .tex .formula {
- background-color: #EEE;
- font-style: italic;
-}
-
-pre .diff .header,
-pre .chunk {
- color: #808080;
- font-weight: bold;
-}
-
-pre .diff .change {
- background-color: #BCCFF9;
-}
-
-pre .addition {
- background-color: #BAEEBA;
-}
-
-pre .deletion {
- background-color: #FFC8BD;
-}
-
-pre .comment .yardoctag {
- font-weight: bold;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/idea.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/idea.css
deleted file mode 100644
index 2959c7a984..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/idea.css
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-
-Intellij Idea-like styling (c) Vasily Polovnyov <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- color: #000;
- background: #fff;
-}
-
-pre .subst,
-pre .title {
- font-weight: normal;
- color: #000;
-}
-
-pre .comment,
-pre .template_comment,
-pre .javadoc,
-pre .diff .header {
- color: #808080;
- font-style: italic;
-}
-
-pre .annotation,
-pre .decorator,
-pre .preprocessor,
-pre .pragma,
-pre .doctype,
-pre .pi,
-pre .chunk,
-pre .shebang,
-pre .apache .cbracket,
-pre .prompt,
-pre .http .title {
- color: #808000;
-}
-
-pre .tag,
-pre .pi {
- background: #efefef;
-}
-
-pre .tag .title,
-pre .id,
-pre .attr_selector,
-pre .pseudo,
-pre .literal,
-pre .keyword,
-pre .hexcolor,
-pre .css .function,
-pre .ini .title,
-pre .css .class,
-pre .list .title,
-pre .clojure .title,
-pre .nginx .title,
-pre .tex .command,
-pre .request,
-pre .status {
- font-weight: bold;
- color: #000080;
-}
-
-pre .attribute,
-pre .rules .keyword,
-pre .number,
-pre .date,
-pre .regexp,
-pre .tex .special {
- font-weight: bold;
- color: #0000ff;
-}
-
-pre .number,
-pre .regexp {
- font-weight: normal;
-}
-
-pre .string,
-pre .value,
-pre .filter .argument,
-pre .css .function .params,
-pre .apache .tag {
- color: #008000;
- font-weight: bold;
-}
-
-pre .symbol,
-pre .ruby .symbol .string,
-pre .char,
-pre .tex .formula {
- color: #000;
- background: #d0eded;
- font-style: italic;
-}
-
-pre .phpdoc,
-pre .yardoctag,
-pre .javadoctag {
- text-decoration: underline;
-}
-
-pre .variable,
-pre .envvar,
-pre .apache .sqbracket,
-pre .nginx .built_in {
- color: #660e7a;
-}
-
-pre .addition {
- background: #baeeba;
-}
-
-pre .deletion {
- background: #ffc8bd;
-}
-
-pre .diff .change {
- background: #bccff9;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/ir_black.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/ir_black.css
deleted file mode 100644
index 9168283537..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/ir_black.css
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- IR_Black style (c) Vasily Mikhailitchenko <[email protected]>
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #000; color: #f8f8f8;
-}
-
-pre .shebang,
-pre .comment,
-pre .template_comment,
-pre .javadoc {
- color: #7c7c7c;
-}
-
-pre .keyword,
-pre .tag,
-pre .tex .command,
-pre .request,
-pre .status,
-pre .clojure .attribute {
- color: #96CBFE;
-}
-
-pre .sub .keyword,
-pre .method,
-pre .list .title,
-pre .nginx .title {
- color: #FFFFB6;
-}
-
-pre .string,
-pre .tag .value,
-pre .cdata,
-pre .filter .argument,
-pre .attr_selector,
-pre .apache .cbracket,
-pre .date,
-pre .coffeescript .attribute {
- color: #A8FF60;
-}
-
-pre .subst {
- color: #DAEFA3;
-}
-
-pre .regexp {
- color: #E9C062;
-}
-
-pre .title,
-pre .sub .identifier,
-pre .pi,
-pre .decorator,
-pre .tex .special,
-pre .haskell .type,
-pre .constant,
-pre .smalltalk .class,
-pre .javadoctag,
-pre .yardoctag,
-pre .phpdoc,
-pre .nginx .built_in {
- color: #FFFFB6;
-}
-
-pre .symbol,
-pre .ruby .symbol .string,
-pre .number,
-pre .variable,
-pre .vbscript,
-pre .literal {
- color: #C6C5FE;
-}
-
-pre .css .tag {
- color: #96CBFE;
-}
-
-pre .css .rules .property,
-pre .css .id {
- color: #FFFFB6;
-}
-
-pre .css .class {
- color: #FFF;
-}
-
-pre .hexcolor {
- color: #C6C5FE;
-}
-
-pre .number {
- color:#FF73FD;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.7;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/magula.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/magula.css
deleted file mode 100644
index 1c466dd550..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/magula.css
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Description: Magula style for highligh.js
-Author: Ruslan Keba <[email protected]>
-Website: http://rukeba.com/
-Version: 1.0
-Date: 2009-01-03
-Music: Aphex Twin / Xtal
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background-color: #f4f4f4;
-}
-
-pre code,
-pre .subst,
-pre .lisp .title,
-pre .clojure .built_in {
- color: black;
-}
-
-pre .string,
-pre .title,
-pre .parent,
-pre .tag .value,
-pre .rules .value,
-pre .rules .value .number,
-pre .preprocessor,
-pre .pragma,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .aggregate,
-pre .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .addition,
-pre .flow,
-pre .stream,
-pre .bash .variable,
-pre .apache .cbracket,
-pre .coffeescript .attribute {
- color: #050;
-}
-
-pre .comment,
-pre .annotation,
-pre .template_comment,
-pre .diff .header,
-pre .chunk {
- color: #777;
-}
-
-pre .number,
-pre .date,
-pre .regexp,
-pre .literal,
-pre .smalltalk .symbol,
-pre .smalltalk .char,
-pre .change,
-pre .tex .special {
- color: #800;
-}
-
-pre .label,
-pre .javadoc,
-pre .ruby .string,
-pre .decorator,
-pre .filter .argument,
-pre .localvars,
-pre .array,
-pre .attr_selector,
-pre .pseudo,
-pre .pi,
-pre .doctype,
-pre .deletion,
-pre .envvar,
-pre .shebang,
-pre .apache .sqbracket,
-pre .nginx .built_in,
-pre .tex .formula,
-pre .prompt,
-pre .clojure .attribute {
- color: #00e;
-}
-
-pre .keyword,
-pre .id,
-pre .phpdoc,
-pre .title,
-pre .built_in,
-pre .aggregate,
-pre .smalltalk .class,
-pre .winutils,
-pre .bash .variable,
-pre .apache .tag,
-pre .xml .tag,
-pre .tex .command,
-pre .request,
-pre .status {
- font-weight: bold;
- color: navy;
-}
-
-pre .nginx .built_in {
- font-weight: normal;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
-
-/* --- */
-pre .apache .tag {
- font-weight: bold;
- color: blue;
-}
-
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/mono-blue.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/mono-blue.css
deleted file mode 100644
index 85769e8f7a..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/mono-blue.css
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Five-color theme from a single blue hue.
-*/
-pre code {
- display: block; padding: 0.5em;
- background: #EAEEF3; color: #00193A;
-}
-
-pre .keyword,
-pre .title,
-pre .important,
-pre .request,
-pre .header,
-pre .javadoctag {
- font-weight: bold;
-}
-
-pre .comment,
-pre .chunk,
-pre .template_comment {
- color: #738191;
-}
-
-pre .string,
-pre .title,
-pre .parent,
-pre .built_in,
-pre .literal,
-pre .filename,
-pre .value,
-pre .addition,
-pre .tag,
-pre .argument,
-pre .link_label,
-pre .blockquote,
-pre .header {
- color: #0048AB;
-}
-
-pre .decorator,
-pre .prompt,
-pre .yardoctag,
-pre .subst,
-pre .symbol,
-pre .doctype,
-pre .regexp,
-pre .preprocessor,
-pre .pragma,
-pre .pi,
-pre .attribute,
-pre .attr_selector,
-pre .javadoc,
-pre .xmlDocTag,
-pre .deletion,
-pre .shebang,
-pre .string .variable,
-pre .link_url,
-pre .bullet,
-pre .sqbracket,
-pre .phony {
- color: #4C81C9;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/monokai.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/monokai.css
deleted file mode 100644
index e0c3eb376f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/monokai.css
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-Monokai style - ported by Luigi Maselli - http://grigio.org
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #272822;
-}
-
-pre .tag,
-pre .tag .title,
-pre .keyword,
-pre .literal,
-pre .strong,
-pre .change,
-pre .winutils,
-pre .flow,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .nginx .title,
-pre .tex .special {
- color: #F92672;
-}
-
-pre code {
- color: #DDD;
-}
-
-pre code .constant,
-pre .asciidoc .code {
- color: #66D9EF;
-}
-
-pre .code,
-pre .class .title,
-pre .header {
- color: white;
-}
-
-pre .link_label,
-pre .attribute,
-pre .symbol,
-pre .symbol .string,
-pre .value,
-pre .regexp {
- color: #BF79DB;
-}
-
-pre .link_url,
-pre .tag .value,
-pre .string,
-pre .bullet,
-pre .subst,
-pre .title,
-pre .emphasis,
-pre .haskell .type,
-pre .preprocessor,
-pre .pragma,
-pre .ruby .class .parent,
-pre .built_in,
-pre .sql .aggregate,
-pre .django .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .javadoc,
-pre .django .filter .argument,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .attr_selector,
-pre .pseudo,
-pre .addition,
-pre .stream,
-pre .envvar,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .tex .command,
-pre .prompt {
- color: #A6E22E;
-}
-
-pre .comment,
-pre .java .annotation,
-pre .smartquote,
-pre .blockquote,
-pre .horizontal_rule,
-pre .python .decorator,
-pre .template_comment,
-pre .pi,
-pre .doctype,
-pre .deletion,
-pre .shebang,
-pre .apache .sqbracket,
-pre .tex .formula {
- color: #75715E;
-}
-
-pre .keyword,
-pre .literal,
-pre .css .id,
-pre .phpdoc,
-pre .title,
-pre .header,
-pre .haskell .type,
-pre .vbscript .built_in,
-pre .sql .aggregate,
-pre .rsl .built_in,
-pre .smalltalk .class,
-pre .diff .header,
-pre .chunk,
-pre .winutils,
-pre .bash .variable,
-pre .apache .tag,
-pre .tex .special,
-pre .request,
-pre .status {
- font-weight: bold;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/monokai_sublime.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/monokai_sublime.css
deleted file mode 100644
index f48c9d7cf1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/monokai_sublime.css
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-
-Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/
-
-*/
-
-pre code {
- display: block;
- padding: 0.5em;
- background: #23241f;
-}
-pre .tag,
-pre code {
- color: #f8f8f2;
-}
-pre .keyword,
-pre .function,
-pre .literal,
-pre .change,
-pre .winutils,
-pre .flow,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .nginx .title,
-pre .tex .special {
- color: #66d9ef;
-}
-pre .variable,
-pre .params {
- color: #fd9720;
-}
-pre .constant {
- color: #66d9ef;
-}
-pre .title,
-pre .class .title,
-pre .css .class {
- color: #a6e22e;
-}
-pre .attribute,
-pre .symbol,
-pre .symbol .string,
-pre .tag .title,
-pre .value,
-pre .css .tag {
- color: #f92672;
-}
-pre .number,
-pre .preprocessor,
-pre .pragma,
-pre .regexp {
- color: #ae81ff;
-}
-pre .tag .value,
-pre .string,
-pre .css .id,
-pre .subst,
-pre .haskell .type,
-pre .ruby .class .parent,
-pre .built_in,
-pre .sql .aggregate,
-pre .django .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .django .filter .argument,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .attr_selector,
-pre .pseudo,
-pre .addition,
-pre .stream,
-pre .envvar,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .tex .command,
-pre .prompt {
- color: #e6db74;
-}
-pre .comment,
-pre .javadoc,
-pre .java .annotation,
-pre .python .decorator,
-pre .template_comment,
-pre .pi,
-pre .doctype,
-pre .deletion,
-pre .shebang,
-pre .apache .sqbracket,
-pre .tex .formula {
- color: #75715e;
-}
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula {
- opacity: 0.5;
-}
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/obsidian.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/obsidian.css
deleted file mode 100644
index b1b9df08c6..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/obsidian.css
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * Obsidian style
- * ported by Alexander Marenin (http://github.com/ioncreature)
- */
-
-pre code {
- display: block; padding: 0.5em;
- background: #282B2E;
-}
-
-pre .keyword,
-pre .literal,
-pre .change,
-pre .winutils,
-pre .flow,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .nginx .title,
-pre .css .id,
-pre .tex .special {
- color: #93C763;
-}
-
-pre .number {
- color: #FFCD22;
-}
-
-pre code {
- color: #E0E2E4;
-}
-
-pre .css .tag,
-pre .css .pseudo {
- color: #D0D2B5;
-}
-
-pre .attribute,
-pre code .constant {
- color: #668BB0;
-}
-
-pre .xml .attribute {
- color: #B3B689;
-}
-
-pre .xml .tag .value {
- color: #E8E2B7;
-}
-
-pre .code,
-pre .class .title,
-pre .header {
- color: white;
-}
-
-pre .class,
-pre .hexcolor {
- color: #93C763;
-}
-
-pre .regexp {
- color: #D39745;
-}
-
-pre .at_rule,
-pre .at_rule .keyword {
- color: #A082BD;
-}
-
-pre .doctype {
- color: #557182;
-}
-
-pre .link_url,
-pre .tag,
-pre .tag .title,
-pre .bullet,
-pre .subst,
-pre .emphasis,
-pre .haskell .type,
-pre .preprocessor,
-pre .pragma,
-pre .ruby .class .parent,
-pre .built_in,
-pre .sql .aggregate,
-pre .django .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .javadoc,
-pre .django .filter .argument,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .attr_selector,
-pre .pseudo,
-pre .addition,
-pre .stream,
-pre .envvar,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .tex .command,
-pre .prompt {
- color: #8CBBAD;
-}
-
-pre .string {
- color: #EC7600;
-}
-
-pre .comment,
-pre .java .annotation,
-pre .blockquote,
-pre .horizontal_rule,
-pre .python .decorator,
-pre .template_comment,
-pre .pi,
-pre .deletion,
-pre .shebang,
-pre .apache .sqbracket,
-pre .tex .formula {
- color: #818E96;
-}
-
-pre .keyword,
-pre .literal,
-pre .css .id,
-pre .phpdoc,
-pre .title,
-pre .header,
-pre .haskell .type,
-pre .vbscript .built_in,
-pre .sql .aggregate,
-pre .rsl .built_in,
-pre .smalltalk .class,
-pre .diff .header,
-pre .chunk,
-pre .winutils,
-pre .bash .variable,
-pre .apache .tag,
-pre .tex .special,
-pre .request,
-pre .at_rule .keyword,
-pre .status {
- font-weight: bold;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/pojoaque.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/pojoaque.css
deleted file mode 100644
index 8c7e627db3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/pojoaque.css
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-
-Pojoaque Style by Jason Tate
-http://web-cms-designs.com/ftopict-10-pojoaque-style-for-highlight-js-code-highlighter.html
-Based on Solarized Style from http://ethanschoonover.com/solarized
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- color: #DCCF8F;
- background: url(./pojoaque.jpg) repeat scroll left top #181914;
-}
-
-pre .comment,
-pre .template_comment,
-pre .diff .header,
-pre .doctype,
-pre .lisp .string,
-pre .javadoc {
- color: #586e75;
- font-style: italic;
-}
-
-pre .keyword,
-pre .css .rule .keyword,
-pre .winutils,
-pre .javascript .title,
-pre .method,
-pre .addition,
-pre .css .tag,
-pre .clojure .title,
-pre .nginx .title {
- color: #B64926;
-}
-
-pre .number,
-pre .command,
-pre .string,
-pre .tag .value,
-pre .phpdoc,
-pre .tex .formula,
-pre .regexp,
-pre .hexcolor {
- color: #468966;
-}
-
-pre .title,
-pre .localvars,
-pre .function .title,
-pre .chunk,
-pre .decorator,
-pre .built_in,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .identifier,
-pre .id {
- color: #FFB03B;
-}
-
-pre .attribute,
-pre .variable,
-pre .lisp .body,
-pre .smalltalk .number,
-pre .constant,
-pre .class .title,
-pre .parent,
-pre .haskell .type {
- color: #b58900;
-}
-
-pre .css .attribute {
- color: #b89859;
-}
-
-pre .css .number,pre .css .hexcolor{
- color: #DCCF8F;
-}
-
-pre .css .class {
- color: #d3a60c;
-}
-
-pre .preprocessor,
-pre .pragma,
-pre .pi,
-pre .shebang,
-pre .symbol,
-pre .symbol .string,
-pre .diff .change,
-pre .special,
-pre .attr_selector,
-pre .important,
-pre .subst,
-pre .cdata {
- color: #cb4b16;
-}
-
-pre .deletion {
- color: #dc322f;
-}
-
-pre .tex .formula {
- background: #073642;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/pojoaque.jpg b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/pojoaque.jpg
deleted file mode 100644
index 9c07d4ab40..0000000000
Binary files a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/pojoaque.jpg and /dev/null differ
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/railscasts.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/railscasts.css
deleted file mode 100644
index fb6f1458f1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/railscasts.css
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-
-Railscasts-like style (c) Visoft, Inc. (Damien White)
-
-*/
-
-pre code {
- display: block;
- padding: 0.5em;
- background: #232323;
- color: #E6E1DC;
-}
-
-pre .comment,
-pre .template_comment,
-pre .javadoc,
-pre .shebang {
- color: #BC9458;
- font-style: italic;
-}
-
-pre .keyword,
-pre .ruby .function .keyword,
-pre .request,
-pre .status,
-pre .nginx .title,
-pre .method,
-pre .list .title {
- color: #C26230;
-}
-
-pre .string,
-pre .number,
-pre .regexp,
-pre .tag .value,
-pre .cdata,
-pre .filter .argument,
-pre .attr_selector,
-pre .apache .cbracket,
-pre .date,
-pre .tex .command,
-pre .markdown .link_label {
- color: #A5C261;
-}
-
-pre .subst {
- color: #519F50;
-}
-
-pre .tag,
-pre .tag .keyword,
-pre .tag .title,
-pre .doctype,
-pre .sub .identifier,
-pre .pi,
-pre .input_number {
- color: #E8BF6A;
-}
-
-pre .identifier {
- color: #D0D0FF;
-}
-
-pre .class .title,
-pre .haskell .type,
-pre .smalltalk .class,
-pre .javadoctag,
-pre .yardoctag,
-pre .phpdoc {
- text-decoration: none;
-}
-
-pre .constant {
- color: #DA4939;
-}
-
-
-pre .symbol,
-pre .built_in,
-pre .ruby .symbol .string,
-pre .ruby .symbol .identifier,
-pre .markdown .link_url,
-pre .attribute {
- color: #6D9CBE;
-}
-
-pre .markdown .link_url {
- text-decoration: underline;
-}
-
-
-
-pre .params,
-pre .variable,
-pre .clojure .attribute {
- color: #D0D0FF;
-}
-
-pre .css .tag,
-pre .rules .property,
-pre .pseudo,
-pre .tex .special {
- color: #CDA869;
-}
-
-pre .css .class {
- color: #9B703F;
-}
-
-pre .rules .keyword {
- color: #C5AF75;
-}
-
-pre .rules .value {
- color: #CF6A4C;
-}
-
-pre .css .id {
- color: #8B98AB;
-}
-
-pre .annotation,
-pre .apache .sqbracket,
-pre .nginx .built_in {
- color: #9B859D;
-}
-
-pre .preprocessor,
-pre .preprocessor *
-pre .pragma {
- color: #8996A8 !important;
-}
-
-pre .hexcolor,
-pre .css .value .number {
- color: #A5C261;
-}
-
-pre .title,
-pre .decorator,
-pre .css .function {
- color: #FFC66D;
-}
-
-pre .diff .header,
-pre .chunk {
- background-color: #2F33AB;
- color: #E6E1DC;
- display: inline-block;
- width: 100%;
-}
-
-pre .diff .change {
- background-color: #4A410D;
- color: #F8F8F8;
- display: inline-block;
- width: 100%;
-}
-
-pre .addition {
- background-color: #144212;
- color: #E6E1DC;
- display: inline-block;
- width: 100%;
-}
-
-pre .deletion {
- background-color: #600;
- color: #E6E1DC;
- display: inline-block;
- width: 100%;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.7;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/rainbow.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/rainbow.css
deleted file mode 100644
index f4399e8719..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/rainbow.css
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-
-Style with support for rainbow parens
-
-*/
-
-pre ::-moz-selection{ background: #FF5E99; color:#fff; text-shadow: none; }
-pre ::selection { background:#FF5E99; color:#fff; text-shadow: none; }
-
-pre code {
- display: block; padding: 0.5em;
- background: #474949; color: #D1D9E1;
-}
-
-
-pre .body,
-pre .collection {
- color: #D1D9E1;
-}
-
-pre .comment,
-pre .template_comment,
-pre .diff .header,
-pre .doctype,
-pre .lisp .string,
-pre .javadoc {
- color: #969896;
- font-style: italic;
-}
-
-pre .keyword,
-pre .clojure .attribute,
-pre .winutils,
-pre .javascript .title,
-pre .addition,
-pre .css .tag {
- color: #cc99cc;
-}
-
-pre .number { color: #f99157; }
-
-pre .command,
-pre .string,
-pre .tag .value,
-pre .phpdoc,
-pre .tex .formula,
-pre .regexp,
-pre .hexcolor {
- color: #8abeb7;
-}
-
-pre .title,
-pre .localvars,
-pre .function .title,
-pre .chunk,
-pre .decorator,
-pre .built_in,
-pre .lisp .title,
-pre .identifier
-{
- color: #b5bd68;
-}
-
-pre .class .keyword
-{
- color: #f2777a;
-}
-
-pre .variable,
-pre .lisp .body,
-pre .smalltalk .number,
-pre .constant,
-pre .class .title,
-pre .parent,
-pre .haskell .label,
-pre .id,
-pre .lisp .title,
-pre .clojure .title .built_in {
- color: #ffcc66;
-}
-
-pre .tag .title,
-pre .rules .property,
-pre .django .tag .keyword,
-pre .clojure .title .built_in {
- font-weight: bold;
-}
-
-pre .attribute,
-pre .clojure .title {
- color: #81a2be;
-}
-
-pre .preprocessor,
-pre .pragma,
-pre .pi,
-pre .shebang,
-pre .symbol,
-pre .symbol .string,
-pre .diff .change,
-pre .special,
-pre .attr_selector,
-pre .important,
-pre .subst,
-pre .cdata {
- color: #f99157;
-}
-
-pre .deletion {
- color: #dc322f;
-}
-
-pre .tex .formula {
- background: #eee8d5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/school_book.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/school_book.css
deleted file mode 100644
index 12963b9f12..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/school_book.css
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-School Book style from goldblog.com.ua (c) Zaripov Yura <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 15px 0.5em 0.5em 30px;
- font-size: 11px !important;
- line-height:16px !important;
-}
-
-pre{
- background:#f6f6ae url(./school_book.png);
- border-top: solid 2px #d2e8b9;
- border-bottom: solid 1px #d2e8b9;
-}
-
-pre .keyword,
-pre .literal,
-pre .change,
-pre .winutils,
-pre .flow,
-pre .lisp .title,
-pre .clojure .built_in,
-pre .nginx .title,
-pre .tex .special {
- color:#005599;
- font-weight:bold;
-}
-
-pre code,
-pre .subst,
-pre .tag .keyword {
- color: #3E5915;
-}
-
-pre .string,
-pre .title,
-pre .haskell .type,
-pre .tag .value,
-pre .css .rules .value,
-pre .preprocessor,
-pre .pragma,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .ruby .class .parent,
-pre .built_in,
-pre .sql .aggregate,
-pre .django .template_tag,
-pre .django .variable,
-pre .smalltalk .class,
-pre .javadoc,
-pre .ruby .string,
-pre .django .filter .argument,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .attr_selector,
-pre .pseudo,
-pre .addition,
-pre .stream,
-pre .envvar,
-pre .apache .tag,
-pre .apache .cbracket,
-pre .nginx .built_in,
-pre .tex .command,
-pre .coffeescript .attribute {
- color: #2C009F;
-}
-
-pre .comment,
-pre .java .annotation,
-pre .python .decorator,
-pre .template_comment,
-pre .pi,
-pre .doctype,
-pre .deletion,
-pre .shebang,
-pre .apache .sqbracket {
- color: #E60415;
-}
-
-pre .keyword,
-pre .literal,
-pre .css .id,
-pre .phpdoc,
-pre .title,
-pre .haskell .type,
-pre .vbscript .built_in,
-pre .sql .aggregate,
-pre .rsl .built_in,
-pre .smalltalk .class,
-pre .xml .tag .title,
-pre .diff .header,
-pre .chunk,
-pre .winutils,
-pre .bash .variable,
-pre .apache .tag,
-pre .tex .command,
-pre .request,
-pre .status {
- font-weight: bold;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/school_book.png b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/school_book.png
deleted file mode 100644
index 956e9790a0..0000000000
Binary files a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/school_book.png and /dev/null differ
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/solarized_dark.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/solarized_dark.css
deleted file mode 100644
index 94d99b5f46..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/solarized_dark.css
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-
-Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #002b36; color: #839496;
-}
-
-pre .comment,
-pre .template_comment,
-pre .diff .header,
-pre .doctype,
-pre .pi,
-pre .lisp .string,
-pre .javadoc {
- color: #586e75;
- font-style: italic;
-}
-
-pre .keyword,
-pre .winutils,
-pre .method,
-pre .addition,
-pre .css .tag,
-pre .request,
-pre .status,
-pre .nginx .title {
- color: #859900;
-}
-
-pre .number,
-pre .command,
-pre .string,
-pre .tag .value,
-pre .rules .value,
-pre .phpdoc,
-pre .tex .formula,
-pre .regexp,
-pre .hexcolor {
- color: #2aa198;
-}
-
-pre .title,
-pre .localvars,
-pre .chunk,
-pre .decorator,
-pre .built_in,
-pre .identifier,
-pre .vhdl .literal,
-pre .id,
-pre .css .function {
- color: #268bd2;
-}
-
-pre .attribute,
-pre .variable,
-pre .lisp .body,
-pre .smalltalk .number,
-pre .constant,
-pre .class .title,
-pre .parent,
-pre .haskell .type {
- color: #b58900;
-}
-
-pre .preprocessor,
-pre .preprocessor .keyword,
-pre .pragma,
-pre .shebang,
-pre .symbol,
-pre .symbol .string,
-pre .diff .change,
-pre .special,
-pre .attr_selector,
-pre .important,
-pre .subst,
-pre .cdata,
-pre .clojure .title,
-pre .css .pseudo {
- color: #cb4b16;
-}
-
-pre .deletion {
- color: #dc322f;
-}
-
-pre .tex .formula {
- background: #073642;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/solarized_light.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/solarized_light.css
deleted file mode 100644
index 7e1339ef10..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/solarized_light.css
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-
-Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #fdf6e3; color: #657b83;
-}
-
-pre .comment,
-pre .template_comment,
-pre .diff .header,
-pre .doctype,
-pre .pi,
-pre .lisp .string,
-pre .javadoc {
- color: #93a1a1;
- font-style: italic;
-}
-
-pre .keyword,
-pre .winutils,
-pre .method,
-pre .addition,
-pre .css .tag,
-pre .request,
-pre .status,
-pre .nginx .title {
- color: #859900;
-}
-
-pre .number,
-pre .command,
-pre .string,
-pre .tag .value,
-pre .rules .value,
-pre .phpdoc,
-pre .tex .formula,
-pre .regexp,
-pre .hexcolor {
- color: #2aa198;
-}
-
-pre .title,
-pre .localvars,
-pre .chunk,
-pre .decorator,
-pre .built_in,
-pre .identifier,
-pre .vhdl .literal,
-pre .id,
-pre .css .function {
- color: #268bd2;
-}
-
-pre .attribute,
-pre .variable,
-pre .lisp .body,
-pre .smalltalk .number,
-pre .constant,
-pre .class .title,
-pre .parent,
-pre .haskell .type {
- color: #b58900;
-}
-
-pre .preprocessor,
-pre .preprocessor .keyword,
-pre .pragma,
-pre .shebang,
-pre .symbol,
-pre .symbol .string,
-pre .diff .change,
-pre .special,
-pre .attr_selector,
-pre .important,
-pre .subst,
-pre .cdata,
-pre .clojure .title,
-pre .css .pseudo {
- color: #cb4b16;
-}
-
-pre .deletion {
- color: #dc322f;
-}
-
-pre .tex .formula {
- background: #eee8d5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/sunburst.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/sunburst.css
deleted file mode 100644
index 6f1ed98ba5..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/sunburst.css
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-
-Sunburst-like style (c) Vasily Polovnyov <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #000; color: #f8f8f8;
-}
-
-pre .comment,
-pre .template_comment,
-pre .javadoc {
- color: #aeaeae;
- font-style: italic;
-}
-
-pre .keyword,
-pre .ruby .function .keyword,
-pre .request,
-pre .status,
-pre .nginx .title {
- color: #E28964;
-}
-
-pre .function .keyword,
-pre .sub .keyword,
-pre .method,
-pre .list .title {
- color: #99CF50;
-}
-
-pre .string,
-pre .tag .value,
-pre .cdata,
-pre .filter .argument,
-pre .attr_selector,
-pre .apache .cbracket,
-pre .date,
-pre .tex .command,
-pre .coffeescript .attribute {
- color: #65B042;
-}
-
-pre .subst {
- color: #DAEFA3;
-}
-
-pre .regexp {
- color: #E9C062;
-}
-
-pre .title,
-pre .sub .identifier,
-pre .pi,
-pre .tag,
-pre .tag .keyword,
-pre .decorator,
-pre .shebang,
-pre .prompt {
- color: #89BDFF;
-}
-
-pre .class .title,
-pre .haskell .type,
-pre .smalltalk .class,
-pre .javadoctag,
-pre .yardoctag,
-pre .phpdoc {
- text-decoration: underline;
-}
-
-pre .symbol,
-pre .ruby .symbol .string,
-pre .number {
- color: #3387CC;
-}
-
-pre .params,
-pre .variable,
-pre .clojure .attribute {
- color: #3E87E3;
-}
-
-pre .css .tag,
-pre .rules .property,
-pre .pseudo,
-pre .tex .special {
- color: #CDA869;
-}
-
-pre .css .class {
- color: #9B703F;
-}
-
-pre .rules .keyword {
- color: #C5AF75;
-}
-
-pre .rules .value {
- color: #CF6A4C;
-}
-
-pre .css .id {
- color: #8B98AB;
-}
-
-pre .annotation,
-pre .apache .sqbracket,
-pre .nginx .built_in {
- color: #9B859D;
-}
-
-pre .preprocessor,
-pre .pragma {
- color: #8996A8;
-}
-
-pre .hexcolor,
-pre .css .value .number {
- color: #DD7B3B;
-}
-
-pre .css .function {
- color: #DAD085;
-}
-
-pre .diff .header,
-pre .chunk,
-pre .tex .formula {
- background-color: #0E2231;
- color: #F8F8F8;
- font-style: italic;
-}
-
-pre .diff .change {
- background-color: #4A410D;
- color: #F8F8F8;
-}
-
-pre .addition {
- background-color: #253B22;
- color: #F8F8F8;
-}
-
-pre .deletion {
- background-color: #420E09;
- color: #F8F8F8;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/textmate.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/textmate.css
deleted file mode 100644
index e7902f137d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/textmate.css
+++ /dev/null
@@ -1,118 +0,0 @@
-
-pre { overflow: auto; overflow-x: auto; overflow-y: hidden; }
-pre code {
- white-space: pre;
- font-family: Consolas, 'Liberation Mono', Courier, monospace;
- font-size: 12px;
-}
-
-pre .subst,
-pre .title {
- font-weight: normal;
- color: #000;
-}
-
-pre .comment,
-pre .template_comment,
-pre .javadoc,
-pre .diff .header {
- color: #999;
- font-style: italic;
-}
-
-pre .annotation,
-pre .decorator,
-pre .preprocessor,
-pre .pragma,
-pre .doctype,
-pre .pi,
-pre .chunk,
-pre .shebang,
-pre .apache .cbracket,
-pre .prompt,
-pre .http .title {
- color: #808000;
-}
-
-pre .tag,
-pre .pi {
- background: #efefef;
-}
-
-pre .tag .title,
-pre .id,
-pre .attr_selector,
-pre .pseudo,
-pre .literal,
-pre .keyword,
-pre .hexcolor,
-pre .css .function,
-pre .ini .title,
-pre .css .class,
-pre .list .title,
-pre .clojure .title,
-pre .nginx .title,
-pre .tex .command,
-pre .request,
-pre .status {
- color: blue;
-}
-
-pre .attribute,
-pre .rules .keyword,
-pre .date,
-pre .tex .special {
- font-weight: bold;
- color: #0000ff;
-}
-
-pre .number {
- color: rgb(0, 0, 205);
-}
-
-pre .regexp {
- color: rgb(255, 0, 0);
-}
-
-
-pre .string,
-pre .value,
-pre .filter .argument,
-pre .css .function .params,
-pre .apache .tag {
- color: rgb(3, 106, 7);
-}
-
-pre .symbol,
-pre .ruby .symbol .string,
-pre .char,
-pre .tex .formula {
- color: #000;
- background: #d0eded;
- font-style: italic;
-}
-
-pre .phpdoc,
-pre .yardoctag,
-pre .javadoctag {
- text-decoration: underline;
-}
-
-pre .variable,
-pre .envvar,
-pre .apache .sqbracket,
-pre .nginx .built_in {
- color: #660e7a;
-}
-
-pre .addition {
- background: #baeeba;
-}
-
-pre .deletion {
- background: #ffc8bd;
-}
-
-pre .diff .change {
- background: #bccff9;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-blue.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-blue.css
deleted file mode 100644
index 86de93c294..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-blue.css
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Tomorrow Night Blue Theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-.tomorrow-comment, pre .comment, pre .title {
- color: #7285b7;
-}
-
-.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
- color: #ff9da4;
-}
-
-.tomorrow-orange, pre .number, pre .preprocessor, pre .pragma, pre .built_in, pre .literal, pre .params, pre .constant {
- color: #ffc58f;
-}
-
-.tomorrow-yellow, pre .ruby .class .title, pre .css .rules .attribute {
- color: #ffeead;
-}
-
-.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
- color: #d1f1a9;
-}
-
-.tomorrow-aqua, pre .css .hexcolor {
- color: #99ffff;
-}
-
-.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
- color: #bbdaff;
-}
-
-.tomorrow-purple, pre .keyword, pre .javascript .function {
- color: #ebbbff;
-}
-
-pre code {
- display: block;
- background: #002451;
- color: white;
- padding: 0.5em;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-bright.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-bright.css
deleted file mode 100644
index 7e2450b662..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-bright.css
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Tomorrow Night Bright Theme */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-.tomorrow-comment, pre .comment, pre .title {
- color: #969896;
-}
-
-.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
- color: #d54e53;
-}
-
-.tomorrow-orange, pre .number, pre .preprocessor, pre .pragma, pre .built_in, pre .literal, pre .params, pre .constant {
- color: #e78c45;
-}
-
-.tomorrow-yellow, pre .ruby .class .title, pre .css .rules .attribute {
- color: #e7c547;
-}
-
-.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
- color: #b9ca4a;
-}
-
-.tomorrow-aqua, pre .css .hexcolor {
- color: #70c0b1;
-}
-
-.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
- color: #7aa6da;
-}
-
-.tomorrow-purple, pre .keyword, pre .javascript .function {
- color: #c397d8;
-}
-
-pre code {
- display: block;
- background: black;
- color: #eaeaea;
- padding: 0.5em;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-eighties.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-eighties.css
deleted file mode 100644
index bd0c45ece2..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night-eighties.css
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Tomorrow Night Eighties Theme */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-.tomorrow-comment, pre .comment, pre .title {
- color: #999999;
-}
-
-.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
- color: #f2777a;
-}
-
-.tomorrow-orange, pre .number, pre .preprocessor, pre .pragma, pre .built_in, pre .literal, pre .params, pre .constant {
- color: #f99157;
-}
-
-.tomorrow-yellow, pre .ruby .class .title, pre .css .rules .attribute {
- color: #ffcc66;
-}
-
-.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
- color: #99cc99;
-}
-
-.tomorrow-aqua, pre .css .hexcolor {
- color: #66cccc;
-}
-
-.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
- color: #6699cc;
-}
-
-.tomorrow-purple, pre .keyword, pre .javascript .function {
- color: #cc99cc;
-}
-
-pre code {
- display: block;
- background: #2d2d2d;
- color: #cccccc;
- padding: 0.5em;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night.css
deleted file mode 100644
index 2cc110b322..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow-night.css
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Tomorrow Night Theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-.tomorrow-comment, pre .comment, pre .title {
- color: #969896;
-}
-
-.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
- color: #cc6666;
-}
-
-.tomorrow-orange, pre .number, pre .preprocessor, pre .pragma, pre .built_in, pre .literal, pre .params, pre .constant {
- color: #de935f;
-}
-
-.tomorrow-yellow, pre .ruby .class .title, pre .css .rules .attribute {
- color: #f0c674;
-}
-
-.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
- color: #b5bd68;
-}
-
-.tomorrow-aqua, pre .css .hexcolor {
- color: #8abeb7;
-}
-
-.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
- color: #81a2be;
-}
-
-.tomorrow-purple, pre .keyword, pre .javascript .function {
- color: #b294bb;
-}
-
-pre code {
- display: block;
- background: #1d1f21;
- color: #c5c8c6;
- padding: 0.5em;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow.css
deleted file mode 100644
index 4da26b0515..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/tomorrow.css
+++ /dev/null
@@ -1,49 +0,0 @@
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-.tomorrow-comment, pre .comment, pre .title {
- color: #8e908c;
-}
-
-.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
- color: #c82829;
-}
-
-.tomorrow-orange, pre .number, pre .preprocessor, pre .pragma, pre .built_in, pre .literal, pre .params, pre .constant {
- color: #f5871f;
-}
-
-.tomorrow-yellow, pre .ruby .class .title, pre .css .rules .attribute {
- color: #eab700;
-}
-
-.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
- color: #718c00;
-}
-
-.tomorrow-aqua, pre .css .hexcolor {
- color: #3e999f;
-}
-
-.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
- color: #4271ae;
-}
-
-.tomorrow-purple, pre .keyword, pre .javascript .function {
- color: #8959a8;
-}
-
-pre code {
- display: block;
- background: white;
- color: #4d4d4c;
- padding: 0.5em;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/vs.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/vs.css
deleted file mode 100644
index 482ae258b6..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/vs.css
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-
-Visual Studio-like style based on original C# coloring by Jason Diamond <[email protected]>
-
-*/
-pre code {
- display: block; padding: 0.5em;
- background: white; color: black;
-}
-
-pre .comment,
-pre .annotation,
-pre .template_comment,
-pre .diff .header,
-pre .chunk,
-pre .apache .cbracket {
- color: rgb(0, 128, 0);
-}
-
-pre .keyword,
-pre .id,
-pre .built_in,
-pre .smalltalk .class,
-pre .winutils,
-pre .bash .variable,
-pre .tex .command,
-pre .request,
-pre .status,
-pre .nginx .title,
-pre .xml .tag,
-pre .xml .tag .value {
- color: rgb(0, 0, 255);
-}
-
-pre .string,
-pre .title,
-pre .parent,
-pre .tag .value,
-pre .rules .value,
-pre .rules .value .number,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .aggregate,
-pre .template_tag,
-pre .django .variable,
-pre .addition,
-pre .flow,
-pre .stream,
-pre .apache .tag,
-pre .date,
-pre .tex .formula,
-pre .coffeescript .attribute {
- color: rgb(163, 21, 21);
-}
-
-pre .ruby .string,
-pre .decorator,
-pre .filter .argument,
-pre .localvars,
-pre .array,
-pre .attr_selector,
-pre .pseudo,
-pre .pi,
-pre .doctype,
-pre .deletion,
-pre .envvar,
-pre .shebang,
-pre .preprocessor,
-pre .pragma,
-pre .userType,
-pre .apache .sqbracket,
-pre .nginx .built_in,
-pre .tex .special,
-pre .prompt {
- color: rgb(43, 145, 175);
-}
-
-pre .phpdoc,
-pre .javadoc,
-pre .xmlDocTag {
- color: rgb(128, 128, 128);
-}
-
-pre .vhdl .typename { font-weight: bold; }
-pre .vhdl .string { color: #666666; }
-pre .vhdl .literal { color: rgb(163, 21, 21); }
-pre .vhdl .attribute { color: #00B0E8; }
-
-pre .xml .attribute { color: rgb(255, 0, 0); }
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/xcode.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/xcode.css
deleted file mode 100644
index 3b355a20a0..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/xcode.css
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-
-XCode style (c) Angel Garcia <[email protected]>
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #fff; color: black;
-}
-
-pre .comment,
-pre .template_comment,
-pre .javadoc,
-pre .comment * {
- color: rgb(0,106,0);
-}
-
-pre .keyword,
-pre .literal,
-pre .nginx .title {
- color: rgb(170,13,145);
-}
-pre .method,
-pre .list .title,
-pre .tag .title,
-pre .setting .value,
-pre .winutils,
-pre .tex .command,
-pre .http .title,
-pre .request,
-pre .status {
- color: #008;
-}
-
-pre .envvar,
-pre .tex .special {
- color: #660;
-}
-
-pre .string {
- color: rgb(196,26,22);
-}
-pre .tag .value,
-pre .cdata,
-pre .filter .argument,
-pre .attr_selector,
-pre .apache .cbracket,
-pre .date,
-pre .regexp {
- color: #080;
-}
-
-pre .sub .identifier,
-pre .pi,
-pre .tag,
-pre .tag .keyword,
-pre .decorator,
-pre .ini .title,
-pre .shebang,
-pre .prompt,
-pre .hexcolor,
-pre .rules .value,
-pre .css .value .number,
-pre .symbol,
-pre .symbol .string,
-pre .number,
-pre .css .function,
-pre .clojure .title,
-pre .clojure .built_in,
-pre .function .title,
-pre .coffeescript .attribute {
- color: rgb(28,0,207);
-}
-
-pre .class .title,
-pre .haskell .type,
-pre .smalltalk .class,
-pre .javadoctag,
-pre .yardoctag,
-pre .phpdoc,
-pre .typename,
-pre .tag .attribute,
-pre .doctype,
-pre .class .id,
-pre .built_in,
-pre .setting,
-pre .params,
-pre .clojure .attribute {
- color: rgb(92,38,153);
-}
-
-pre .variable {
- color: rgb(63,110,116);
-}
-pre .css .tag,
-pre .rules .property,
-pre .pseudo,
-pre .subst {
- color: #000;
-}
-
-pre .css .class, pre .css .id {
- color: #9B703F;
-}
-
-pre .value .important {
- color: #ff7700;
- font-weight: bold;
-}
-
-pre .rules .keyword {
- color: #C5AF75;
-}
-
-pre .annotation,
-pre .apache .sqbracket,
-pre .nginx .built_in {
- color: #9B859D;
-}
-
-pre .preprocessor,
-pre .preprocessor *,
-pre .pragma {
- color: rgb(100,56,32);
-}
-
-pre .tex .formula {
- background-color: #EEE;
- font-style: italic;
-}
-
-pre .diff .header,
-pre .chunk {
- color: #808080;
- font-weight: bold;
-}
-
-pre .diff .change {
- background-color: #BCCFF9;
-}
-
-pre .addition {
- background-color: #BAEEBA;
-}
-
-pre .deletion {
- background-color: #FFC8BD;
-}
-
-pre .comment .yardoctag {
- font-weight: bold;
-}
-
-pre .method .id {
- color: #000;
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/zenburn.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/zenburn.css
deleted file mode 100644
index 3fc6bd0af4..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/blob/renderer/highlighter/res/highlight/styles/zenburn.css
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-
-Zenburn style from voldmar.ru (c) Vladimir Epifanov <[email protected]>
-based on dark.css by Ivan Sagalaev
-
-*/
-
-pre code {
- display: block; padding: 0.5em;
- background: #3F3F3F;
- color: #DCDCDC;
-}
-
-pre .keyword,
-pre .tag,
-pre .css .class,
-pre .css .id,
-pre .lisp .title,
-pre .nginx .title,
-pre .request,
-pre .status,
-pre .clojure .attribute {
- color: #E3CEAB;
-}
-
-pre .django .template_tag,
-pre .django .variable,
-pre .django .filter .argument {
- color: #DCDCDC;
-}
-
-pre .number,
-pre .date {
- color: #8CD0D3;
-}
-
-pre .dos .envvar,
-pre .dos .stream,
-pre .variable,
-pre .apache .sqbracket {
- color: #EFDCBC;
-}
-
-pre .dos .flow,
-pre .diff .change,
-pre .python .exception,
-pre .python .built_in,
-pre .literal,
-pre .tex .special {
- color: #EFEFAF;
-}
-
-pre .diff .chunk,
-pre .subst {
- color: #8F8F8F;
-}
-
-pre .dos .keyword,
-pre .python .decorator,
-pre .title,
-pre .haskell .type,
-pre .diff .header,
-pre .ruby .class .parent,
-pre .apache .tag,
-pre .nginx .built_in,
-pre .tex .command,
-pre .prompt {
- color: #efef8f;
-}
-
-pre .dos .winutils,
-pre .ruby .symbol,
-pre .ruby .symbol .string,
-pre .ruby .string {
- color: #DCA3A3;
-}
-
-pre .diff .deletion,
-pre .string,
-pre .tag .value,
-pre .preprocessor,
-pre .pragma,
-pre .built_in,
-pre .sql .aggregate,
-pre .javadoc,
-pre .smalltalk .class,
-pre .smalltalk .localvars,
-pre .smalltalk .array,
-pre .css .rules .value,
-pre .attr_selector,
-pre .pseudo,
-pre .apache .cbracket,
-pre .tex .formula,
-pre .coffeescript .attribute {
- color: #CC9393;
-}
-
-pre .shebang,
-pre .diff .addition,
-pre .comment,
-pre .java .annotation,
-pre .template_comment,
-pre .pi,
-pre .doctype {
- color: #7F9F7F;
-}
-
-pre .coffeescript .javascript,
-pre .javascript .xml,
-pre .tex .formula,
-pre .xml .javascript,
-pre .xml .vbscript,
-pre .xml .css,
-pre .xml .cdata {
- opacity: 0.5;
-}
-
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/branches/BranchComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/branches/BranchComparePage.java
index 9b825856d6..4a5da152bf 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/branches/BranchComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/branches/BranchComparePage.java
@@ -32,13 +32,12 @@ import com.pmease.gitplex.core.model.PullRequest;
import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.web.component.branch.AffinalBranchSingleChoice;
import com.pmease.gitplex.web.component.branch.BranchLink;
-import com.pmease.gitplex.web.component.commit.CommitsTablePanel;
import com.pmease.gitplex.web.component.diff.CompareResultPanel;
import com.pmease.gitplex.web.page.repository.NoCommitsPage;
import com.pmease.gitplex.web.page.repository.RepositoryPage;
import com.pmease.gitplex.web.page.repository.pullrequest.NewRequestPage;
-import com.pmease.gitplex.web.page.repository.pullrequest.RequestOverviewPage;
import com.pmease.gitplex.web.page.repository.pullrequest.RequestDetailPage;
+import com.pmease.gitplex.web.page.repository.pullrequest.RequestOverviewPage;
@SuppressWarnings("serial")
public class BranchComparePage extends RepositoryPage {
@@ -337,13 +336,11 @@ public class BranchComparePage extends RepositoryPage {
});
- add(new CommitsTablePanel("tabPanel", commitsModel, repoModel).setOutputMarkupId(true));
-
add(new BackToTop("backToTop"));
}
private Component newCommitsPanel() {
- return new CommitsTablePanel("tabPanel", commitsModel, repoModel).setOutputMarkupId(true);
+ return new WebMarkupContainer("tabPanel").setOutputMarkupId(true);
}
private Component newChangedFilesPanel() {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/RepoCommitPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/RepoCommitPage.html
deleted file mode 100644
index 0255a14172..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/RepoCommitPage.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <div class="padder">
- <div class="commit">
- <div class="commit-head">
- <p class="title-message" wicket:id="shortmessage"></p>
- <wicket:container wicket:id="meta"></wicket:container>
-
- <ul class="piped">
- <li><span class="text-muted">commit</span> <span class="sha" wicket:id="commitsha"></span></li>
- <li><a wicket:id="treelink">Browse Code &rarr;</a></li>
- </ul>
- <p>
- <wicket:container wicket:id="parentslabel"></wicket:container>
- <wicket:container wicket:id="parents">
- <span wicket:id="connector">+</span>
- <a class="sha" wicket:id="link"><span wicket:id="sha"></span></a>
- </wicket:container>
- </p>
- <div class="in-refs">
- <div wicket:id="branches"></div>
- <div wicket:id="tags"></div>
- </div>
-
- <div class="author-avatar" wicket:id="authoravatar"></div>
- </div>
-
- <div class="commit-message">
- <pre class="detailed-message" wicket:id="detailedmessage"></pre>
- </div>
- </div>
-
- <div wicket:id="diffs"></div>
-
- <div wicket:id="comments"></div>
- </div>
-
- <wicket:fragment wicket:id="refsFrag">
- <i class="fa fa-ext fa-fw" wicket:id="type"></i>
- <wicket:container wicket:id="refs">
- <a class="inref" wicket:id="link"><span wicket:id="name"></span></a>
- </wicket:container>
- </wicket:fragment>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/RepoCommitPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/RepoCommitPage.java
deleted file mode 100644
index a7dd54feac..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/RepoCommitPage.java
+++ /dev/null
@@ -1,262 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.RestartResponseException;
-import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.hibernate.criterion.Restrictions;
-
-import com.google.common.collect.Iterables;
-import com.pmease.commons.git.Commit;
-import com.pmease.commons.git.GitUtils;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.dao.EntityCriteria;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.OldCommitComment;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Icon;
-import com.pmease.gitplex.web.component.commit.CommitMetaPanel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.PersonLink;
-import com.pmease.gitplex.web.git.command.CommitInCommand;
-import com.pmease.gitplex.web.git.command.CommitInCommand.RefType;
-import com.pmease.gitplex.web.page.repository.NoCommitsPage;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.CommentListPanel;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.CommitCommentsAware;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.DiffViewPanel;
-import com.pmease.gitplex.web.page.repository.code.tree.RepoTreePage;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
-
-@SuppressWarnings("serial")
-public class RepoCommitPage extends RepositoryPage implements CommitCommentsAware {
-
- private final IModel<Commit> commitModel;
-
- private final IModel<List<OldCommitComment>> commentsModel;
-
- public RepoCommitPage(PageParameters params) {
- super(params);
-
- if (!getRepository().git().hasCommits())
- throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
-
- this.commitModel = new LoadableDetachableModel<Commit>() {
-
- @Override
- protected Commit load() {
- String revision = getRepository().defaultBranchIfNull(getCurrentRevision());
- Repository repository = getRepository();
- return repository.git().showRevision(revision);
- }
- };
-
- this.commentsModel = new LoadableDetachableModel<List<OldCommitComment>>() {
-
- @Override
- protected List<OldCommitComment> load() {
- return loadComments();
- }
-
- };
- }
-
- private List<OldCommitComment> loadComments() {
- return GitPlex.getInstance(Dao.class).query(EntityCriteria.of(OldCommitComment.class)
- .add(Restrictions.eq("repository", getRepository()))
- .add(Restrictions.eq("commit", getUntil())));
- }
-
- private String getSince() {
- Commit commit = getCommit();
- return Iterables.getFirst(commit.getParentHashes(), null);
- }
-
- private String getUntil() {
- return getCommit().getHash();
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new Label("shortmessage", new PropertyModel<String>(commitModel, "subject")));
- add(new Label("detailedmessage", new PropertyModel<String>(commitModel, "message")));
-
- add(new BookmarkablePageLink<Void>("treelink",
- RepoTreePage.class,
- RepoTreePage.paramsOf(getRepository(), getCurrentRevision(), null)));
-
- TooltipConfig tooltipConfig = new TooltipConfig().withPlacement(TooltipConfig.Placement.left);
- add(new PersonLink("authoravatar", Model.of(getCommit().getAuthor()), AvatarMode.AVATAR)
- .withTooltipConfig(tooltipConfig));
-
- add(new CommitMetaPanel("meta", commitModel));
- add(new Label("commitsha", new PropertyModel<String>(commitModel, "hash")));
-
- IModel<List<String>> parentsModel = new AbstractReadOnlyModel<List<String>>() {
-
- @Override
- public List<String> getObject() {
- return getCommit().getParentHashes();
- }
- };
-
- add(new Label("parentslabel", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- int parents = getCommit().getParentHashes().size();
- if (parents == 0) {
- return "no parent";
- } else if (parents == 1) {
- return "1 parent";
- } else {
- return parents + " parents";
- }
- }
-
- }));
-
- ListView<String> parentsView = new ListView<String>("parents", parentsModel) {
- @Override
- protected void populateItem(ListItem<String> item) {
- String sha = item.getModelObject();
-
- AbstractLink link = new BookmarkablePageLink<Void>("link",
- RepoCommitPage.class, paramsOf(getRepository(), sha, null));
- item.add(link);
- link.add(new Label("sha", GitUtils.abbreviateSHA(sha)));
- WebMarkupContainer connector = new WebMarkupContainer("connector");
- int idx = item.getIndex();
- connector.setVisibilityAllowed(idx > 0);
- item.add(connector);
- }
- };
-
- add(parentsView);
-
- add(createInRefListView("branches", RefType.BRANCH));
- add(createInRefListView("tags", RefType.TAG));
- add(new DiffViewPanel("diffs", repoModel, getSince(), getUntil()));
-
- add(new CommentListPanel("comments", repoModel, new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return getCommit().getHash();
- }
-
- }));
- }
-
- private Component createInRefListView(String id, final RefType type) {
- return new AjaxLazyLoadPanel(id, new LoadableDetachableModel<List<String>>() {
-
- @Override
- protected List<String> load() {
- CommitInCommand command = new CommitInCommand(getRepository().git().repoDir());
- command.commit(getRepository().defaultBranchIfNull(getCurrentRevision())).in(type);
- return command.call();
- }
-
- }) {
-
- @SuppressWarnings("unchecked")
- List<String> getRefs() {
- return (List<String>) getDefaultModelObject();
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- this.setVisibilityAllowed(!getRefs().isEmpty());
- }
-
- @Override
- public Component getLoadingComponent(final String markupId) {
- return new WebMarkupContainer(markupId).setVisibilityAllowed(false);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Component getLazyLoadComponent(String markupId) {
- Fragment frag = new Fragment(markupId, "refsFrag", RepoCommitPage.this);
- frag.add(new Icon("type", Model.of("fa-" + type.name().toLowerCase())));
- frag.add(new ListView<String>("refs", (IModel<List<String>>) getDefaultModel()) {
-
- @Override
- protected void populateItem(ListItem<String> item) {
- String branchName = item.getModelObject();
- BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("link", RepoTreePage.class,
- RepoTreePage.paramsOf(getRepository(), branchName, null));
-
- link.add(new Label("name", branchName));
- item.add(link);
- }
-
- });
- return frag;
- }
-
- };
- }
-
- protected Commit getCommit() {
- return commitModel.getObject();
- }
-
- @Override
- public List<OldCommitComment> getCommitComments() {
- return commentsModel.getObject();
- }
-
- @Override
- public boolean isShowInlineComments() {
- return true;
- }
-
- @Override
- public boolean canAddComments() {
- return true;
- }
-
- @Override
- public void onDetach() {
- if (commitModel != null)
- commitModel.detach();
-
- if (commentsModel != null)
- commentsModel.detach();
-
- super.onDetach();
- }
-
- @Override
- protected String getPageTitle() {
- String revision = getRepository().defaultBranchIfNull(getCurrentRevision());
- if (GitUtils.isHash(revision)) {
- return getCommit().getSubject() + " - " + GitUtils.abbreviateSHA(revision, 8)
- + " - " + getRepository().getFQN();
- } else {
- return getCommit().getSubject() + " - " + revision
- + " - " + getRepository().getFQN();
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommentListPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommentListPanel.html
deleted file mode 100644
index 00b0857fac..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommentListPanel.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="comment-list-header clearfix" wicket:id="commentsHeader">
- <h2 class="pull-left"><span wicket:id="count"></span> notes on commit
- <small><span class="sha" wicket:id="sha"></span></small>
- <small class="text-muted">(<span wicket:id="inlinecount"></span> line notes)</small>
- </h2>
- <div class="pull-right">
- <span class="checkbox">
- <label>
- <input class="trigger-show-all-notes" type="checkbox" wicket:id="showAllTrigger" /> show line notes below
- </label>
- </span>
- </div>
- </div>
-
- <div class="comment-list">
- <div wicket:id="commentlist">
- <wicket:container wicket:id="comments">
- <div class="comment-holder media">
- <span class="comment-author pull-left">
- <wicket:container wicket:id="author"></wicket:container>
- </span>
- <div class="comment-body media-body">
- <div wicket:id="message"></div>
- </div>
- </div>
- </wicket:container>
- </div>
-
- <hr class="dash deep" />
-
- <div class="comment-holder media comment-form-container" wicket:id="formholder">
- <span class="pull-left comment-author">
- <wicket:container wicket:id="author"></wicket:container>
- </span>
- <div class="comment-body media-body">
- <div wicket:id="form"></div>
- </div>
- </div>
- </div>
-
- <wicket:fragment wicket:id="commenthead">
- <div class="clearfix">
- <span class="author" wicket:id="author"></span> commented on
- <a class="sha" wicket:id="commitlink"><span wicket:id="sha"></span></a>
- <a class="sha" wicket:id="linelink"><span wicket:id="lineid"></span></a>
- <span wicket:id="age"></span>
-
- <div class="actions right">
- <a wicket:id="editlink"><i class="fa fa-pencil"></i></a>
- <a wicket:id="removelink"><i class="fa fa-times"></i></a>
- </div>
- </div>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommentListPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommentListPanel.java
deleted file mode 100644
index f0e2262b29..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommentListPanel.java
+++ /dev/null
@@ -1,289 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.CheckBox;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.parboiled.common.Preconditions;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.pmease.commons.git.GitUtils;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.OldCommitComment;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.GitPlexSession;
-import com.pmease.gitplex.web.component.comment.OldCommitCommentEditor;
-import com.pmease.gitplex.web.component.comment.OldCommitCommentPanel;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentEvent;
-import com.pmease.gitplex.web.component.label.AgeLabel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.UserLink;
-import com.pmease.gitplex.web.model.CommitCommentModel;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
-
-@SuppressWarnings("serial")
-public class CommentListPanel extends Panel {
-
- private final IModel<Repository> repositoryModel;
- private final IModel<String> commitModel;
-
- private boolean showAllNotes = false;
-
- public CommentListPanel(String id,
- IModel<Repository> repositoryModel,
- IModel<String> commitModel) {
- super(id);
-
- this.repositoryModel = repositoryModel;
- this.commitModel = commitModel;
-
- setOutputMarkupId(true);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- final WebMarkupContainer commentsHolder = new WebMarkupContainer("commentlist");
- commentsHolder.setOutputMarkupId(true);
- add(commentsHolder);
-
- WebMarkupContainer commentsHeader = new WebMarkupContainer("commentsHeader");
- commentsHeader.setOutputMarkupId(true);
- add(commentsHeader);
- commentsHeader.add(new Label("count", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getCommentsOnCommit().size();
- }
-
- }));
-
- commentsHeader.add(new Label("inlinecount", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getCommentsOnLine().size();
- }
-
- }));
-
- commentsHeader.add(new Label("sha", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return GitUtils.abbreviateSHA(getCommit(), 6);
- }
-
- }));
-
- CheckBox check = new CheckBox("showAllTrigger", new PropertyModel<Boolean>(this, "showAllNotes"));
- commentsHeader.add(check);
-
- check.add(new AjaxFormComponentUpdatingBehavior("change") {
-
- @Override
- protected void onUpdate(AjaxRequestTarget target) {
- target.add(commentsHolder);
- }
- });
-
- IModel<List<OldCommitComment>> commentsModel = new LoadableDetachableModel<List<OldCommitComment>>() {
-
- @Override
- protected List<OldCommitComment> load() {
- if (showAllNotes) {
- return getCommitComments();
- } else {
- return getCommentsOnCommit();
- }
- }
- };
-
- commentsHolder.add(new ListView<OldCommitComment>("comments", commentsModel) {
-
- @Override
- protected void populateItem(ListItem<OldCommitComment> item) {
- OldCommitComment c = item.getModelObject();
- item.add(new UserLink("author", Model.of(c.getAuthor()), AvatarMode.AVATAR));
- item.add(new OldCommitCommentPanel("message", new CommitCommentModel(c)) {
- @Override
- protected Component createCommentHead(String id) {
-
- OldCommitComment comment = getCommitComment();
-
- Fragment frag = new Fragment(id, "commenthead", CommentListPanel.this);
- frag.add(new UserLink("author", Model.of(comment.getAuthor()), AvatarMode.NAME));
- AbstractLink link = new BookmarkablePageLink<Void>("commitlink",
- RepoCommitPage.class,
- RepoCommitPage.paramsOf(getRepository(), getCommit(), null));
- frag.add(link);
- link.add(new Label("sha", GitUtils.abbreviateSHA(getCommit(), 6)));
- frag.add(new AgeLabel("age", Model.of(comment.getUpdateDate())));
- frag.add(newEditLink("editlink"));
- frag.add(newRemoveLink("removelink"));
-
- WebMarkupContainer lineLink = new WebMarkupContainer("linelink");
- lineLink.setVisibilityAllowed(!Strings.isNullOrEmpty(comment.getLine()));
- lineLink.add(AttributeModifier.replace("href", "#" + comment.getLine()));
- lineLink.add(new Label("lineid", getShortLineId(comment.getLine())));
- frag.add(lineLink);
-
- return frag;
- }
- });
- }
- });
-
- WebMarkupContainer formHolder = new WebMarkupContainer("formholder") {
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisibilityAllowed(GitPlexSession.getCurrentUser().isPresent());
- }
- };
-
- add(formHolder);
- if (GitPlexSession.getCurrentUser().isPresent()) {
- formHolder.add(new UserLink("author", Model.of(GitPlexSession.getCurrentUser().get()), AvatarMode.AVATAR));
- formHolder.add(new OldCommitCommentEditor("form") {
-
- @Override
- protected void onCancel(AjaxRequestTarget target, Form<?> form) {
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- OldCommitComment c = new OldCommitComment();
- c.setAuthor(GitPlexSession.getCurrentUser().get());
- c.setCommit(getCommit());
- c.setRepository(getRepository());
- c.setContent(getCommentText());
-
- clearInput();
-
- GitPlex.getInstance(Dao.class).persist(c);
- onAddComment(target, c);
- }
-
- @Override
- protected Component createCancelButton(String id, Form<?> form) {
- return new WebMarkupContainer(id).setVisibilityAllowed(false);
- }
-
- @Override
- protected IModel<String> getSubmitButtonLabel() {
- return Model.of("Comment on this commit");
- }
-
- @Override
- protected Form<?> createForm(String id) {
- return new Form<Void>(id);
- }
- });
- } else {
- formHolder.add(new WebMarkupContainer("author").setVisibilityAllowed(false));
- formHolder.add(new WebMarkupContainer("form").setVisibilityAllowed(false));
- }
- }
-
- private List<OldCommitComment> getCommitComments() {
- Page page = getPage();
- Preconditions.checkState(page instanceof CommitCommentsAware);
- return ((CommitCommentsAware) page).getCommitComments();
- }
-
- private List<OldCommitComment> getCommentsOnCommit() {
- return Lists.newArrayList(Iterables.filter(getCommitComments(), new Predicate<OldCommitComment>() {
-
- @Override
- public boolean apply(OldCommitComment input) {
- return Strings.isNullOrEmpty(input.getLine());
- }
-
- }));
- }
-
- private List<OldCommitComment> getCommentsOnLine() {
- return Lists.newArrayList(Iterables.filter(getCommitComments(), new Predicate<OldCommitComment>() {
-
- @Override
- public boolean apply(OldCommitComment input) {
- return !Strings.isNullOrEmpty(input.getLine());
- }
-
- }));
- }
-
- public @Nullable String getShortLineId(String line) {
- if (Strings.isNullOrEmpty(line)) {
- return null;
- }
-
- int pos = line.indexOf("-");
- String hash = line.substring(0, pos);
- return GitUtils.abbreviateSHA(hash, 6) + line.substring(pos);
- }
-
- private void onAddComment(AjaxRequestTarget target, OldCommitComment c) {
- target.add(this);
- }
-
- @Override
- public void onEvent(IEvent<?> sink) {
- if (sink.getPayload() instanceof CommitCommentEvent) {
- CommitCommentEvent e = (CommitCommentEvent) sink.getPayload();
- if (showAllNotes || !e.getComment().isLineComment()) {
- e.getTarget().add(this);
- }
- }
- }
-
- private Repository getRepository() {
- return repositoryModel.getObject();
- }
-
- private String getCommit() {
- return commitModel.getObject();
- }
-
- @Override
- public void onDetach() {
- if (repositoryModel != null) {
- repositoryModel.detach();
- }
-
- if (commitModel != null) {
- commitModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommitCommentsAware.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommitCommentsAware.java
deleted file mode 100644
index 7cdebd5646..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/CommitCommentsAware.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff;
-
-import java.util.List;
-
-import com.pmease.gitplex.core.model.OldCommitComment;
-
-/**
- * Whether or this page is commit comments aware
- *
- */
-public interface CommitCommentsAware {
-
- List<OldCommitComment> getCommitComments();
-
- boolean isShowInlineComments();
-
- boolean canAddComments();
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffStatBar.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffStatBar.html
deleted file mode 100644
index f07c613c7d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffStatBar.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <strong wicket:id="totals"></strong>
- <span class="diffstat-bar">
- <i class="additions" wicket:id="additions"></i><i class="deletions" wicket:id="deletions"></i><wicket:container wicket:id="spacer"></wicket:container>
- </span>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffStatBar.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffStatBar.java
deleted file mode 100644
index ab52fa742f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffStatBar.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff;
-
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader.PatchType;
-
-@SuppressWarnings("serial")
-public class DiffStatBar extends Panel {
-
- public DiffStatBar(String id, IModel<FileHeader> fileModel) {
- super(id, fileModel);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new Label("totals", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- if (getFile().getPatchType() == PatchType.BINARY) {
- return "BIN";
- } else {
- return String.valueOf(getTotals());
- }
- }
- }));
-
- add(new Label("additions", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- int i = getAdditionBlocks();
- StringBuffer sb = new StringBuffer();
- while (i-- > 0) {
- sb.append("&#61556;");
- }
- return sb.toString();
- }
-
- }).setEscapeModelStrings(false));
-
- add(new Label("deletions", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- int i = getDeletionBlocks();
-
- StringBuffer sb = new StringBuffer();
- while (i-- > 0) {
- sb.append("&#61556;");
- }
- return sb.toString();
- }
- }).setEscapeModelStrings(false));
-
- add(new Label("spacer", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- int i = MAX_BLOCKS + 1 - getAdditionBlocks() - getDeletionBlocks();
-
- StringBuffer sb = new StringBuffer();
- while (i-- > 0) {
- sb.append("&#61556;");
- }
-
- return sb.toString();
- }
- }).setEscapeModelStrings(false));
- }
-
- static final int MAX_BLOCKS = 4;
-
- private int getAdditionBlocks() {
- int totals = getTotals();
-
- if (totals == 0) {
- if (getFile().getChangeType() != ChangeType.DELETE)
- return MAX_BLOCKS + 1;
- else
- return 0;
- }
-
- if (totals <= MAX_BLOCKS) {
- return getAdditions();
- }
-
- if (getChangeType() == ChangeType.ADD) {
- return MAX_BLOCKS;
- }
-
- return Math.round(Float.valueOf(getAdditions()) / getTotals() * MAX_BLOCKS);
- }
-
- private int getDeletionBlocks() {
- int totals = getTotals();
- if (totals == 0) {
- if (getFile().getChangeType() == ChangeType.DELETE)
- return MAX_BLOCKS + 1;
- else
- return 0;
- }
-
- if (totals <= MAX_BLOCKS)
- return getDeletions();
-
- if (getChangeType() == ChangeType.DELETE) {
- return MAX_BLOCKS;
- }
-
- return MAX_BLOCKS - getAdditionBlocks();
- }
-
- private ChangeType getChangeType() {
- return getFile().getChangeType();
- }
-
- private int getAdditions() {
- return getFile().getDiffStat().getAdditions();
- }
-
- private int getDeletions() {
- return getFile().getDiffStat().getDeletions();
- }
-
- private int getTotals() {
- return getAdditions() + getDeletions();
- }
-
- private FileHeader getFile() {
- return (FileHeader) getDefaultModelObject();
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffViewPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffViewPanel.html
deleted file mode 100644
index e0ed0926f4..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffViewPanel.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div id="diff-toc">
- <p class="diff-summary clearfix">
- <i class="fa fa-ext fa-file-diff text-muted"></i>
- <b wicket:id="changes"></b> files changed /
- <b class="additions"><span wicket:id="additions">1</span></b> additions /
- <b class="deletions"><span wicket:id="deletions">1</span></b> deletions
-
- <a class="btn btn-sm btn-gray btn-show" data-toggle="collapse" data-target="#files-stat">Show Diff Stats</a>
- <a class="btn btn-sm btn-gray btn-hide" data-toggle="collapse" data-target="#files-stat">Hide Diff Stats</a>
- </p>
-
- <div id="files-stat" class="collapse">
- <ul class="list-unstyled">
- <li wicket:id="fileitem">
- <i class="" wicket:id="icon"></i>
- <a wicket:id="link">
- <wicket:enclosure>
- <span wicket:id="oldpath"></span> &#10142;
- </wicket:enclosure>
- <span wicket:id="path"></span>
- </a>
- <a class="diffstat has-tip" wicket:id="statlink" data-toggle="tooltip" data-placement="left">
- <wicket:container wicket:id="statbar"></wicket:container>
- </a>
- </li>
- </ul>
- </div>
- </div>
-
- <div wicket:id="largecommitwarning"></div>
-
- <div class="panel panel-default panel-diff" wicket:id="filelist">
- <wicket:container wicket:id="file"></wicket:container>
- </div>
-
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffViewPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffViewPanel.java
deleted file mode 100644
index dc37d13e7e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/DiffViewPanel.java
+++ /dev/null
@@ -1,314 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.apache.tika.mime.MediaType;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-import org.parboiled.common.Preconditions;
-
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.commons.util.StringUtils;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.Constants;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Alert;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Icon;
-import com.pmease.gitplex.web.git.command.DiffTreeCommand;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader.PatchType;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.HunkHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.Patch;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.BlobMessagePanel;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image.ImageDiffPanel;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.text.TextDiffPanel;
-
-@SuppressWarnings("serial")
-public class DiffViewPanel extends Panel {
-
- private final IModel<Repository> repoModel;
-
- private final String sinceRevision;
-
- private final String untilRevision;
-
- private final IModel<Patch> patchModel;
-
- public DiffViewPanel(String id, IModel<Repository> repoModel, @Nullable String sinceRevision, String untilRevision) {
- super(id);
-
- this.repoModel = repoModel;
- this.sinceRevision = sinceRevision;
- this.untilRevision = Preconditions.checkNotNull(untilRevision);
-
- this.patchModel = new LoadableDetachableModel<Patch>() {
-
- @Override
- protected Patch load() {
- return loadPatch();
- }
-
- };
- }
-
- private Patch loadPatch() {
- Patch patch = new DiffTreeCommand(repoModel.getObject().git().repoDir())
- .since(sinceRevision)
- .until(untilRevision)
- .recurse(true) // -r
- .root(true) // --root
- .contextLines(Constants.DEFAULT_CONTEXT_LINES) // -U3
- .findRenames(true) // -M
- .call();
- return patch;
- }
-
- protected String getWarningMessage() {
- return "This commit contains too many changed files to render. "
- + "Showing only the first " + Constants.MAX_RENDERABLE_BLOBS
- + " changed files. You can still get all changes "
- + "manually by running below command: "
- + "<pre><code>git diff-tree --root -M -r -p "
- + (sinceRevision!=null?sinceRevision + " ":"") + untilRevision
- + "</code></pre>";
- }
-
- protected Alert createAlert(String id) {
- Alert alert = new Alert(id, new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return getWarningMessage();
- }
-
- }) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisibilityAllowed(getDiffPatch().getFiles().size() > Constants.MAX_RENDERABLE_BLOBS );
- }
- };
-
- alert
- .withHtmlMessage(true)
- .setCloseButtonVisible(true)
- .type(Alert.Type.Warning);
-
- return alert;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(createAlert("largecommitwarning"));
- createDiffToc();
- add(createFileList("filelist"));
- }
-
- protected Component createFileList(String id) {
- IModel<List<? extends FileHeader>> model = new LoadableDetachableModel<List<? extends FileHeader>>() {
-
- @Override
- protected List<? extends FileHeader> load() {
- return getDiffPatch().getFiles();
- }
- };
-
- return new ListView<FileHeader>(id, model) {
-
- @Override
- protected void populateItem(ListItem<FileHeader> item) {
- int index = item.getIndex();
- item.setMarkupId("diff-" + item.getIndex());
- item.add(createFileDiffPanel("file", item.getModel(), index));
- }
-
- };
- }
-
- private Component newMessagePanel(String id, int index, IModel<FileHeader> model, IModel<String> messageModel) {
- return new BlobMessagePanel(id, index, repoModel, model, sinceRevision, untilRevision, messageModel);
- }
-
- protected Component createFileDiffPanel(String id, IModel<FileHeader> model, int index) {
- FileHeader file = model.getObject();
- List<? extends HunkHeader> hunks = file.getHunks();
-
- if (hunks.isEmpty()) {
- // hunks is empty when this file is renamed, or the file is binary
- // or this file is just an empty file
- //
-
- // renamed without change
- if (file.getChangeType() == ChangeType.RENAME) {
- return newMessagePanel(id, index, model, Model.of("File renamed without changes"));
- }
-
- // binary file also including image file, so we need detect the
- // media type
- if (file.getPatchType() == PatchType.BINARY) {
- String path;
- if (file.getChangeType() == ChangeType.DELETE) {
- path = file.getOldPath();
- } else {
- path = file.getNewPath();
- }
-
- // fast detect the media type without loading file blob
- //
- MediaType mediaType = MediaTypes.detectFrom(new byte[0], path);
- if (MediaTypes.isImage(mediaType)
- && MediaTypes.isSafeInline(mediaType)) {
- return new ImageDiffPanel(id, index, repoModel, model, sinceRevision, untilRevision);
- } else {
- // other binary diffs
- return newMessagePanel(id, index, model, Model.of("File is a binary file"));
- }
- }
-
- // file is just an empty file
- return newMessagePanel(id, index, model, Model.of("File is empty"));
-
- } else {
- // blob is text and we can show diffs
-
- if (index > Constants.MAX_RENDERABLE_BLOBS) {
- // too many renderable blobs
- // only show diff stats instead of showing the contents
- //
- return newMessagePanel(id, index, model, Model.of(
- file.getDiffStat().getAdditions() + " additions, "
- + file.getDiffStat().getDeletions() + " deletions"));
- }
-
- if (hunks.size() > Constants.MAX_RENDERABLE_DIFF_LINES) {
- // don't show huge diff (exceed 10000 lines)
- //
- return newMessagePanel(id, index, model, Model.of(
- "<p>"
- + "The diff for this file is too large to render. "
- + "You can run below command to get the diff manually:"
- + "</p> "
- + "<pre><code>"
- + "git diff -C -M " + (sinceRevision!=null?sinceRevision:"") + " " + untilRevision + " -- "
- + StringUtils.quoteArgument(file.getNewPath())
- + "</code></pre>"));
- }
- }
-
- return new TextDiffPanel(id, index, repoModel, model, sinceRevision, untilRevision);
- }
-
-
- private final Patch getDiffPatch() {
- return patchModel.getObject();
- }
-
- private void createDiffToc() {
-
- add(new Label("changes", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getDiffPatch().getFiles().size();
- }
-
- }));
-
- add(new Label("additions", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getDiffPatch().getDiffStat().getAdditions();
- }
-
- }));
-
- add(new Label("deletions", new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getDiffPatch().getDiffStat().getDeletions();
- }
-
- }));
-
- add(new ListView<FileHeader>("fileitem", new AbstractReadOnlyModel<List<? extends FileHeader>>() {
-
- @Override
- public List<? extends FileHeader> getObject() {
- return getDiffPatch().getFiles();
- }
-
- }) {
-
- @Override
- protected void populateItem(ListItem<FileHeader> item) {
- FileHeader file = item.getModelObject();
- ChangeType changeType = file.getChangeType();
- item.add(new Icon("icon", getChangeIcon(changeType)).add(AttributeModifier.replace("title", changeType.name())));
- WebMarkupContainer link = new WebMarkupContainer("link");
- link.add(AttributeModifier.replace("href", "#diff-" + item.getIndex()));
- item.add(link);
- link.add(new Label("oldpath", Model.of(file.getOldPath())).setVisibilityAllowed(file.getChangeType() == ChangeType.RENAME));
- link.add(new Label("path", Model.of(file.getNewPath())));
-
- WebMarkupContainer statlink = new WebMarkupContainer("statlink");
- statlink.add(AttributeModifier.replace("href", "#diff-" + item.getIndex()));
- statlink.add(AttributeModifier.replace("title", file.getDiffStat().toString()));
-
- item.add(statlink);
- statlink.add(new DiffStatBar("statbar", item.getModel()));
- }
- });
- }
-
- private static String getChangeIcon(ChangeType changeType) {
- switch (changeType) {
- case ADD:
- return "fa-diff-added";
-
- case MODIFY:
- return "fa-diff-modified";
-
- case DELETE:
- return "fa-diff-removed";
-
- case RENAME:
- return "fa-diff-renamed";
-
- case COPY:
- return "fa-diff-copy";
- }
-
- throw new IllegalArgumentException("change type " + changeType);
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
- response.render(OnDomReadyHeaderItem.forScript("$('#diff-toc .btn').click(function() { $('#diff-toc').toggleClass('open');})"));
- }
-
- @Override
- public void onDetach() {
- repoModel.detach();
- patchModel.detach();
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/DiffStat.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/DiffStat.java
deleted file mode 100644
index f9cd2cb576..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/DiffStat.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.patch;
-
-public class DiffStat {
- int additions;
- int deletions;
-
- public int getAdditions() {
- return additions;
- }
-
- public int getDeletions() {
- return deletions;
- }
-
- public int getTotalChanges() {
- return additions + deletions;
- }
-
- @Override
- public String toString() {
- return additions + " additions & " + deletions + " deletions";
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/FileHeader.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/FileHeader.java
deleted file mode 100644
index c9eb2a0065..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/FileHeader.java
+++ /dev/null
@@ -1,577 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.patch;
-
-import static org.eclipse.jgit.lib.Constants.encodeASCII;
-import static org.eclipse.jgit.util.RawParseUtils.decode;
-import static org.eclipse.jgit.util.RawParseUtils.decodeNoFallback;
-import static org.eclipse.jgit.util.RawParseUtils.extractBinaryString;
-import static org.eclipse.jgit.util.RawParseUtils.match;
-import static org.eclipse.jgit.util.RawParseUtils.nextLF;
-import static org.eclipse.jgit.util.RawParseUtils.parseBase10;
-
-import java.io.IOException;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.Charset;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jgit.diff.DiffEntry;
-import org.eclipse.jgit.diff.EditList;
-import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.AbbreviatedObjectId;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.patch.BinaryHunk;
-import org.eclipse.jgit.util.QuotedString;
-import org.eclipse.jgit.util.RawParseUtils;
-import org.eclipse.jgit.util.TemporaryBuffer;
-
-/** Patch header describing an action for a single file path. */
-public class FileHeader extends DiffEntry {
- private static final byte[] OLD_MODE = encodeASCII("old mode "); //$NON-NLS-1$
-
- private static final byte[] NEW_MODE = encodeASCII("new mode "); //$NON-NLS-1$
-
- static final byte[] DELETED_FILE_MODE = encodeASCII("deleted file mode "); //$NON-NLS-1$
-
- static final byte[] NEW_FILE_MODE = encodeASCII("new file mode "); //$NON-NLS-1$
-
- private static final byte[] COPY_FROM = encodeASCII("copy from "); //$NON-NLS-1$
-
- private static final byte[] COPY_TO = encodeASCII("copy to "); //$NON-NLS-1$
-
- private static final byte[] RENAME_OLD = encodeASCII("rename old "); //$NON-NLS-1$
-
- private static final byte[] RENAME_NEW = encodeASCII("rename new "); //$NON-NLS-1$
-
- private static final byte[] RENAME_FROM = encodeASCII("rename from "); //$NON-NLS-1$
-
- private static final byte[] RENAME_TO = encodeASCII("rename to "); //$NON-NLS-1$
-
- private static final byte[] SIMILARITY_INDEX = encodeASCII("similarity index "); //$NON-NLS-1$
-
- private static final byte[] DISSIMILARITY_INDEX = encodeASCII("dissimilarity index "); //$NON-NLS-1$
-
- static final byte[] INDEX = encodeASCII("index "); //$NON-NLS-1$
-
- static final byte[] OLD_NAME = encodeASCII("--- "); //$NON-NLS-1$
-
- static final byte[] NEW_NAME = encodeASCII("+++ "); //$NON-NLS-1$
-
- /** Type of patch used by this file. */
- public static enum PatchType {
- /** A traditional unified diff style patch of a text file. */
- UNIFIED,
-
- /** An empty patch with a message "Binary files ... differ" */
- BINARY,
-
- /** A Git binary patch, holding pre and post image deltas */
- GIT_BINARY;
- }
-
- /** Buffer holding the patch data for this file. */
- final byte[] buf;
-
- /** Offset within {@link #buf} to the "diff ..." line. */
- final int startOffset;
-
- /** Position 1 past the end of this file within {@link #buf}. */
- int endOffset;
-
- /** Type of patch used to modify this file */
- PatchType patchType;
-
- /** The hunks of this file */
- private List<HunkHeader> hunks;
-
- /** If {@link #patchType} is {@link PatchType#GIT_BINARY}, the new image */
- BinaryHunk forwardBinaryHunk;
-
- /** If {@link #patchType} is {@link PatchType#GIT_BINARY}, the old image */
- BinaryHunk reverseBinaryHunk;
-
- final DiffStat diffStat = new DiffStat();
-
- /**
- * Constructs a new FileHeader
- *
- * @param headerLines
- * buffer holding the diff header for this file
- * @param edits
- * the edits for this file
- * @param type
- * the type of patch used to modify this file
- */
- public FileHeader(final byte[] headerLines, EditList edits, PatchType type) {
- this(headerLines, 0);
- endOffset = headerLines.length;
- int ptr = parseGitFileName(Patch.DIFF_GIT.length, headerLines.length);
- parseGitHeaders(ptr, headerLines.length);
- this.patchType = type;
- addHunk(new HunkHeader(this, edits));
- }
-
- FileHeader(final byte[] b, final int offset) {
- buf = b;
- startOffset = offset;
- changeType = ChangeType.MODIFY; // unless otherwise designated
- patchType = PatchType.UNIFIED;
- }
-
- int getParentCount() {
- return 1;
- }
-
- /** @return the byte array holding this file's patch script. */
- public byte[] getBuffer() {
- return buf;
- }
-
- /** @return offset the start of this file's script in {@link #getBuffer()}. */
- public int getStartOffset() {
- return startOffset;
- }
-
- /** @return offset one past the end of the file script. */
- public int getEndOffset() {
- return endOffset;
- }
-
- /**
- * Convert the patch script for this file into a string.
- * <p>
- * The default character encoding ({@link Constants#CHARSET}) is assumed for
- * both the old and new files.
- *
- * @return the patch script, as a Unicode string.
- */
- public String getScriptText() {
- return getScriptText(null, null);
- }
-
- /**
- * Convert the patch script for this file into a string.
- *
- * @param oldCharset
- * hint character set to decode the old lines with.
- * @param newCharset
- * hint character set to decode the new lines with.
- * @return the patch script, as a Unicode string.
- */
- public String getScriptText(Charset oldCharset, Charset newCharset) {
- return getScriptText(new Charset[] { oldCharset, newCharset });
- }
-
- String getScriptText(Charset[] charsetGuess) {
- if (getHunks().isEmpty()) {
- // If we have no hunks then we can safely assume the entire
- // patch is a binary style patch, or a meta-data only style
- // patch. Either way the encoding of the headers should be
- // strictly 7-bit US-ASCII and the body is either 7-bit ASCII
- // (due to the base 85 encoding used for a BinaryHunk) or is
- // arbitrary noise we have chosen to ignore and not understand
- // (e.g. the message "Binary files ... differ").
- //
- return extractBinaryString(buf, startOffset, endOffset);
- }
-
- if (charsetGuess != null && charsetGuess.length != getParentCount() + 1)
- throw new IllegalArgumentException(MessageFormat.format(
- JGitText.get().expectedCharacterEncodingGuesses,
- Integer.valueOf(getParentCount() + 1)));
-
- if (trySimpleConversion(charsetGuess)) {
- Charset cs = charsetGuess != null ? charsetGuess[0] : null;
- if (cs == null)
- cs = Constants.CHARSET;
- try {
- return decodeNoFallback(cs, buf, startOffset, endOffset);
- } catch (CharacterCodingException cee) {
- // Try the much slower, more-memory intensive version which
- // can handle a character set conversion patch.
- }
- }
-
- final StringBuilder r = new StringBuilder(endOffset - startOffset);
-
- // Always treat the headers as US-ASCII; Git file names are encoded
- // in a C style escape if any character has the high-bit set.
- //
- final int hdrEnd = getHunks().get(0).getStartOffset();
- for (int ptr = startOffset; ptr < hdrEnd;) {
- final int eol = Math.min(hdrEnd, nextLF(buf, ptr));
- r.append(extractBinaryString(buf, ptr, eol));
- ptr = eol;
- }
-
- final String[] files = extractFileLines(charsetGuess);
- final int[] offsets = new int[files.length];
- for (final HunkHeader h : getHunks())
- h.extractFileLines(r, files, offsets);
- return r.toString();
- }
-
- private static boolean trySimpleConversion(final Charset[] charsetGuess) {
- if (charsetGuess == null)
- return true;
- for (int i = 1; i < charsetGuess.length; i++) {
- if (charsetGuess[i] != charsetGuess[0])
- return false;
- }
- return true;
- }
-
- @SuppressWarnings("deprecation")
- private String[] extractFileLines(final Charset[] csGuess) {
- final TemporaryBuffer[] tmp = new TemporaryBuffer[getParentCount() + 1];
- try {
- for (int i = 0; i < tmp.length; i++)
- tmp[i] = new TemporaryBuffer.LocalFile();
- for (final HunkHeader h : getHunks())
- h.extractFileLines(tmp);
-
- final String[] r = new String[tmp.length];
- for (int i = 0; i < tmp.length; i++) {
- Charset cs = csGuess != null ? csGuess[i] : null;
- if (cs == null)
- cs = Constants.CHARSET;
- r[i] = RawParseUtils.decode(cs, tmp[i].toByteArray());
- }
- return r;
- } catch (IOException ioe) {
- throw new RuntimeException(JGitText.get().cannotConvertScriptToText, ioe);
- } finally {
- for (final TemporaryBuffer b : tmp) {
- if (b != null)
- b.destroy();
- }
- }
- }
-
- /** @return style of patch used to modify this file */
- public PatchType getPatchType() {
- return patchType;
- }
-
- /** @return true if this patch modifies metadata about a file */
- public boolean hasMetaDataChanges() {
- return changeType != ChangeType.MODIFY || newMode != oldMode;
- }
-
- /** @return hunks altering this file; in order of appearance in patch */
- public List<? extends HunkHeader> getHunks() {
- if (hunks == null)
- return Collections.emptyList();
- return hunks;
- }
-
- void addHunk(final HunkHeader h) {
- if (h.getFileHeader() != this)
- throw new IllegalArgumentException(JGitText.get().hunkBelongsToAnotherFile);
- if (hunks == null)
- hunks = new ArrayList<HunkHeader>();
- hunks.add(h);
- }
-
- HunkHeader newHunkHeader(final int offset) {
- return new HunkHeader(this, offset);
- }
-
- /** @return if a {@link PatchType#GIT_BINARY}, the new-image delta/literal */
- public BinaryHunk getForwardBinaryHunk() {
- return forwardBinaryHunk;
- }
-
- /** @return if a {@link PatchType#GIT_BINARY}, the old-image delta/literal */
- public BinaryHunk getReverseBinaryHunk() {
- return reverseBinaryHunk;
- }
-
- /** @return a list describing the content edits performed on this file. */
- public EditList toEditList() {
- final EditList r = new EditList();
- for (final HunkHeader hunk : hunks)
- r.addAll(hunk.toEditList());
- return r;
- }
-
- /**
- * Parse a "diff --git" or "diff --cc" line.
- *
- * @param ptr
- * first character after the "diff --git " or "diff --cc " part.
- * @param end
- * one past the last position to parse.
- * @return first character after the LF at the end of the line; -1 on error.
- */
- int parseGitFileName(int ptr, final int end) {
- final int eol = nextLF(buf, ptr);
- final int bol = ptr;
- if (eol >= end) {
- return -1;
- }
-
- // buffer[ptr..eol] looks like "a/foo b/foo\n". After the first
- // A regex to match this is "^[^/]+/(.*?) [^/+]+/\1\n$". There
- // is only one way to split the line such that text to the left
- // of the space matches the text to the right, excluding the part
- // before the first slash.
- //
-
- final int aStart = nextLF(buf, ptr, '/');
- if (aStart >= eol)
- return eol;
-
- while (ptr < eol) {
- final int sp = nextLF(buf, ptr, ' ');
- if (sp >= eol) {
- // We can't split the header, it isn't valid.
- // This may be OK if this is a rename patch.
- //
- return eol;
- }
- final int bStart = nextLF(buf, sp, '/');
- if (bStart >= eol)
- return eol;
-
- // If buffer[aStart..sp - 1] = buffer[bStart..eol - 1]
- // we have a valid split.
- //
- if (eq(aStart, sp - 1, bStart, eol - 1)) {
- if (buf[bol] == '"') {
- // We're a double quoted name. The region better end
- // in a double quote too, and we need to decode the
- // characters before reading the name.
- //
- if (buf[sp - 2] != '"') {
- return eol;
- }
- oldPath = QuotedString.GIT_PATH.dequote(buf, bol, sp - 1);
- oldPath = p1(oldPath);
- } else {
- oldPath = decode(Constants.CHARSET, buf, aStart, sp - 1);
- }
- newPath = oldPath;
- return eol;
- }
-
- // This split wasn't correct. Move past the space and try
- // another split as the space must be part of the file name.
- //
- ptr = sp;
- }
-
- return eol;
- }
-
- int parseGitHeaders(int ptr, final int end) {
- while (ptr < end) {
- final int eol = nextLF(buf, ptr);
- if (isHunkHdr(buf, ptr, eol) >= 1) {
- // First hunk header; break out and parse them later.
- break;
-
- } else if (match(buf, ptr, OLD_NAME) >= 0) {
- parseOldName(ptr, eol);
-
- } else if (match(buf, ptr, NEW_NAME) >= 0) {
- parseNewName(ptr, eol);
-
- } else if (match(buf, ptr, OLD_MODE) >= 0) {
- oldMode = parseFileMode(ptr + OLD_MODE.length, eol);
-
- } else if (match(buf, ptr, NEW_MODE) >= 0) {
- newMode = parseFileMode(ptr + NEW_MODE.length, eol);
-
- } else if (match(buf, ptr, DELETED_FILE_MODE) >= 0) {
- oldMode = parseFileMode(ptr + DELETED_FILE_MODE.length, eol);
- newMode = FileMode.MISSING;
- changeType = ChangeType.DELETE;
-
- } else if (match(buf, ptr, NEW_FILE_MODE) >= 0) {
- parseNewFileMode(ptr, eol);
-
- } else if (match(buf, ptr, COPY_FROM) >= 0) {
- oldPath = parseName(oldPath, ptr + COPY_FROM.length, eol);
- changeType = ChangeType.COPY;
-
- } else if (match(buf, ptr, COPY_TO) >= 0) {
- newPath = parseName(newPath, ptr + COPY_TO.length, eol);
- changeType = ChangeType.COPY;
-
- } else if (match(buf, ptr, RENAME_OLD) >= 0) {
- oldPath = parseName(oldPath, ptr + RENAME_OLD.length, eol);
- changeType = ChangeType.RENAME;
-
- } else if (match(buf, ptr, RENAME_NEW) >= 0) {
- newPath = parseName(newPath, ptr + RENAME_NEW.length, eol);
- changeType = ChangeType.RENAME;
-
- } else if (match(buf, ptr, RENAME_FROM) >= 0) {
- oldPath = parseName(oldPath, ptr + RENAME_FROM.length, eol);
- changeType = ChangeType.RENAME;
-
- } else if (match(buf, ptr, RENAME_TO) >= 0) {
- newPath = parseName(newPath, ptr + RENAME_TO.length, eol);
- changeType = ChangeType.RENAME;
-
- } else if (match(buf, ptr, SIMILARITY_INDEX) >= 0) {
- score = parseBase10(buf, ptr + SIMILARITY_INDEX.length, null);
-
- } else if (match(buf, ptr, DISSIMILARITY_INDEX) >= 0) {
- score = parseBase10(buf, ptr + DISSIMILARITY_INDEX.length, null);
-
- } else if (match(buf, ptr, INDEX) >= 0) {
- parseIndexLine(ptr + INDEX.length, eol);
-
- } else {
- // Probably an empty patch (stat dirty).
- break;
- }
-
- ptr = eol;
- }
- return ptr;
- }
-
- void parseOldName(int ptr, final int eol) {
- oldPath = p1(parseName(oldPath, ptr + OLD_NAME.length, eol));
- if (oldPath == DEV_NULL)
- changeType = ChangeType.ADD;
- }
-
- void parseNewName(int ptr, final int eol) {
- newPath = p1(parseName(newPath, ptr + NEW_NAME.length, eol));
- if (newPath == DEV_NULL)
- changeType = ChangeType.DELETE;
- }
-
- void parseNewFileMode(int ptr, final int eol) {
- oldMode = FileMode.MISSING;
- newMode = parseFileMode(ptr + NEW_FILE_MODE.length, eol);
- changeType = ChangeType.ADD;
- }
-
- int parseTraditionalHeaders(int ptr, final int end) {
- while (ptr < end) {
- final int eol = nextLF(buf, ptr);
- if (isHunkHdr(buf, ptr, eol) >= 1) {
- // First hunk header; break out and parse them later.
- break;
-
- } else if (match(buf, ptr, OLD_NAME) >= 0) {
- parseOldName(ptr, eol);
-
- } else if (match(buf, ptr, NEW_NAME) >= 0) {
- parseNewName(ptr, eol);
-
- } else {
- // Possibly an empty patch.
- break;
- }
-
- ptr = eol;
- }
- return ptr;
- }
-
- private String parseName(final String expect, int ptr, final int end) {
- if (ptr == end)
- return expect;
-
- String r;
- if (buf[ptr] == '"') {
- // New style GNU diff format
- //
- r = QuotedString.GIT_PATH.dequote(buf, ptr, end - 1);
- } else {
- // Older style GNU diff format, an optional tab ends the name.
- //
- int tab = end;
- while (ptr < tab && buf[tab - 1] != '\t')
- tab--;
- if (ptr == tab)
- tab = end;
- r = decode(Constants.CHARSET, buf, ptr, tab - 1);
- }
-
- if (r.equals(DEV_NULL))
- r = DEV_NULL;
- return r;
- }
-
- private static String p1(final String r) {
- final int s = r.indexOf('/');
- return s > 0 ? r.substring(s + 1) : r;
- }
-
- FileMode parseFileMode(int ptr, final int end) {
- int tmp = 0;
- while (ptr < end - 1) {
- tmp <<= 3;
- tmp += buf[ptr++] - '0';
- }
- return FileMode.fromBits(tmp);
- }
-
- void parseIndexLine(int ptr, final int end) {
- // "index $asha1..$bsha1[ $mode]" where $asha1 and $bsha1
- // can be unique abbreviations
- //
- final int dot2 = nextLF(buf, ptr, '.');
- final int mode = nextLF(buf, dot2, ' ');
-
- oldId = AbbreviatedObjectId.fromString(buf, ptr, dot2 - 1);
- newId = AbbreviatedObjectId.fromString(buf, dot2 + 1, mode - 1);
-
- if (mode < end)
- newMode = oldMode = parseFileMode(mode, end);
- }
-
- private boolean eq(int aPtr, int aEnd, int bPtr, int bEnd) {
- if (aEnd - aPtr != bEnd - bPtr) {
- return false;
- }
- while (aPtr < aEnd) {
- if (buf[aPtr++] != buf[bPtr++])
- return false;
- }
- return true;
- }
-
- /**
- * Determine if this is a patch hunk header.
- *
- * @param buf
- * the buffer to scan
- * @param start
- * first position in the buffer to evaluate
- * @param end
- * last position to consider; usually the end of the buffer (
- * <code>buf.length</code>) or the first position on the next
- * line. This is only used to avoid very long runs of '@' from
- * killing the scan loop.
- * @return the number of "ancestor revisions" in the hunk header. A
- * traditional two-way diff ("@@ -...") returns 1; a combined diff
- * for a 3 way-merge returns 3. If this is not a hunk header, 0 is
- * returned instead.
- */
- static int isHunkHdr(final byte[] buf, final int start, final int end) {
- int ptr = start;
- while (ptr < end && buf[ptr] == '@')
- ptr++;
- if (ptr - start < 2)
- return 0;
- if (ptr == end || buf[ptr++] != ' ')
- return 0;
- if (ptr == end || buf[ptr++] != '-')
- return 0;
- return (ptr - 3) - start;
- }
-
- public DiffStat getDiffStat() {
- return diffStat;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/FormatError.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/FormatError.java
deleted file mode 100644
index db8c7d71ee..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/FormatError.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.patch;
-
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.util.RawParseUtils;
-
-/** An error in a patch script */
-public class FormatError {
- /** Classification of an error. */
- public static enum Severity {
- /** The error is unexpected, but can be worked around. */
- WARNING,
-
- /** The error indicates the script is severely flawed. */
- ERROR;
- }
-
- private final byte[] buf;
-
- private final int offset;
-
- private final Severity severity;
-
- private final String message;
-
- FormatError(final byte[] buffer, final int ptr, final Severity sev,
- final String msg) {
- buf = buffer;
- offset = ptr;
- severity = sev;
- message = msg;
- }
-
- /** @return the severity of the error. */
- public Severity getSeverity() {
- return severity;
- }
-
- /** @return a message describing the error. */
- public String getMessage() {
- return message;
- }
-
- /** @return the byte buffer holding the patch script. */
- public byte[] getBuffer() {
- return buf;
- }
-
- /** @return byte offset within {@link #getBuffer()} where the error is */
- public int getOffset() {
- return offset;
- }
-
- /** @return line of the patch script the error appears on. */
- public String getLineText() {
- final int eol = RawParseUtils.nextLF(buf, offset);
- return RawParseUtils.decode(Constants.CHARSET, buf, offset, eol);
- }
-
- @Override
- public String toString() {
- final StringBuilder r = new StringBuilder();
- r.append(getSeverity().name().toLowerCase());
- r.append(": at offset "); //$NON-NLS-1$
- r.append(getOffset());
- r.append(": "); //$NON-NLS-1$
- r.append(getMessage());
- r.append("\n"); //$NON-NLS-1$
- r.append(" in "); //$NON-NLS-1$
- r.append(getLineText());
- return r.toString();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/HunkHeader.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/HunkHeader.java
deleted file mode 100644
index 3ae5ad5583..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/HunkHeader.java
+++ /dev/null
@@ -1,450 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.patch;
-
-import static org.eclipse.jgit.util.RawParseUtils.match;
-import static org.eclipse.jgit.util.RawParseUtils.nextLF;
-import static org.eclipse.jgit.util.RawParseUtils.parseBase10;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.jgit.diff.Edit;
-import org.eclipse.jgit.diff.EditList;
-import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.AbbreviatedObjectId;
-import org.eclipse.jgit.util.MutableInteger;
-import org.eclipse.jgit.util.RawParseUtils;
-
-import com.google.common.collect.Lists;
-import com.pmease.commons.util.Charsets;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.HunkLine.LineType;
-
-/** Hunk header describing the layout of a single block of lines */
-public class HunkHeader {
- /** Details about an old image of the file. */
- public abstract static class OldImage {
- /** First line number the hunk starts on in this file. */
- int startLine;
-
- /** Total number of lines this hunk covers in this file. */
- int lineCount;
-
- /** Number of lines deleted by the post-image from this file. */
- int nDeleted;
-
- /** Number of lines added by the post-image not in this file. */
- int nAdded;
-
- /** @return first line number the hunk starts on in this file. */
- public int getStartLine() {
- return startLine;
- }
-
- /** @return total number of lines this hunk covers in this file. */
- public int getLineCount() {
- return lineCount;
- }
-
- /** @return number of lines deleted by the post-image from this file. */
- public int getLinesDeleted() {
- return nDeleted;
- }
-
- /** @return number of lines added by the post-image not in this file. */
- public int getLinesAdded() {
- return nAdded;
- }
-
- /** @return object id of the pre-image file. */
- public abstract AbbreviatedObjectId getId();
- }
-
- final FileHeader file;
-
- /** Offset within {@link #file}.buf to the "@@ -" line. */
- final int startOffset;
-
- /** Position 1 past the end of this hunk within {@link #file}'s buf. */
- int endOffset;
-
- private final OldImage old;
-
- /** First line number in the post-image file where the hunk starts */
- int newStartLine;
-
- /** Total number of post-image lines this hunk covers (context + inserted) */
- int newLineCount;
-
- /** Total number of lines of context appearing in this hunk */
- int nContext;
-
- private EditList editList;
-
- HunkHeader(final FileHeader fh, final int offset) {
- this(fh, offset, new OldImage() {
- @Override
- public AbbreviatedObjectId getId() {
- return fh.getOldId();
- }
- });
- }
-
- HunkHeader(final FileHeader fh, final int offset, final OldImage oi) {
- file = fh;
- startOffset = offset;
- old = oi;
- }
-
- HunkHeader(final FileHeader fh, final EditList editList) {
- this(fh, fh.buf.length);
- this.editList = editList;
- endOffset = startOffset;
- nContext = 0;
- if (editList.isEmpty()) {
- newStartLine = 0;
- newLineCount = 0;
- } else {
- newStartLine = editList.get(0).getBeginB();
- Edit last = editList.get(editList.size() - 1);
- newLineCount = last.getEndB() - newStartLine;
- }
- }
-
- /** @return header for the file this hunk applies to */
- public FileHeader getFileHeader() {
- return file;
- }
-
- /** @return the byte array holding this hunk's patch script. */
- public byte[] getBuffer() {
- return file.buf;
- }
-
- /** @return offset the start of this hunk in {@link #getBuffer()}. */
- public int getStartOffset() {
- return startOffset;
- }
-
- /** @return offset one past the end of the hunk in {@link #getBuffer()}. */
- public int getEndOffset() {
- return endOffset;
- }
-
- /** @return information about the old image mentioned in this hunk. */
- public OldImage getOldImage() {
- return old;
- }
-
- /** @return first line number in the post-image file where the hunk starts */
- public int getNewStartLine() {
- return newStartLine;
- }
-
- /** @return Total number of post-image lines this hunk covers */
- public int getNewLineCount() {
- return newLineCount;
- }
-
- public int getNewEndLine() {
- return newStartLine + newLineCount - 1;
- }
-
- public int getOldEndLine() {
- return old.startLine + old.lineCount - 1;
- }
-
- /** @return total number of lines of context appearing in this hunk */
- public int getLinesContext() {
- return nContext;
- }
-
- /** @return a list describing the content edits performed within the hunk. */
- public EditList toEditList() {
- if (editList == null) {
- editList = new EditList();
- final byte[] buf = file.buf;
- int c = nextLF(buf, startOffset);
- int oLine = old.startLine;
- int nLine = newStartLine;
- Edit in = null;
-
- SCAN: for (; c < endOffset; c = nextLF(buf, c)) {
- switch (buf[c]) {
- case ' ':
- case '\n':
- in = null;
- oLine++;
- nLine++;
- continue;
-
- case '-':
- if (in == null) {
- in = new Edit(oLine - 1, nLine - 1);
- editList.add(in);
- }
- oLine++;
- in.extendA();
- continue;
-
- case '+':
- if (in == null) {
- in = new Edit(oLine - 1, nLine - 1);
- editList.add(in);
- }
- nLine++;
- in.extendB();
- continue;
-
- case '\\': // Matches "\ No newline at end of file"
- continue;
-
- default:
- break SCAN;
- }
- }
- }
- return editList;
- }
-
- String hunkFunction;
-
- void parseHeader() {
- // Parse "@@ -236,9 +236,9 @@ protected boolean"
- //
- final byte[] buf = file.buf;
- final MutableInteger ptr = new MutableInteger();
- ptr.value = nextLF(buf, startOffset, ' ');
- old.startLine = -parseBase10(buf, ptr.value, ptr);
- if (buf[ptr.value] == ',')
- old.lineCount = parseBase10(buf, ptr.value + 1, ptr);
- else
- old.lineCount = 1;
-
- newStartLine = parseBase10(buf, ptr.value + 1, ptr);
- if (buf[ptr.value] == ',')
- newLineCount = parseBase10(buf, ptr.value + 1, ptr);
- else
- newLineCount = 1;
-
- // decode from " @@ protected boolean"
- //
- this.hunkFunction = RawParseUtils.decode(buf, ptr.value + 4, nextLF(buf, ptr.value));
- if (this.hunkFunction.endsWith("\n")) {
- this.hunkFunction = this.hunkFunction.substring(0, hunkFunction.length() - 1);
- }
- }
-
- public String getHunkFunction() {
- return hunkFunction;
- }
-
- List<HunkLine> lines = Lists.newArrayList();
-
- public List<HunkLine> getLines() {
- return lines;
- }
-
- public Charset getCharset() {
- return Charsets.detectFrom(new ByteArrayInputStream(file.buf));
- }
-
- int parseBody(final Patch script, final int end) {
- final byte[] buf = file.buf;
-
- Charset charset = getCharset();
-
- int c = nextLF(buf, startOffset), last = c;
-
- old.nDeleted = 0;
- old.nAdded = 0;
-
- int oldLineNo = old.startLine;
- int newLineNo = newStartLine;
-
- HunkLine al = null;
- SCAN: for (; c < end; last = c, c = nextLF(buf, c)) {
- String line;
- int eol;
- switch (buf[c]) {
- case ' ':
- case '\n':
- nContext++;
- eol = nextLF(buf, c);
- line = RawParseUtils.decode(charset, buf, c + 1, eol - 1);
- al = new HunkLine(line, LineType.CONTEXT, oldLineNo, newLineNo);
- lines.add(al);
- oldLineNo++;
- newLineNo++;
- continue;
-
- case '-':
- old.nDeleted++;
- eol = nextLF(buf, c);
- line = RawParseUtils.decode(charset, buf, c + 1, eol - 1);
- al = new HunkLine(line, LineType.OLD, oldLineNo, -1);
- lines.add(al);
- file.diffStat.deletions++;
- script.diffStat.deletions++;
- oldLineNo++;
- continue;
-
- case '+':
- old.nAdded++;
- eol = nextLF(buf, c);
- line = RawParseUtils.decode(charset, buf, c + 1, eol - 1);
- al = new HunkLine(line, LineType.NEW, -1, newLineNo);
- lines.add(al);
- file.diffStat.additions++;
- script.diffStat.additions++;
- newLineNo++;
- continue;
-
- case '\\': // Matches "\ No newline at end of file"
- // no newline can occurred on either side, old line or new line
- //
- if (al != null) {
- al.noNewLine = true;
- }
- continue;
-
- default:
- break SCAN;
- }
- }
-
- if (last < end && nContext + old.nDeleted - 1 == old.lineCount
- && nContext + old.nAdded == newLineCount
- && match(buf, last, Patch.SIG_FOOTER) >= 0) {
- // This is an extremely common occurrence of "corruption".
- // Users add footers with their signatures after this mark,
- // and git diff adds the git executable version number.
- // Let it slide; the hunk otherwise looked sound.
- //
- old.nDeleted--;
- return last;
- }
-
- if (nContext + old.nDeleted < old.lineCount) {
- final int missingCount = old.lineCount - (nContext + old.nDeleted);
- script.error(buf, startOffset, MessageFormat.format(
- JGitText.get().truncatedHunkOldLinesMissing,
- Integer.valueOf(missingCount)));
-
- } else if (nContext + old.nAdded < newLineCount) {
- final int missingCount = newLineCount - (nContext + old.nAdded);
- script.error(buf, startOffset, MessageFormat.format(
- JGitText.get().truncatedHunkNewLinesMissing,
- Integer.valueOf(missingCount)));
-
- } else if (nContext + old.nDeleted > old.lineCount
- || nContext + old.nAdded > newLineCount) {
- final String oldcnt = old.lineCount + ":" + newLineCount; //$NON-NLS-1$
- final String newcnt = (nContext + old.nDeleted) + ":" //$NON-NLS-1$
- + (nContext + old.nAdded);
- script.warn(buf, startOffset, MessageFormat.format(
- JGitText.get().hunkHeaderDoesNotMatchBodyLineCountOf, oldcnt, newcnt));
- }
-
- return c;
- }
-
- void extractFileLines(final OutputStream[] out) throws IOException {
- final byte[] buf = file.buf;
- int ptr = startOffset;
- int eol = nextLF(buf, ptr);
- if (endOffset <= eol)
- return;
-
- // Treat the hunk header as though it were from the ancestor,
- // as it may have a function header appearing after it which
- // was copied out of the ancestor file.
- //
- out[0].write(buf, ptr, eol - ptr);
-
- SCAN: for (ptr = eol; ptr < endOffset; ptr = eol) {
- eol = nextLF(buf, ptr);
- switch (buf[ptr]) {
- case ' ':
- case '\n':
- case '\\':
- out[0].write(buf, ptr, eol - ptr);
- out[1].write(buf, ptr, eol - ptr);
- break;
- case '-':
- out[0].write(buf, ptr, eol - ptr);
- break;
- case '+':
- out[1].write(buf, ptr, eol - ptr);
- break;
- default:
- break SCAN;
- }
- }
- }
-
- void extractFileLines(final StringBuilder sb, final String[] text,
- final int[] offsets) {
- final byte[] buf = file.buf;
- int ptr = startOffset;
- int eol = nextLF(buf, ptr);
- if (endOffset <= eol)
- return;
- copyLine(sb, text, offsets, 0);
- SCAN: for (ptr = eol; ptr < endOffset; ptr = eol) {
- eol = nextLF(buf, ptr);
- switch (buf[ptr]) {
- case ' ':
- case '\n':
- case '\\':
- copyLine(sb, text, offsets, 0);
- skipLine(text, offsets, 1);
- break;
- case '-':
- copyLine(sb, text, offsets, 0);
- break;
- case '+':
- copyLine(sb, text, offsets, 1);
- break;
- default:
- break SCAN;
- }
- }
- }
-
- void copyLine(final StringBuilder sb, final String[] text,
- final int[] offsets, final int fileIdx) {
- final String s = text[fileIdx];
- final int start = offsets[fileIdx];
- int end = s.indexOf('\n', start);
- if (end < 0)
- end = s.length();
- else
- end++;
- sb.append(s, start, end);
- offsets[fileIdx] = end;
- }
-
- void skipLine(final String[] text, final int[] offsets,
- final int fileIdx) {
- final String s = text[fileIdx];
- final int end = s.indexOf('\n', offsets[fileIdx]);
- offsets[fileIdx] = end < 0 ? s.length() : end + 1;
- }
-
- @SuppressWarnings("nls")
- @Override
- public String toString() {
- StringBuilder buf = new StringBuilder();
- buf.append("HunkHeader[");
- buf.append(getOldImage().getStartLine());
- buf.append(',');
- buf.append(getOldImage().getLineCount());
- buf.append("->");
- buf.append(getNewStartLine()).append(',').append(getNewLineCount());
- buf.append(']');
- return buf.toString();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/HunkLine.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/HunkLine.java
deleted file mode 100644
index d3ad6b23d6..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/HunkLine.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.patch;
-
-import java.io.Serializable;
-
-@SuppressWarnings("serial")
-public class HunkLine implements Serializable {
-
- public static enum LineType {
- CONTEXT,
- OLD,
- NEW
- }
-
- final String text;
- final LineType lineType;
- final int oldLineNo;
- final int newLineNo;
-
- boolean noNewLine = false;
-
- public static class Builder {
- String text;
- LineType lineType;
- int oldLineNo;
- int newLineNo;
-
- public Builder text(String text) {
- this.text = text;
- return this;
- }
-
- public Builder lineType(LineType lineType) {
- this.lineType = lineType;
- return this;
- }
-
- public Builder oldLineNo(int oldLineNo) {
- this.oldLineNo = oldLineNo;
- return this;
- }
-
- public Builder newLineNo(int newLineNo) {
- this.newLineNo = newLineNo;
- return this;
- }
-
- public HunkLine build() {
- return new HunkLine(text, lineType, oldLineNo, newLineNo);
- }
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public HunkLine(String text, LineType lineType, int oldLineNo, int newLineNo) {
- this.text = text;
- this.lineType = lineType;
- this.oldLineNo = oldLineNo;
- this.newLineNo = newLineNo;
- }
-
- public boolean isNoNewLine() {
- return noNewLine;
- }
-
- public void setNoNewLine(boolean noNewLine) {
- this.noNewLine = noNewLine;
- }
-
- public String getText() {
- return text;
- }
-
- public LineType getLineType() {
- return lineType;
- }
-
- public int getOldLineNo() {
- return oldLineNo;
- }
-
- public int getNewLineNo() {
- return newLineNo;
- }
-
- @Override
- public String toString() {
- switch (lineType) {
-
- case CONTEXT:
- return " " + text;
-
- case OLD:
- return "-" + text;
-
- case NEW:
- return "+" + text;
-
- default:
- throw new IllegalArgumentException();
- }
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/Patch.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/Patch.java
deleted file mode 100644
index 0f8fce61fb..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/patch/Patch.java
+++ /dev/null
@@ -1,360 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.patch;
-
-import static com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader.NEW_NAME;
-import static com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader.OLD_NAME;
-import static com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader.isHunkHdr;
-import static org.eclipse.jgit.lib.Constants.encodeASCII;
-import static org.eclipse.jgit.util.RawParseUtils.match;
-import static org.eclipse.jgit.util.RawParseUtils.nextLF;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.util.TemporaryBuffer;
-
-public class Patch {
- static final byte[] DIFF_GIT = encodeASCII("diff --git "); //$NON-NLS-1$
-
- private static final byte[] DIFF_CC = encodeASCII("diff --cc "); //$NON-NLS-1$
-
- private static final byte[] DIFF_COMBINED = encodeASCII("diff --combined "); //$NON-NLS-1$
-
- private static final byte[][] BIN_HEADERS = new byte[][] {
- encodeASCII("Binary files "), encodeASCII("Files "), }; //$NON-NLS-1$ //$NON-NLS-2$
-
- private static final byte[] BIN_TRAILER = encodeASCII(" differ\n"); //$NON-NLS-1$
-
- private static final byte[] GIT_BINARY = encodeASCII("GIT binary patch\n"); //$NON-NLS-1$
-
- static final byte[] SIG_FOOTER = encodeASCII("-- \n"); //$NON-NLS-1$
-
- /** The files, in the order they were parsed out of the input. */
- private final List<FileHeader> files;
-
- /** Formatting errors, if any were identified. */
- private final List<FormatError> errors;
-
- final DiffStat diffStat = new DiffStat();
-
- /** Create an empty patch. */
- public Patch() {
- files = new ArrayList<FileHeader>();
- errors = new ArrayList<FormatError>(0);
- }
-
- /**
- * Add a single file to this patch.
- * <p>
- * Typically files should be added by parsing the text through one of this
- * class's parse methods.
- *
- * @param fh
- * the header of the file.
- */
- public void addFile(final FileHeader fh) {
- files.add(fh);
- }
-
- /** @return list of files described in the patch, in occurrence order. */
- public List<? extends FileHeader> getFiles() {
- return files;
- }
-
- /**
- * Add a formatting error to this patch script.
- *
- * @param err
- * the error description.
- */
- public void addError(final FormatError err) {
- errors.add(err);
- }
-
- /** @return collection of formatting errors, if any. */
- public List<FormatError> getErrors() {
- return errors;
- }
-
- /**
- * Parse a patch received from an InputStream.
- * <p>
- * Multiple parse calls on the same instance will concatenate the patch
- * data, but each parse input must start with a valid file header (don't
- * split a single file across parse calls).
- *
- * @param is
- * the stream to read the patch data from. The stream is read
- * until EOF is reached.
- * @throws IOException
- * there was an error reading from the input stream.
- */
- public void parse(final InputStream is) throws IOException {
- final byte[] buf = readFully(is);
- parse(buf, 0, buf.length);
- }
-
- @SuppressWarnings("deprecation")
- private static byte[] readFully(final InputStream is) throws IOException {
- final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
- try {
- b.copy(is);
- b.close();
- return b.toByteArray();
- } finally {
- b.destroy();
- }
- }
-
- /**
- * Parse a patch stored in a byte[].
- * <p>
- * Multiple parse calls on the same instance will concatenate the patch
- * data, but each parse input must start with a valid file header (don't
- * split a single file across parse calls).
- *
- * @param buf
- * the buffer to parse.
- * @param ptr
- * starting position to parse from.
- * @param end
- * 1 past the last position to end parsing. The total length to
- * be parsed is <code>end - ptr</code>.
- */
- public void parse(final byte[] buf, int ptr, final int end) {
- while (ptr < end)
- ptr = parseFile(buf, ptr, end);
- }
-
- private int parseFile(final byte[] buf, int c, final int end) {
- while (c < end) {
- if (isHunkHdr(buf, c, end) >= 1) {
- // If we find a disconnected hunk header we might
- // have missed a file header previously. The hunk
- // isn't valid without knowing where it comes from.
- //
- error(buf, c, JGitText.get().hunkDisconnectedFromFile);
- c = nextLF(buf, c);
- continue;
- }
-
- // Valid git style patch?
- //
- if (match(buf, c, DIFF_GIT) >= 0)
- return parseDiffGit(buf, c, end);
- if (match(buf, c, DIFF_CC) >= 0)
- return parseDiffCombined(DIFF_CC, buf, c, end);
- if (match(buf, c, DIFF_COMBINED) >= 0)
- return parseDiffCombined(DIFF_COMBINED, buf, c, end);
-
- // Junk between files? Leading junk? Traditional
- // (non-git generated) patch?
- //
- final int n = nextLF(buf, c);
- if (n >= end) {
- // Patches cannot be only one line long. This must be
- // trailing junk that we should ignore.
- //
- return end;
- }
-
- if (n - c < 6) {
- // A valid header must be at least 6 bytes on the
- // first line, e.g. "--- a/b\n".
- //
- c = n;
- continue;
- }
-
- if (match(buf, c, OLD_NAME) >= 0 && match(buf, n, NEW_NAME) >= 0) {
- // Probably a traditional patch. Ensure we have at least
- // a "@@ -0,0" smelling line next. We only check the "@@ -".
- //
- final int f = nextLF(buf, n);
- if (f >= end)
- return end;
- if (isHunkHdr(buf, f, end) == 1)
- return parseTraditionalPatch(buf, c, end);
- }
-
- c = n;
- }
- return c;
- }
-
- private int parseDiffGit(final byte[] buf, final int start, final int end) {
- final FileHeader fh = new FileHeader(buf, start);
- int ptr = fh.parseGitFileName(start + DIFF_GIT.length, end);
- if (ptr < 0)
- return skipFile(buf, start);
-
- ptr = fh.parseGitHeaders(ptr, end);
- ptr = parseHunks(fh, ptr, end);
- fh.endOffset = ptr;
- addFile(fh);
- return ptr;
- }
-
- private int parseDiffCombined(final byte[] hdr, final byte[] buf,
- final int start, final int end) {
- throw new UnsupportedOperationException();
- }
-
- private int parseTraditionalPatch(final byte[] buf, final int start,
- final int end) {
- throw new UnsupportedOperationException();
- }
-
-// private int parseDiffCombined(final byte[] hdr, final byte[] buf,
-// final int start, final int end) {
-// final CombinedFileHeader fh = new CombinedFileHeader(buf, start);
-// int ptr = fh.parseGitFileName(start + hdr.length, end);
-// if (ptr < 0)
-// return skipFile(buf, start);
-//
-// ptr = fh.parseGitHeaders(ptr, end);
-// ptr = parseHunks(fh, ptr, end);
-// fh.endOffset = ptr;
-// addFile(fh);
-// return ptr;
-// }
-
-// private int parseTraditionalPatch(final byte[] buf, final int start,
-// final int end) {
-// final FileHeader fh = new FileHeader(buf, start);
-// int ptr = fh.parseTraditionalHeaders(start, end);
-// ptr = parseHunks(fh, ptr, end);
-// fh.endOffset = ptr;
-// addFile(fh);
-// return ptr;
-// }
-
- private static int skipFile(final byte[] buf, int ptr) {
- ptr = nextLF(buf, ptr);
- if (match(buf, ptr, OLD_NAME) >= 0)
- ptr = nextLF(buf, ptr);
- return ptr;
- }
-
- private int parseHunks(final FileHeader fh, int c, final int end) {
- final byte[] buf = fh.buf;
- while (c < end) {
- // If we see a file header at this point, we have all of the
- // hunks for our current file. We should stop and report back
- // with this position so it can be parsed again later.
- //
- if (match(buf, c, DIFF_GIT) >= 0)
- break;
- if (match(buf, c, DIFF_CC) >= 0)
- break;
- if (match(buf, c, DIFF_COMBINED) >= 0)
- break;
- if (match(buf, c, OLD_NAME) >= 0)
- break;
- if (match(buf, c, NEW_NAME) >= 0)
- break;
-
- if (isHunkHdr(buf, c, end) == fh.getParentCount()) {
- final HunkHeader h = fh.newHunkHeader(c);
- h.parseHeader();
- c = h.parseBody(this, end);
- h.endOffset = c;
- fh.addHunk(h);
- if (c < end) {
- switch (buf[c]) {
- case '@':
- case 'd':
- case '\n':
- break;
- default:
- if (match(buf, c, SIG_FOOTER) < 0)
- warn(buf, c, JGitText.get().unexpectedHunkTrailer);
- }
- }
- continue;
- }
-
- final int eol = nextLF(buf, c);
- if (fh.getHunks().isEmpty() && match(buf, c, GIT_BINARY) >= 0) {
- fh.patchType = FileHeader.PatchType.GIT_BINARY;
- return parseGitBinary(fh, eol, end);
- }
-
- if (fh.getHunks().isEmpty() && BIN_TRAILER.length < eol - c
- && match(buf, eol - BIN_TRAILER.length, BIN_TRAILER) >= 0
- && matchAny(buf, c, BIN_HEADERS)) {
- // The patch is a binary file diff, with no deltas.
- //
- fh.patchType = FileHeader.PatchType.BINARY;
- return eol;
- }
-
- // Skip this line and move to the next. Its probably garbage
- // after the last hunk of a file.
- //
- c = eol;
- }
-
- if (fh.getHunks().isEmpty()
- && fh.getPatchType() == FileHeader.PatchType.UNIFIED
- && !fh.hasMetaDataChanges()) {
- // Hmm, an empty patch? If there is no metadata here we
- // really have a binary patch that we didn't notice above.
- //
- fh.patchType = FileHeader.PatchType.BINARY;
- }
-
- return c;
- }
-
- private int parseGitBinary(final FileHeader fh, int c, final int end) {
- throw new UnsupportedOperationException();
- }
-
-// private int parseGitBinary(final FileHeader fh, int c, final int end) {
-// final BinaryHunk postImage = new BinaryHunk(fh, c);
-// final int nEnd = postImage.parseHunk(c, end);
-// if (nEnd < 0) {
-// // Not a binary hunk.
-// //
-// error(fh.buf, c, JGitText.get().missingForwardImageInGITBinaryPatch);
-// return c;
-// }
-// c = nEnd;
-// postImage.endOffset = c;
-// fh.forwardBinaryHunk = postImage;
-//
-// final BinaryHunk preImage = new BinaryHunk(fh, c);
-// final int oEnd = preImage.parseHunk(c, end);
-// if (oEnd >= 0) {
-// c = oEnd;
-// preImage.endOffset = c;
-// fh.reverseBinaryHunk = preImage;
-// }
-//
-// return c;
-// }
-
- void warn(final byte[] buf, final int ptr, final String msg) {
- addError(new FormatError(buf, ptr, FormatError.Severity.WARNING, msg));
- }
-
- void error(final byte[] buf, final int ptr, final String msg) {
- addError(new FormatError(buf, ptr, FormatError.Severity.ERROR, msg));
- }
-
- private static boolean matchAny(final byte[] buf, final int c,
- final byte[][] srcs) {
- for (final byte[] s : srcs) {
- if (match(buf, c, s) >= 0)
- return true;
- }
- return false;
- }
-
- public DiffStat getDiffStat() {
- return diffStat;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobDiffPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobDiffPanel.html
deleted file mode 100644
index 536ca14820..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobDiffPanel.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="panel-heading clearfix">
- <div class="pull-left meta">
- <span class="diffstat inline has-tip" data-toggle="tooltip" data-placement="right" wicket:id="statspan">
- <wicket:container wicket:id="stat"></wicket:container>
- </span>
-
- <span class="path" wicket:id="path"></span>
- </div>
- <div class="actions pull-right">
- <span wicket:id="actions"></span>
- <a class="btn btn-default btn-sm has-tip" wicket:id="bloblink" title="View the whole file at this revision">View</a>
- </div>
- </div>
- <div class="panel-body">
- <div wicket:id="diffcontent"></div>
- </div>
-
- <wicket:child></wicket:child>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobDiffPanel.java
deleted file mode 100644
index 0eadc967f0..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobDiffPanel.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-import org.eclipse.jgit.diff.DiffEntry.Side;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.blob.RepoBlobPage;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.DiffStatBar;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-@SuppressWarnings("serial")
-public abstract class BlobDiffPanel extends Panel {
-
- protected final IModel<Repository> repoModel;
-
- protected final String sinceRevision;
-
- protected final String untilRevision;
-
- // protected final IModel<List<CommitComment>> commentsModel;
-
- protected final int index;
-
- abstract protected Component createActionsBar(String id);
-
- abstract protected Component createDiffContent(String id);
-
- protected final String markupId;
-
- public BlobDiffPanel(String id,
- final int index,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- String sinceRevision,
- String untilRevision) {
- super(id, fileModel);
-
- this.index = index;
- this.markupId = "diff-" + index;
- this.repoModel = repoModel;
- this.sinceRevision = sinceRevision;
- this.untilRevision = untilRevision;
-// this.commentsModel = commentsModel;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- WebMarkupContainer statspan = new WebMarkupContainer("statspan");
- add(statspan);
- statspan.add(AttributeModifier.replace("title", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return getFile().getDiffStat().toString();
- }
-
- }));
-
- statspan.add(new DiffStatBar("stat", (IModel<FileHeader>) getDefaultModel()));
-
- add(new Label("path", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- String path;
- FileHeader file = getFile();
- if (file.getChangeType() == ChangeType.RENAME) {
- path = file.getPath(Side.OLD) + " &#10142; " + file.getPath(Side.NEW);
- } else if (file.getChangeType() == ChangeType.DELETE) {
- path = file.getPath(Side.OLD);
- } else {
- path = file.getPath(Side.NEW);
- }
-
- return path;
- }
- }).setEscapeModelStrings(false));
-
- String path = getFile().getNewPath();
- AbstractLink blobLink = new BookmarkablePageLink<Void>("bloblink",
- RepoBlobPage.class,
- RepoBlobPage.paramsOf(repoModel.getObject(),
- untilRevision,
- path));
- blobLink.setVisibilityAllowed(getFile().getChangeType() != ChangeType.DELETE);
- add(blobLink);
-// blobLink.add(new Label("sha", Model.of(GitUtils.abbreviateSHA(until, 6))));
-
- add(createActionsBar("actions"));
- add(createDiffContent("diffcontent"));
- }
-
- protected FileHeader getFile() {
- return (FileHeader) getDefaultModelObject();
- }
-
- @SuppressWarnings("unchecked")
- protected IModel<FileHeader> getFileModel() {
- return (IModel<FileHeader>) getDefaultModel();
- }
-
- @Override
- public void onDetach() {
- repoModel.detach();
-
-// if (commentsModel != null) {
-// commentsModel.detach();
-// }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobMessagePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobMessagePanel.java
deleted file mode 100644
index 3a02ff66d3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/BlobMessagePanel.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Alert;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-@SuppressWarnings("serial")
-public class BlobMessagePanel extends BlobDiffPanel {
-
- private final IModel<String> messageModel;
-
- public BlobMessagePanel(String id,
- int index,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- String sinceRevision,
- String untilRevision,
- IModel<String> messageModel) {
- super(id, index, repoModel, fileModel, sinceRevision, untilRevision);
-
- this.messageModel = messageModel;
- }
-
- @Override
- protected Component createActionsBar(String id) {
- return new WebMarkupContainer(id).setVisibilityAllowed(false);
- }
-
- @Override
- protected Component createDiffContent(String id) {
- Alert alert = new Alert(id, messageModel);
- alert.type(Alert.Type.Warning).setCloseButtonVisible(false);
- alert.withHtmlMessage(true);
- return alert;
- }
-
- @Override
- public void onDetach() {
- if (messageModel != null)
- messageModel.detach();
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/AbstractImageDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/AbstractImageDiffPanel.java
deleted file mode 100644
index 3d11022cae..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/AbstractImageDiffPanel.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-@SuppressWarnings("serial")
-public class AbstractImageDiffPanel extends Panel {
-
- protected final IModel<Repository> repoModel;
- protected final IModel<FileHeader> fileModel;
- protected final String sinceRevision;
- protected final String untilRevision;
-
- public AbstractImageDiffPanel(String id,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- String sinceRevision,
- String untilRevision) {
-
- super(id);
-
- this.repoModel = repoModel;
- this.fileModel = fileModel;
- this.sinceRevision = sinceRevision;
- this.untilRevision = untilRevision;
-
- setOutputMarkupId(true);
- }
-
- protected Repository getRepository() {
- return repoModel.getObject();
- }
-
- protected FileHeader getFile() {
- return fileModel.getObject();
- }
-
- @Override
- public void onDetach() {
- repoModel.detach();
- fileModel.detach();
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/BlendPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/BlendPanel.html
deleted file mode 100644
index f7b6bf8194..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/BlendPanel.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="image blend-view">
- <div class="old-frame">
- <img class="oldimg" wicket:id="old" />
- </div>
-
- <div class="new-frame">
- <img class="newimg" wicket:id="new" />
- </div>
- </div>
-
- <div class="slider">
- <b class="old">OLD</b> <input type="range" value="100" min="1" max="100" step="1" wicket:id="slider" /> <b class="new">NEW</b>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/BlendPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/BlendPanel.java
deleted file mode 100644
index 27a8588da0..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/BlendPanel.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.google.common.base.Strings;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.FileBlobImage;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-@SuppressWarnings("serial")
-public class BlendPanel extends AbstractImageDiffPanel {
-
- public BlendPanel(String id,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- String sinceRevision,
- String untilRevision) {
- super(id, repoModel, fileModel, sinceRevision, untilRevision);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- FileHeader file = getFile();
-
- if (file.getChangeType() == ChangeType.ADD || Strings.isNullOrEmpty(sinceRevision)) {
- add(new WebMarkupContainer("old").setVisibilityAllowed(false));
- } else {
- add(new FileBlobImage("old",
- getRepository(),
- sinceRevision,
- file.getOldPath()));
- }
-
- if (file.getChangeType() == ChangeType.DELETE) {
- add(new WebMarkupContainer("new").setVisibilityAllowed(false));
- } else {
- add(new FileBlobImage("new",
- getRepository(),
- untilRevision,
- file.getNewPath()));
- }
-
- add(new WebMarkupContainer("slider").setOutputMarkupId(true));
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript(getInitScript()));
- }
-
- private String getInitScript() {
- String containerId = "#" + getMarkupId(true);
- String oldImageId = containerId + " .oldimg";
- String newImageId = containerId + " .newimg";
- String imageWrapper = containerId + " .blend-view";
-
- String sliderId = get("slider").getMarkupId();
-
- String func = String.format(
- "$('#%s').on('change', function() {\n"
- + "$('%s').css('opacity', $(this).val() / 100);});",
- sliderId, newImageId);
-
- String str =
- String.format(
- "gitplex.utils.onImageLoad('%s', function() {\n"
- + " gitplex.utils.onImageLoad('%s', function() {\n"
- + " $('%s').css('height', Math.max($('%s').height(), $('%s').height()));\n"
- + " %s"
- + "}); \n});",
- oldImageId,
- newImageId,
- imageWrapper,
- oldImageId,
- newImageId,
- func);
- return str;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/DifferencePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/DifferencePanel.html
deleted file mode 100644
index f7d30eed70..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/DifferencePanel.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="image difference-view">
- <div class="old-frame">
- <img wicket:id="old" />
- </div>
-
- <div class="new-frame">
- <img wicket:id="new" />
- </div>
- </div>
-
- <div class="difference-control" wicket:id="differenceControl"></div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/DifferencePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/DifferencePanel.java
deleted file mode 100644
index 6bdabbbcd1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/DifferencePanel.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.google.common.base.Strings;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.FileBlobImage;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-@SuppressWarnings("serial")
-public class DifferencePanel extends AbstractImageDiffPanel {
-
- public DifferencePanel(String id,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- String sinceRevision,
- String untilRevision) {
-
- super(id, repoModel, fileModel, sinceRevision, untilRevision);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- FileHeader file = getFile();
-
- if (file.getChangeType() == ChangeType.ADD || Strings.isNullOrEmpty(sinceRevision)) {
- add(new WebMarkupContainer("old").setVisibilityAllowed(false));
- } else {
- add(new FileBlobImage("old",
- getRepository(),
- sinceRevision,
- file.getOldPath()));
- }
-
- if (file.getChangeType() == ChangeType.DELETE) {
- add(new WebMarkupContainer("new").setVisibilityAllowed(false));
- } else {
- add(new FileBlobImage("new",
- getRepository(),
- untilRevision,
- file.getNewPath()));
- }
-
- differenceControl = new WebMarkupContainer("differenceControl");
- add(differenceControl);
- }
-
- private WebMarkupContainer differenceControl;
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(JavaScriptHeaderItem.forReference(ResembleResourceReference.getInstance()));
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageBlobDiffPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageBlobDiffPanel.html
deleted file mode 100644
index 33ebfd5fe3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageBlobDiffPanel.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="image-diff">
- <div class="btn-group compares" wicket:id="btns">
- <wicket:container wicket:id="types">
- <button wicket:id="typeBtn" type="button" class="btn btn-default"><span wicket:id="name"></span></button>
- </wicket:container>
- </div>
-
- <div wicket:id="image"></div>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageBlobDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageBlobDiffPanel.java
deleted file mode 100644
index 7572e21eb3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageBlobDiffPanel.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.Loop;
-import org.apache.wicket.markup.html.list.LoopItem;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-@SuppressWarnings("serial")
-public class ImageBlobDiffPanel extends AbstractImageDiffPanel {
-
- public ImageBlobDiffPanel(String id,
- IModel<Repository> repoModel,
- IModel<FileHeader> model,
- String sinceRevision,
- String untilRevision) {
-
- super(id, repoModel, model, sinceRevision, untilRevision);
-
- setOutputMarkupId(true);
- }
-
- static enum CompareType {
- SIDE_BY_SIDE("Side by side"),
- SWIPE("Swipe"),
- BLEND("Blend");
-// DIFFERENCE("Difference");
-
- final String displayName;
- CompareType(String displayName) {
- this.displayName = displayName;
- }
- }
-
- private CompareType compareType = CompareType.SIDE_BY_SIDE;
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(createBtns());
- add(createImageContainer());
- }
-
- protected Component createBtns() {
- WebMarkupContainer btnsContainer = new WebMarkupContainer("btns") {
- @Override
- protected void onConfigure() {
- super.onConfigure();
- this.setVisibilityAllowed(getFile().getChangeType() == ChangeType.MODIFY);
- }
- };
-
- Loop btnLoop = new Loop("types", CompareType.values().length) {
-
- @Override
- protected void populateItem(LoopItem item) {
- final int index = item.getIndex();
- final CompareType type = CompareType.values()[index];
- AjaxLink<Void> link = new AjaxLink<Void>("typeBtn") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- if (type == compareType) {
- return;
- }
-
- compareType = type;
- onCompareTypeChanged(target);
- }
- };
- link.add(new Label("name", type.displayName));
- link.add(AttributeAppender.append("class",
- type == compareType ? "active" : ""));
- item.add(link);
- }
- };
-
- btnsContainer.add(btnLoop);
-
- return btnsContainer;
- }
-
- protected Component createImageContainer() {
- switch (compareType) {
- case SIDE_BY_SIDE:
- return new SideBySidePanel("image", repoModel, fileModel, sinceRevision, untilRevision);
-
- case SWIPE:
- return new SwipePanel("image", repoModel, fileModel, sinceRevision, untilRevision);
-
- case BLEND:
- return new BlendPanel("image", repoModel, fileModel, sinceRevision, untilRevision);
-
- default:
- return new WebMarkupContainer("image").setVisibilityAllowed(false);
- }
- }
-
- private void onCompareTypeChanged(AjaxRequestTarget target) {
- this.addOrReplace(createBtns());
- this.addOrReplace(createImageContainer());
-
- target.add(this);
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-//
-// response.render(JQuery.$(this, ".compares .btn").on("click",
-// new JavaScriptInlineFunction(
-// "$('#" + getMarkupId(true) + " .btn-group .btn').removeClass('active'); \n"
-// + "$(this).addClass('active'); \n"
-// + "var cssClass = $(this).data('class'); \n"
-// + "$('#" + imageContainer.getMarkupId(true) + "').removeClass().addClass('image ' + cssClass);"))
-//
-// .asDomReadyScript());
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageDiffPanel.java
deleted file mode 100644
index 83074d4382..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ImageDiffPanel.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.BlobDiffPanel;
-
-@SuppressWarnings("serial")
-public class ImageDiffPanel extends BlobDiffPanel {
-
- public ImageDiffPanel(String id, int index,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- String sinceRevision,
- String untilRevision) {
-
- super(id, index, repoModel, fileModel, sinceRevision, untilRevision);
- }
-
- @Override
- protected Component createActionsBar(String id) {
- return new WebMarkupContainer(id).setVisibilityAllowed(false);
- }
-
- @Override
- protected Component createDiffContent(String id) {
- return new ImageBlobDiffPanel(id, repoModel, getFileModel(), sinceRevision, untilRevision);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ResembleResourceReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ResembleResourceReference.java
deleted file mode 100644
index b7b9c42b8d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/ResembleResourceReference.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-
-@SuppressWarnings("serial")
-public class ResembleResourceReference extends JavaScriptResourceReference {
-
- public ResembleResourceReference() {
- super(ResembleResourceReference.class, "res/resemble.js");
- }
-
- private static ResembleResourceReference instance =
- new ResembleResourceReference();
-
- public static ResembleResourceReference getInstance() {
- return instance;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SideBySidePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SideBySidePanel.html
deleted file mode 100644
index f87835ca49..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SideBySidePanel.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <wicket:enclosure>
- <div class="old-frame">
- <h4>OLD</h4>
- <img wicket:id="old" />
- </div>
- </wicket:enclosure>
-
- <wicket:enclosure>
- <div class="new-frame">
- <h4>NEW</h4>
- <img wicket:id="new" />
- </div>
- </wicket:enclosure>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SideBySidePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SideBySidePanel.java
deleted file mode 100644
index 847f136c90..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SideBySidePanel.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.google.common.base.Strings;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.FileBlobImage;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-@SuppressWarnings("serial")
-public class SideBySidePanel extends AbstractImageDiffPanel {
-
- public SideBySidePanel(String id,
- IModel<Repository> repoModel,
- IModel<FileHeader> model,
- String sinceRevision,
- String untilRevision) {
- super(id, repoModel, model, sinceRevision, untilRevision);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- FileHeader file = getFile();
-
- if (file.getChangeType() == ChangeType.ADD || Strings.isNullOrEmpty(sinceRevision)) {
- add(new WebMarkupContainer("old").setVisibilityAllowed(false));
- } else {
- add(new FileBlobImage("old",
- getRepository(),
- sinceRevision,
- file.getOldPath()));
- }
-
- if (file.getChangeType() == ChangeType.DELETE) {
- add(new WebMarkupContainer("new").setVisibilityAllowed(false));
- } else {
- add(new FileBlobImage("new",
- getRepository(),
- untilRevision,
- file.getNewPath()));
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SwipePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SwipePanel.html
deleted file mode 100644
index 310de3599c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SwipePanel.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="image swipe-view twentytwenty-container">
- <img wicket:id="old" />
- <img wicket:id="new" />
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SwipePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SwipePanel.java
deleted file mode 100644
index 3d3a216931..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/SwipePanel.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.image.Image;
-import org.apache.wicket.model.IModel;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-
-import com.google.common.base.Strings;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.code.blob.renderer.FileBlobImage;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-
-import de.agilecoders.wicket.jquery.JQuery;
-
-@SuppressWarnings("serial")
-public class SwipePanel extends AbstractImageDiffPanel {
-
- public SwipePanel(String id,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- String sinceRevision,
- String untilRevision) {
-
- super(id, repoModel, fileModel, sinceRevision, untilRevision);
- }
-
- Image oldImage;
- Image newImage;
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- FileHeader file = getFile();
-
- if (file.getChangeType() == ChangeType.ADD || Strings.isNullOrEmpty(sinceRevision)) {
- add(new WebMarkupContainer("old").setVisibilityAllowed(false));
- } else {
- add(oldImage = new FileBlobImage("old",
- getRepository(),
- sinceRevision,
- file.getOldPath()));
- }
-
- if (file.getChangeType() == ChangeType.DELETE) {
- add(new WebMarkupContainer("new").setVisibilityAllowed(false));
- } else {
- add(newImage = new FileBlobImage("new",
- getRepository(),
- untilRevision,
- file.getNewPath()));
- }
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(JavaScriptHeaderItem.forReference(TwentyTwentyResourceReference.getInstance()));
- response.render(OnDomReadyHeaderItem.forScript(getInitScript()));
- }
-
- private String getInitScript() {
- String str =
- "gitplex.utils.onImageLoad('#" + newImage.getMarkupId(true) + "', function() {"
- + "gitplex.utils.onImageLoad('#" + oldImage.getMarkupId(true) + "', function() {"
- + JQuery.$(this, ".swipe-view").chain("twentytwenty").get()
- + "});});";
-
- return str;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/TwentyTwentyResourceReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/TwentyTwentyResourceReference.java
deleted file mode 100644
index bb098120ab..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/TwentyTwentyResourceReference.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.image;
-
-import org.apache.wicket.markup.head.CssHeaderItem;
-import org.apache.wicket.markup.head.HeaderItem;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.request.resource.CssResourceReference;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-@SuppressWarnings("serial")
-public class TwentyTwentyResourceReference extends JavaScriptResourceReference {
-
- public TwentyTwentyResourceReference() {
- super(TwentyTwentyResourceReference.class, "res/twentytwenty.js");
- }
-
- private static final JavaScriptResourceReference EVENT_MOVE_JS =
- new JavaScriptResourceReference(TwentyTwentyResourceReference.class, "res/jquery.event.move.js");
-
- private static final CssResourceReference TWENTYTWENTY_CSS =
- new CssResourceReference(TwentyTwentyResourceReference.class, "res/twentytwenty.css");
-
- @Override
- public Iterable<? extends HeaderItem> getDependencies() {
- return Iterables.concat(super.getDependencies(),
- ImmutableList.<HeaderItem>builder()
- .add(JavaScriptHeaderItem.forReference(EVENT_MOVE_JS))
- .add(CssHeaderItem.forReference(TWENTYTWENTY_CSS))
- .build());
- }
-
- private final static TwentyTwentyResourceReference instance =
- new TwentyTwentyResourceReference();
-
- public final static TwentyTwentyResourceReference getInstance() {
- return instance;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/imagediff.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/imagediff.js
deleted file mode 100644
index 3995e83721..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/imagediff.js
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * https://github.com/HumbleSoftware/js-imagediff/blob/master/js/imagediff.js
- *
- * License: MIT license
- *
- */
-(function (name, definition) {
- var root = this;
- if (typeof module !== 'undefined') {
- var Canvas = require('canvas');
- module.exports = definition(root, name, Canvas);
- } else if (typeof define === 'function' && typeof define.amd === 'object') {
- define(definition);
- } else {
- root[name] = definition(root, name);
- }
-})('imagediff', function (root, name, Canvas) {
-
- var
- TYPE_ARRAY = /\[object Array\]/i,
- TYPE_CANVAS = /\[object (Canvas|HTMLCanvasElement)\]/i,
- TYPE_CONTEXT = /\[object CanvasRenderingContext2D\]/i,
- TYPE_IMAGE = /\[object (Image|HTMLImageElement)\]/i,
- TYPE_IMAGE_DATA = /\[object ImageData\]/i,
-
- UNDEFINED = 'undefined',
-
- canvas = getCanvas(),
- context = canvas.getContext('2d'),
- previous = root[name],
- imagediff, jasmine;
-
- // Creation
- function getCanvas (width, height) {
- var
- canvas = Canvas ?
- new Canvas() :
- document.createElement('canvas');
- if (width) canvas.width = width;
- if (height) canvas.height = height;
- return canvas;
- }
- function getImageData (width, height) {
- canvas.width = width;
- canvas.height = height;
- context.clearRect(0, 0, width, height);
- return context.createImageData(width, height);
- }
-
-
- // Type Checking
- function isImage (object) {
- return isType(object, TYPE_IMAGE);
- }
- function isCanvas (object) {
- return isType(object, TYPE_CANVAS);
- }
- function isContext (object) {
- return isType(object, TYPE_CONTEXT);
- }
- function isImageData (object) {
- return !!(object &&
- isType(object, TYPE_IMAGE_DATA) &&
- typeof(object.width) !== UNDEFINED &&
- typeof(object.height) !== UNDEFINED &&
- typeof(object.data) !== UNDEFINED);
- }
- function isImageType (object) {
- return (
- isImage(object) ||
- isCanvas(object) ||
- isContext(object) ||
- isImageData(object)
- );
- }
- function isType (object, type) {
- return typeof (object) === 'object' && !!Object.prototype.toString.apply(object).match(type);
- }
-
-
- // Type Conversion
- function copyImageData (imageData) {
- var
- height = imageData.height,
- width = imageData.width,
- data = imageData.data,
- newImageData, newData, i;
-
- canvas.width = width;
- canvas.height = height;
- newImageData = context.getImageData(0, 0, width, height);
- newData = newImageData.data;
-
- for (i = imageData.data.length; i--;) {
- newData[i] = data[i];
- }
-
- return newImageData;
- }
- function toImageData (object) {
- if (isImage(object)) { return toImageDataFromImage(object); }
- if (isCanvas(object)) { return toImageDataFromCanvas(object); }
- if (isContext(object)) { return toImageDataFromContext(object); }
- if (isImageData(object)) { return object; }
- }
- function toImageDataFromImage (image) {
- var
- height = image.height,
- width = image.width;
- canvas.width = width;
- canvas.height = height;
- context.clearRect(0, 0, width, height);
- context.drawImage(image, 0, 0);
- return context.getImageData(0, 0, width, height);
- }
- function toImageDataFromCanvas (canvas) {
- var
- height = canvas.height,
- width = canvas.width,
- context = canvas.getContext('2d');
- return context.getImageData(0, 0, width, height);
- }
- function toImageDataFromContext (context) {
- var
- canvas = context.canvas,
- height = canvas.height,
- width = canvas.width;
- return context.getImageData(0, 0, width, height);
- }
- function toCanvas (object) {
- var
- data = toImageData(object),
- canvas = getCanvas(data.width, data.height),
- context = canvas.getContext('2d');
-
- context.putImageData(data, 0, 0);
- return canvas;
- }
-
-
- // ImageData Equality Operators
- function equalWidth (a, b) {
- return a.width === b.width;
- }
- function equalHeight (a, b) {
- return a.height === b.height;
- }
- function equalDimensions (a, b) {
- return equalHeight(a, b) && equalWidth(a, b);
- }
- function equal (a, b, tolerance) {
-
- var
- aData = a.data,
- bData = b.data,
- length = aData.length,
- i;
-
- tolerance = tolerance || 0;
-
- if (!equalDimensions(a, b)) return false;
- for (i = length; i--;) if (aData[i] !== bData[i] && Math.abs(aData[i] - bData[i]) > tolerance) return false;
-
- return true;
- }
-
-
- // Diff
- function diff (a, b) {
- return (equalDimensions(a, b) ? diffEqual : diffUnequal)(a, b);
- }
- function diffEqual (a, b) {
-
- var
- height = a.height,
- width = a.width,
- c = getImageData(width, height), // c = a - b
- aData = a.data,
- bData = b.data,
- cData = c.data,
- length = cData.length,
- row, column,
- i, j, k, v;
-
- for (i = 0; i < length; i += 4) {
- cData[i] = Math.abs(aData[i] - bData[i]);
- cData[i+1] = Math.abs(aData[i+1] - bData[i+1]);
- cData[i+2] = Math.abs(aData[i+2] - bData[i+2]);
- cData[i+3] = Math.abs(255 - aData[i+3] - bData[i+3]);
- }
-
- return c;
- }
- function diffUnequal (a, b) {
-
- var
- height = Math.max(a.height, b.height),
- width = Math.max(a.width, b.width),
- c = getImageData(width, height), // c = a - b
- aData = a.data,
- bData = b.data,
- cData = c.data,
- rowOffset,
- columnOffset,
- row, column,
- i, j, k, v;
-
-
- for (i = cData.length - 1; i > 0; i = i - 4) {
- cData[i] = 255;
- }
-
- // Add First Image
- offsets(a);
- for (row = a.height; row--;){
- for (column = a.width; column--;) {
- i = 4 * ((row + rowOffset) * width + (column + columnOffset));
- j = 4 * (row * a.width + column);
- cData[i+0] = aData[j+0]; // r
- cData[i+1] = aData[j+1]; // g
- cData[i+2] = aData[j+2]; // b
- // cData[i+3] = aData[j+3]; // a
- }
- }
-
- // Subtract Second Image
- offsets(b);
- for (row = b.height; row--;){
- for (column = b.width; column--;) {
- i = 4 * ((row + rowOffset) * width + (column + columnOffset));
- j = 4 * (row * b.width + column);
- cData[i+0] = Math.abs(cData[i+0] - bData[j+0]); // r
- cData[i+1] = Math.abs(cData[i+1] - bData[j+1]); // g
- cData[i+2] = Math.abs(cData[i+2] - bData[j+2]); // b
- }
- }
-
- // Helpers
- function offsets (imageData) {
- rowOffset = Math.floor((height - imageData.height) / 2);
- columnOffset = Math.floor((width - imageData.width) / 2);
- }
-
- return c;
- }
-
-
- // Validation
- function checkType () {
- var i;
- for (i = 0; i < arguments.length; i++) {
- if (!isImageType(arguments[i])) {
- throw {
- name : 'ImageTypeError',
- message : 'Submitted object was not an image.'
- };
- }
- }
- }
-
-
- // Jasmine Matchers
- function get (element, content) {
- element = document.createElement(element);
- if (element && content) {
- element.innerHTML = content;
- }
- return element;
- }
-
- jasmine = {
-
- toBeImageData : function () {
- return imagediff.isImageData(this.actual);
- },
-
- toImageDiffEqual : function (expected, tolerance) {
-
- if (typeof (document) !== UNDEFINED) {
- this.message = function () {
- var
- div = get('div'),
- a = get('div', '<div>Actual:</div>'),
- b = get('div', '<div>Expected:</div>'),
- c = get('div', '<div>Diff:</div>'),
- diff = imagediff.diff(this.actual, expected),
- canvas = getCanvas(),
- context;
-
- canvas.height = diff.height;
- canvas.width = diff.width;
-
- div.style.overflow = 'hidden';
- a.style.float = 'left';
- b.style.float = 'left';
- c.style.float = 'left';
-
- context = canvas.getContext('2d');
- context.putImageData(diff, 0, 0);
-
- a.appendChild(toCanvas(this.actual));
- b.appendChild(toCanvas(expected));
- c.appendChild(canvas);
-
- div.appendChild(a);
- div.appendChild(b);
- div.appendChild(c);
-
- return [
- div,
- "Expected not to be equal."
- ];
- };
- }
-
- return imagediff.equal(this.actual, expected, tolerance);
- }
- };
-
-
- // Image Output
- function imageDataToPNG (imageData, outputFile, callback) {
-
- var
- canvas = toCanvas(imageData),
- base64Data,
- decodedImage;
-
- callback = callback || Function;
-
- base64Data = canvas.toDataURL().replace(/^data:image\/\w+;base64,/,"");
- decodedImage = new Buffer(base64Data, 'base64');
- require('fs').writeFile(outputFile, decodedImage, callback);
- }
-
-
- // Definition
- imagediff = {
-
- createCanvas : getCanvas,
- createImageData : getImageData,
-
- isImage : isImage,
- isCanvas : isCanvas,
- isContext : isContext,
- isImageData : isImageData,
- isImageType : isImageType,
-
- toImageData : function (object) {
- checkType(object);
- if (isImageData(object)) { return copyImageData(object); }
- return toImageData(object);
- },
-
- equal : function (a, b, tolerance) {
- checkType(a, b);
- a = toImageData(a);
- b = toImageData(b);
- return equal(a, b, tolerance);
- },
- diff : function (a, b) {
- checkType(a, b);
- a = toImageData(a);
- b = toImageData(b);
- return diff(a, b);
- },
-
- jasmine : jasmine,
-
- // Compatibility
- noConflict : function () {
- root[name] = previous;
- return imagediff;
- }
- };
-
- if (typeof module !== 'undefined') {
- imagediff.imageDataToPNG = imageDataToPNG;
- }
-
- return imagediff;
-});
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/jquery.event.move.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/jquery.event.move.js
deleted file mode 100644
index a7d7bfc372..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/jquery.event.move.js
+++ /dev/null
@@ -1,586 +0,0 @@
-// jquery.event.move
-//
-// 1.3.6
-//
-// Stephen Band
-//
-// Triggers 'movestart', 'move' and 'moveend' events after
-// mousemoves following a mousedown cross a distance threshold,
-// similar to the native 'dragstart', 'drag' and 'dragend' events.
-// Move events are throttled to animation frames. Move event objects
-// have the properties:
-//
-// pageX:
-// pageY: Page coordinates of pointer.
-// startX:
-// startY: Page coordinates of pointer at movestart.
-// distX:
-// distY: Distance the pointer has moved since movestart.
-// deltaX:
-// deltaY: Distance the finger has moved since last event.
-// velocityX:
-// velocityY: Average velocity over last few events.
-
-
-(function (module) {
- if (typeof define === 'function' && define.amd) {
- // AMD. Register as an anonymous module.
- define(['jquery'], module);
- } else {
- // Browser globals
- module(jQuery);
- }
-})(function(jQuery, undefined){
-
- var // Number of pixels a pressed pointer travels before movestart
- // event is fired.
- threshold = 6,
-
- add = jQuery.event.add,
-
- remove = jQuery.event.remove,
-
- // Just sugar, so we can have arguments in the same order as
- // add and remove.
- trigger = function(node, type, data) {
- jQuery.event.trigger(type, data, node);
- },
-
- // Shim for requestAnimationFrame, falling back to timer. See:
- // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
- requestFrame = (function(){
- return (
- window.requestAnimationFrame ||
- window.webkitRequestAnimationFrame ||
- window.mozRequestAnimationFrame ||
- window.oRequestAnimationFrame ||
- window.msRequestAnimationFrame ||
- function(fn, element){
- return window.setTimeout(function(){
- fn();
- }, 25);
- }
- );
- })(),
-
- ignoreTags = {
- textarea: true,
- input: true,
- select: true,
- button: true
- },
-
- mouseevents = {
- move: 'mousemove',
- cancel: 'mouseup dragstart',
- end: 'mouseup'
- },
-
- touchevents = {
- move: 'touchmove',
- cancel: 'touchend',
- end: 'touchend'
- };
-
-
- // Constructors
-
- function Timer(fn){
- var callback = fn,
- active = false,
- running = false;
-
- function trigger(time) {
- if (active){
- callback();
- requestFrame(trigger);
- running = true;
- active = false;
- }
- else {
- running = false;
- }
- }
-
- this.kick = function(fn) {
- active = true;
- if (!running) { trigger(); }
- };
-
- this.end = function(fn) {
- var cb = callback;
-
- if (!fn) { return; }
-
- // If the timer is not running, simply call the end callback.
- if (!running) {
- fn();
- }
- // If the timer is running, and has been kicked lately, then
- // queue up the current callback and the end callback, otherwise
- // just the end callback.
- else {
- callback = active ?
- function(){ cb(); fn(); } :
- fn ;
-
- active = true;
- }
- };
- }
-
-
- // Functions
-
- function returnTrue() {
- return true;
- }
-
- function returnFalse() {
- return false;
- }
-
- function preventDefault(e) {
- e.preventDefault();
- }
-
- function preventIgnoreTags(e) {
- // Don't prevent interaction with form elements.
- if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
-
- e.preventDefault();
- }
-
- function isLeftButton(e) {
- // Ignore mousedowns on any button other than the left (or primary)
- // mouse button, or when a modifier key is pressed.
- return (e.which === 1 && !e.ctrlKey && !e.altKey);
- }
-
- function identifiedTouch(touchList, id) {
- var i, l;
-
- if (touchList.identifiedTouch) {
- return touchList.identifiedTouch(id);
- }
-
- // touchList.identifiedTouch() does not exist in
- // webkit yet… we must do the search ourselves...
-
- i = -1;
- l = touchList.length;
-
- while (++i < l) {
- if (touchList[i].identifier === id) {
- return touchList[i];
- }
- }
- }
-
- function changedTouch(e, event) {
- var touch = identifiedTouch(e.changedTouches, event.identifier);
-
- // This isn't the touch you're looking for.
- if (!touch) { return; }
-
- // Chrome Android (at least) includes touches that have not
- // changed in e.changedTouches. That's a bit annoying. Check
- // that this touch has changed.
- if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; }
-
- return touch;
- }
-
-
- // Handlers that decide when the first movestart is triggered
-
- function mousedown(e){
- var data;
-
- if (!isLeftButton(e)) { return; }
-
- data = {
- target: e.target,
- startX: e.pageX,
- startY: e.pageY,
- timeStamp: e.timeStamp
- };
-
- add(document, mouseevents.move, mousemove, data);
- add(document, mouseevents.cancel, mouseend, data);
- }
-
- function mousemove(e){
- var data = e.data;
-
- checkThreshold(e, data, e, removeMouse);
- }
-
- function mouseend(e) {
- removeMouse();
- }
-
- function removeMouse() {
- remove(document, mouseevents.move, mousemove);
- remove(document, mouseevents.cancel, mouseend);
- }
-
- function touchstart(e) {
- var touch, template;
-
- // Don't get in the way of interaction with form elements.
- if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
-
- touch = e.changedTouches[0];
-
- // iOS live updates the touch objects whereas Android gives us copies.
- // That means we can't trust the touchstart object to stay the same,
- // so we must copy the data. This object acts as a template for
- // movestart, move and moveend event objects.
- template = {
- target: touch.target,
- startX: touch.pageX,
- startY: touch.pageY,
- timeStamp: e.timeStamp,
- identifier: touch.identifier
- };
-
- // Use the touch identifier as a namespace, so that we can later
- // remove handlers pertaining only to this touch.
- add(document, touchevents.move + '.' + touch.identifier, touchmove, template);
- add(document, touchevents.cancel + '.' + touch.identifier, touchend, template);
- }
-
- function touchmove(e){
- var data = e.data,
- touch = changedTouch(e, data);
-
- if (!touch) { return; }
-
- checkThreshold(e, data, touch, removeTouch);
- }
-
- function touchend(e) {
- var template = e.data,
- touch = identifiedTouch(e.changedTouches, template.identifier);
-
- if (!touch) { return; }
-
- removeTouch(template.identifier);
- }
-
- function removeTouch(identifier) {
- remove(document, '.' + identifier, touchmove);
- remove(document, '.' + identifier, touchend);
- }
-
-
- // Logic for deciding when to trigger a movestart.
-
- function checkThreshold(e, template, touch, fn) {
- var distX = touch.pageX - template.startX,
- distY = touch.pageY - template.startY;
-
- // Do nothing if the threshold has not been crossed.
- if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
-
- triggerStart(e, template, touch, distX, distY, fn);
- }
-
- function handled() {
- // this._handled should return false once, and after return true.
- this._handled = returnTrue;
- return false;
- }
-
- function flagAsHandled(e) {
- e._handled();
- }
-
- function triggerStart(e, template, touch, distX, distY, fn) {
- var node = template.target,
- touches, time;
-
- touches = e.targetTouches;
- time = e.timeStamp - template.timeStamp;
-
- // Create a movestart object with some special properties that
- // are passed only to the movestart handlers.
- template.type = 'movestart';
- template.distX = distX;
- template.distY = distY;
- template.deltaX = distX;
- template.deltaY = distY;
- template.pageX = touch.pageX;
- template.pageY = touch.pageY;
- template.velocityX = distX / time;
- template.velocityY = distY / time;
- template.targetTouches = touches;
- template.finger = touches ?
- touches.length :
- 1 ;
-
- // The _handled method is fired to tell the default movestart
- // handler that one of the move events is bound.
- template._handled = handled;
-
- // Pass the touchmove event so it can be prevented if or when
- // movestart is handled.
- template._preventTouchmoveDefault = function() {
- e.preventDefault();
- };
-
- // Trigger the movestart event.
- trigger(template.target, template);
-
- // Unbind handlers that tracked the touch or mouse up till now.
- fn(template.identifier);
- }
-
-
- // Handlers that control what happens following a movestart
-
- function activeMousemove(e) {
- var timer = e.data.timer;
-
- e.data.touch = e;
- e.data.timeStamp = e.timeStamp;
- timer.kick();
- }
-
- function activeMouseend(e) {
- var event = e.data.event,
- timer = e.data.timer;
-
- removeActiveMouse();
-
- endEvent(event, timer, function() {
- // Unbind the click suppressor, waiting until after mouseup
- // has been handled.
- setTimeout(function(){
- remove(event.target, 'click', returnFalse);
- }, 0);
- });
- }
-
- function removeActiveMouse(event) {
- remove(document, mouseevents.move, activeMousemove);
- remove(document, mouseevents.end, activeMouseend);
- }
-
- function activeTouchmove(e) {
- var event = e.data.event,
- timer = e.data.timer,
- touch = changedTouch(e, event);
-
- if (!touch) { return; }
-
- // Stop the interface from gesturing
- e.preventDefault();
-
- event.targetTouches = e.targetTouches;
- e.data.touch = touch;
- e.data.timeStamp = e.timeStamp;
- timer.kick();
- }
-
- function activeTouchend(e) {
- var event = e.data.event,
- timer = e.data.timer,
- touch = identifiedTouch(e.changedTouches, event.identifier);
-
- // This isn't the touch you're looking for.
- if (!touch) { return; }
-
- removeActiveTouch(event);
- endEvent(event, timer);
- }
-
- function removeActiveTouch(event) {
- remove(document, '.' + event.identifier, activeTouchmove);
- remove(document, '.' + event.identifier, activeTouchend);
- }
-
-
- // Logic for triggering move and moveend events
-
- function updateEvent(event, touch, timeStamp, timer) {
- var time = timeStamp - event.timeStamp;
-
- event.type = 'move';
- event.distX = touch.pageX - event.startX;
- event.distY = touch.pageY - event.startY;
- event.deltaX = touch.pageX - event.pageX;
- event.deltaY = touch.pageY - event.pageY;
-
- // Average the velocity of the last few events using a decay
- // curve to even out spurious jumps in values.
- event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
- event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
- event.pageX = touch.pageX;
- event.pageY = touch.pageY;
- }
-
- function endEvent(event, timer, fn) {
- timer.end(function(){
- event.type = 'moveend';
-
- trigger(event.target, event);
-
- return fn && fn();
- });
- }
-
-
- // jQuery special event definition
-
- function setup(data, namespaces, eventHandle) {
- // Stop the node from being dragged
- //add(this, 'dragstart.move drag.move', preventDefault);
-
- // Prevent text selection and touch interface scrolling
- //add(this, 'mousedown.move', preventIgnoreTags);
-
- // Tell movestart default handler that we've handled this
- add(this, 'movestart.move', flagAsHandled);
-
- // Don't bind to the DOM. For speed.
- return true;
- }
-
- function teardown(namespaces) {
- remove(this, 'dragstart drag', preventDefault);
- remove(this, 'mousedown touchstart', preventIgnoreTags);
- remove(this, 'movestart', flagAsHandled);
-
- // Don't bind to the DOM. For speed.
- return true;
- }
-
- function addMethod(handleObj) {
- // We're not interested in preventing defaults for handlers that
- // come from internal move or moveend bindings
- if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
- return;
- }
-
- // Stop the node from being dragged
- add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector);
-
- // Prevent text selection and touch interface scrolling
- add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector);
- }
-
- function removeMethod(handleObj) {
- if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
- return;
- }
-
- remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid);
- remove(this, 'mousedown.' + handleObj.guid);
- }
-
- jQuery.event.special.movestart = {
- setup: setup,
- teardown: teardown,
- add: addMethod,
- remove: removeMethod,
-
- _default: function(e) {
- var event, data;
-
- // If no move events were bound to any ancestors of this
- // target, high tail it out of here.
- if (!e._handled()) { return; }
-
- function update(time) {
- updateEvent(event, data.touch, data.timeStamp);
- trigger(e.target, event);
- }
-
- event = {
- target: e.target,
- startX: e.startX,
- startY: e.startY,
- pageX: e.pageX,
- pageY: e.pageY,
- distX: e.distX,
- distY: e.distY,
- deltaX: e.deltaX,
- deltaY: e.deltaY,
- velocityX: e.velocityX,
- velocityY: e.velocityY,
- timeStamp: e.timeStamp,
- identifier: e.identifier,
- targetTouches: e.targetTouches,
- finger: e.finger
- };
-
- data = {
- event: event,
- timer: new Timer(update),
- touch: undefined,
- timeStamp: undefined
- };
-
- if (e.identifier === undefined) {
- // We're dealing with a mouse
- // Stop clicks from propagating during a move
- add(e.target, 'click', returnFalse);
- add(document, mouseevents.move, activeMousemove, data);
- add(document, mouseevents.end, activeMouseend, data);
- }
- else {
- // We're dealing with a touch. Stop touchmove doing
- // anything defaulty.
- e._preventTouchmoveDefault();
- add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data);
- add(document, touchevents.end + '.' + e.identifier, activeTouchend, data);
- }
- }
- };
-
- jQuery.event.special.move = {
- setup: function() {
- // Bind a noop to movestart. Why? It's the movestart
- // setup that decides whether other move events are fired.
- add(this, 'movestart.move', jQuery.noop);
- },
-
- teardown: function() {
- remove(this, 'movestart.move', jQuery.noop);
- }
- };
-
- jQuery.event.special.moveend = {
- setup: function() {
- // Bind a noop to movestart. Why? It's the movestart
- // setup that decides whether other move events are fired.
- add(this, 'movestart.moveend', jQuery.noop);
- },
-
- teardown: function() {
- remove(this, 'movestart.moveend', jQuery.noop);
- }
- };
-
- add(document, 'mousedown.move', mousedown);
- add(document, 'touchstart.move', touchstart);
-
- // Make jQuery copy touch event properties over to the jQuery event
- // object, if they are not already listed. But only do the ones we
- // really need. IE7/8 do not have Array#indexOf(), but nor do they
- // have touch events, so let's assume we can ignore them.
- if (typeof Array.prototype.indexOf === 'function') {
- (function(jQuery, undefined){
- var props = ["changedTouches", "targetTouches"],
- l = props.length;
-
- while (l--) {
- if (jQuery.event.props.indexOf(props[l]) === -1) {
- jQuery.event.props.push(props[l]);
- }
- }
- })(jQuery);
- };
-});
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/resemble.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/resemble.js
deleted file mode 100644
index 2bccf5ebf6..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/resemble.js
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
-Author: James Cryer
-Company: Huddle
-Last updated date: 17 Sep 2013
-URL: https://github.com/Huddle/Resemble.js
-*/
-
-(function(_this){
- 'use strict';
-
- _this['resemble'] = function( fileData ){
-
- var data = {};
- var images = [];
- var updateCallbackArray = [];
-
- var tolerance = { // between 0 and 255
- red: 16,
- green: 16,
- blue: 16,
- alpha: 16,
- minBrightness: 16,
- maxBrightness: 240
- };
-
- var ignoreAntialiasing = false;
- var ignoreColors = false;
-
- function triggerDataUpdate(){
- var len = updateCallbackArray.length;
- var i;
- for(i=0;i<len;i++){
- if (typeof updateCallbackArray[i] === 'function'){
- updateCallbackArray[i](data);
- }
- }
- }
-
- function loop(x, y, callback){
- var i,j;
-
- for (i=0;i<x;i++){
- for (j=0;j<y;j++){
- callback(i, j);
- }
- }
- }
-
- function parseImage(sourceImageData, width, height){
-
- var pixleCount = 0;
- var redTotal = 0;
- var greenTotal = 0;
- var blueTotal = 0;
- var brightnessTotal = 0;
-
- loop(height, width, function(verticalPos, horizontalPos){
- var offset = (verticalPos*width + horizontalPos) * 4;
- var red = sourceImageData[offset];
- var green = sourceImageData[offset + 1];
- var blue = sourceImageData[offset + 2];
- var brightness = getBrightness(red,green,blue);
-
- pixleCount++;
-
- redTotal += red / 255 * 100;
- greenTotal += green / 255 * 100;
- blueTotal += blue / 255 * 100;
- brightnessTotal += brightness / 255 * 100;
- });
-
- data.red = Math.floor(redTotal / pixleCount);
- data.green = Math.floor(greenTotal / pixleCount);
- data.blue = Math.floor(blueTotal / pixleCount);
- data.brightness = Math.floor(brightnessTotal / pixleCount);
-
- triggerDataUpdate();
- }
-
- function loadImageData( fileData, callback ){
- var fileReader;
- var hiddenImage = new Image();
-
- hiddenImage.onload = function() {
-
- var hiddenCanvas = document.createElement('canvas');
- var imageData;
- var width = hiddenImage.width;
- var height = hiddenImage.height;
-
- hiddenCanvas.width = width;
- hiddenCanvas.height = height;
- hiddenCanvas.getContext('2d').drawImage(hiddenImage, 0, 0, width, height);
- imageData = hiddenCanvas.getContext('2d').getImageData(0, 0, width, height);
-
- images.push(imageData);
-
- callback(imageData, width, height);
- };
-
- if (typeof fileData === 'string') {
- hiddenImage.src = fileData;
- } else {
- fileReader = new FileReader();
- fileReader.onload = function (event) {
- hiddenImage.src = event.target.result;
- };
- fileReader.readAsDataURL(fileData);
- }
- }
-
- function isColorSimilar(a, b, color){
-
- var absDiff = Math.abs(a - b);
-
- if(typeof a === 'undefined'){
- return false;
- }
- if(typeof b === 'undefined'){
- return false;
- }
-
- if(a === b){
- return true;
- } else if ( absDiff < tolerance[color] ) {
- return true;
- } else {
- return false;
- }
- }
-
- function isNumber(n) {
- return !isNaN(parseFloat(n));
- }
-
- function isPixelBrightnessSimilar(d1, d2){
- var alpha = isColorSimilar(d1.a, d2.a, 'alpha');
- var brightness = isColorSimilar(d1.brightness, d2.brightness, 'minBrightness');
- return brightness && alpha;
- }
-
- function getBrightness(r,g,b){
- return 0.3*r + 0.59*g + 0.11*b;
- }
-
- function isRGBSame(d1,d2){
- var red = d1.r === d2.r;
- var green = d1.g === d2.g;
- var blue = d1.b === d2.b;
- return red && green && blue;
- }
-
- function isRGBSimilar(d1, d2){
- var red = isColorSimilar(d1.r,d2.r,'red');
- var green = isColorSimilar(d1.g,d2.g,'green');
- var blue = isColorSimilar(d1.b,d2.b,'blue');
- var alpha = isColorSimilar(d1.a, d2.a, 'alpha');
-
- return red && green && blue && alpha;
- }
-
- function isContrasting(d1, d2){
- return Math.abs(d1.brightness - d2.brightness) > tolerance.maxBrightness;
- }
-
- function getHue(r,g,b){
-
- r = r / 255;
- g = g / 255;
- b = b / 255;
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
- var h;
- var d;
-
- if (max == min){
- h = 0; // achromatic
- } else{
- d = max - min;
- switch(max){
- case r: h = (g - b) / d + (g < b ? 6 : 0); break;
- case g: h = (b - r) / d + 2; break;
- case b: h = (r - g) / d + 4; break;
- }
- h /= 6;
- }
-
- return h;
- }
-
- function isAntialiased(sourcePix, data, cacheSet, verticalPos, horizontalPos, width){
- var offset;
- var targetPix;
- var distance = 1;
- var i;
- var j;
- var hasHighContrastSibling = 0;
- var hasSiblingWithDifferentHue = 0;
- var hasEquivilantSibling = 0;
-
- addHueInfo(sourcePix);
-
- for (i = distance*-1; i <= distance; i++){
- for (j = distance*-1; j <= distance; j++){
-
- if(i===0 && j===0){
- // ignore source pixel
- } else {
-
- offset = ((verticalPos+j)*width + (horizontalPos+i)) * 4;
- targetPix = getPixelInfo(data, offset, cacheSet);
-
- if(targetPix === null){
- continue;
- }
-
- addBrightnessInfo(targetPix);
- addHueInfo(targetPix);
-
- if( isContrasting(sourcePix, targetPix) ){
- hasHighContrastSibling++;
- }
-
- if( isRGBSame(sourcePix,targetPix) ){
- hasEquivilantSibling++;
- }
-
- if( Math.abs(targetPix.h - sourcePix.h) > 0.3 ){
- hasSiblingWithDifferentHue++;
- }
-
- if( hasSiblingWithDifferentHue > 1 || hasHighContrastSibling > 1){
- return true;
- }
- }
- }
- }
-
- if(hasEquivilantSibling < 2){
- return true;
- }
-
- return false;
- }
-
- function errorPixel(px, offset){
- px[offset] = 255; //r
- px[offset + 1] = 0; //g
- px[offset + 2] = 255; //b
- px[offset + 3] = 255; //a
- }
-
- function copyPixel(px, offset, data){
- px[offset] = data.r; //r
- px[offset + 1] = data.g; //g
- px[offset + 2] = data.b; //b
- px[offset + 3] = data.a; //a
- }
-
- function copyGrayScalePixel(px, offset, data){
- px[offset] = data.brightness; //r
- px[offset + 1] = data.brightness; //g
- px[offset + 2] = data.brightness; //b
- px[offset + 3] = data.a; //a
- }
-
-
- function getPixelInfo(data, offset, cacheSet){
- var r;
- var g;
- var b;
- var d;
- var a;
-
- if(typeof data[offset] !== 'undefined'){
- r = data[offset];
- g = data[offset+1];
- b = data[offset+2];
- a = data[offset+3];
- d = {
- r: r,
- g: g,
- b: b,
- a: a
- };
-
- return d;
- } else {
- return null;
- }
- }
-
- function addBrightnessInfo(data){
- data.brightness = getBrightness(data.r,data.g,data.b); // 'corrected' lightness
- }
-
- function addHueInfo(data){
- data.h = getHue(data.r,data.g,data.b);
- }
-
- function analyseImages(img1, img2, width, height){
-
- var hiddenCanvas = document.createElement('canvas');
-
- var data1 = img1.data;
- var data2 = img2.data;
-
- hiddenCanvas.width = width;
- hiddenCanvas.height = height;
-
- var context = hiddenCanvas.getContext('2d');
- var imgd = context.createImageData(width,height);
- var targetPix = imgd.data;
-
- var mismatchCount = 0;
-
- var time = Date.now();
-
- var skip;
-
- if( (width > 1200 || height > 1200) && ignoreAntialiasing){
- skip = 6;
- }
-
- loop(height, width, function(verticalPos, horizontalPos){
-
- if(skip){ // only skip if the image isn't small
- if(verticalPos % skip === 0 || horizontalPos % skip === 0){
- return;
- }
- }
-
- var offset = (verticalPos*width + horizontalPos) * 4;
- var pixel1 = getPixelInfo(data1, offset, 1);
- var pixel2 = getPixelInfo(data2, offset, 2);
-
- if(pixel1 === null || pixel2 === null){
- return;
- }
-
- if (ignoreColors){
-
- addBrightnessInfo(pixel1);
- addBrightnessInfo(pixel2);
-
- if( isPixelBrightnessSimilar(pixel1, pixel2) ){
- copyGrayScalePixel(targetPix, offset, pixel2);
- } else {
- errorPixel(targetPix, offset);
- mismatchCount++;
- }
- return;
- }
-
- if( isRGBSimilar(pixel1, pixel2) ){
- copyPixel(targetPix, offset, pixel2);
-
- } else if( ignoreAntialiasing && (
- addBrightnessInfo(pixel1), // jit pixel info augmentation looks a little weird, sorry.
- addBrightnessInfo(pixel2),
- isAntialiased(pixel1, data1, 1, verticalPos, horizontalPos, width) ||
- isAntialiased(pixel2, data2, 2, verticalPos, horizontalPos, width)
- )){
-
- if( isPixelBrightnessSimilar(pixel1, pixel2) ){
- copyGrayScalePixel(targetPix, offset, pixel2);
- } else {
- errorPixel(targetPix, offset);
- mismatchCount++;
- }
- } else {
- errorPixel(targetPix, offset);
- mismatchCount++;
- }
-
- });
-
- data.misMatchPercentage = (mismatchCount / (height*width) * 100).toFixed(2);
- data.analysisTime = Date.now() - time;
-
- data.getImageDataUrl = function(text){
- var barHeight = 0;
-
- if(text){
- barHeight = addLabel(text,context,hiddenCanvas);
- }
-
- context.putImageData(imgd, 0, barHeight);
-
- return hiddenCanvas.toDataURL("image/png");
- };
- }
-
- function addLabel(text, context, hiddenCanvas){
- var textPadding = 2;
-
- context.font = '12px sans-serif';
-
- var textWidth = context.measureText(text).width + textPadding*2;
- var barHeight = 22;
-
- if(textWidth > hiddenCanvas.width){
- hiddenCanvas.width = textWidth;
- }
-
- hiddenCanvas.height += barHeight;
-
- context.fillStyle = "#666";
- context.fillRect(0,0,hiddenCanvas.width,barHeight -4);
- context.fillStyle = "#fff";
- context.fillRect(0,barHeight -4,hiddenCanvas.width, 4);
-
- context.fillStyle = "#fff";
- context.textBaseline = "top";
- context.font = '12px sans-serif';
- context.fillText(text, textPadding, 1);
-
- return barHeight;
- }
-
- function normalise(img, w, h){
- var c;
- var context;
-
- if(img.height < h || img.width < w){
- c = document.createElement('canvas');
- c.width = w;
- c.height = h;
- context = c.getContext('2d');
- context.putImageData(img, 0, 0);
- return context.getImageData(0, 0, w, h);
- }
-
- return img;
- }
-
- function compare(one, two){
-
- function onceWeHaveBoth(){
- var width;
- var height;
- if(images.length === 2){
- width = images[0].width > images[1].width ? images[0].width : images[1].width;
- height = images[0].height > images[1].height ? images[0].height : images[1].height;
-
- if( (images[0].width === images[1].width) && (images[0].height === images[1].height) ){
- data.isSameDimensions = true;
- } else {
- data.isSameDimensions = false;
- }
-
- data.dimensionDifference = { width: images[0].width - images[1].width, height: images[0].height - images[1].height };
-
- analyseImages( normalise(images[0],width, height), normalise(images[1],width, height), width, height);
-
- triggerDataUpdate();
- }
- }
-
- images = [];
- loadImageData(one, onceWeHaveBoth);
- loadImageData(two, onceWeHaveBoth);
- }
-
- function getCompareApi(param){
-
- var secondFileData,
- hasMethod = typeof param === 'function';
-
- if( !hasMethod ){
- // assume it's file data
- secondFileData = param;
- }
-
- var self = {
- ignoreNothing: function(){
-
- tolerance.red = 16;
- tolerance.green = 16;
- tolerance.blue = 16;
- tolerance.alpha = 16;
- tolerance.minBrightness = 16;
- tolerance.maxBrightness = 240;
-
- ignoreAntialiasing = false;
- ignoreColors = false;
-
- if(hasMethod) { param(); }
- return self;
- },
- ignoreAntialiasing: function(){
-
- tolerance.red = 32;
- tolerance.green = 32;
- tolerance.blue = 32;
- tolerance.alpha = 32;
- tolerance.minBrightness = 64;
- tolerance.maxBrightness = 96;
-
- ignoreAntialiasing = true;
- ignoreColors = false;
-
- if(hasMethod) { param(); }
- return self;
- },
- ignoreColors: function(){
-
- tolerance.alpha = 16;
- tolerance.minBrightness = 16;
- tolerance.maxBrightness = 240;
-
- ignoreAntialiasing = false;
- ignoreColors = true;
-
- if(hasMethod) { param(); }
- return self;
- },
- onComplete: function( callback ){
-
- updateCallbackArray.push(callback);
-
- var wrapper = function(){
- compare(fileData, secondFileData);
- };
-
- wrapper();
-
- return getCompareApi(wrapper);
- }
- };
-
- return self;
- }
-
- return {
- onComplete: function( callback ){
- updateCallbackArray.push(callback);
- loadImageData(fileData, function(imageData, width, height){
- parseImage(imageData.data, width, height);
- });
- },
- compareTo: function(secondFileData){
- return getCompareApi(secondFileData);
- }
- };
-
- };
-}(this));
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/twentytwenty.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/twentytwenty.css
deleted file mode 100644
index 3551a431bf..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/twentytwenty.css
+++ /dev/null
@@ -1,146 +0,0 @@
-.twentytwenty-handle:before, .twentytwenty-handle:after {
- content: " ";
- display: block;
- width: 3px;
- background: white;
- height: 9999px;
- position: absolute;
- left: 50%;
- margin-left: -1.5px;
- z-index: 30;
- -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5);
- -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5);
- box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); }
-
-.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay {
- position: absolute;
- top: 0;
- width: 100%;
- height: 100%; }
-
-.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay {
- -webkit-transition-duration: 0.5s;
- -moz-transition-duration: 0.5s;
- transition-duration: 0.5s; }
-
-.twentytwenty-before-label, .twentytwenty-after-label {
- -webkit-transition-property: opacity;
- -moz-transition-property: opacity;
- transition-property: opacity; }
-
-.twentytwenty-before-label:before, .twentytwenty-after-label:before {
- color: white;
- font-size: 13px;
- letter-spacing: 0.1em; }
-
-.twentytwenty-before-label:before, .twentytwenty-after-label:before {
- background: rgba(255, 255, 255, 0.2);
- position: absolute;
- top: 50%;
- margin-top: -19px;
- line-height: 38px;
- padding: 0 20px;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px; }
-
-.twentytwenty-left-arrow, .twentytwenty-right-arrow {
- width: 0;
- height: 0;
- border: 6px inset transparent;
- position: absolute;
- top: 50%;
- margin-top: -6px; }
-
-.twentytwenty-container {
- -webkit-box-sizing: content-box;
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- overflow: hidden;
- position: relative;
- -webkit-user-select: none;
- -moz-user-select: none; }
- .twentytwenty-container img {
- position: absolute;
- top: 0;
- display: block; }
- .twentytwenty-container.active .twentytwenty-overlay, .twentytwenty-container.active :hover.twentytwenty-overlay {
- background: rgba(0, 0, 0, 0); }
- .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-before-label,
- .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-after-label, .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-before-label,
- .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-after-label {
- opacity: 0; }
- .twentytwenty-container * {
- -webkit-box-sizing: content-box;
- -moz-box-sizing: content-box;
- box-sizing: content-box; }
-
-.twentytwenty-before-label {
- opacity: 0; }
- .twentytwenty-before-label:before {
- content: "Before";
- left: 10px; }
-
-.twentytwenty-after-label {
- opacity: 0; }
- .twentytwenty-after-label:before {
- content: "After";
- right: 10px; }
-
-.twentytwenty-overlay {
- -webkit-transition-property: background;
- -moz-transition-property: background;
- transition-property: background;
- background: rgba(0, 0, 0, 0);
- z-index: 25; }
- .twentytwenty-overlay:hover {
- background: rgba(0, 0, 0, 0.5); }
- .twentytwenty-overlay:hover .twentytwenty-after-label {
- opacity: 1; }
- .twentytwenty-overlay:hover .twentytwenty-before-label {
- opacity: 1; }
-
-.twentytwenty-before {
- z-index: 20; }
-
-.twentytwenty-after {
- z-index: 10; }
-
-.twentytwenty-handle {
- height: 38px;
- width: 38px;
- position: absolute;
- left: 50%;
- top: 50%;
- margin-left: -22px;
- margin-top: -22px;
- border: 3px solid white;
- -webkit-border-radius: 1000px;
- -moz-border-radius: 1000px;
- border-radius: 1000px;
- -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5);
- -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5);
- box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5);
- z-index: 40; }
- .twentytwenty-handle:before {
- bottom: 50%;
- margin-bottom: 22px;
- -webkit-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5);
- -moz-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5);
- box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); }
- .twentytwenty-handle:after {
- top: 50%;
- margin-top: 22px;
- -webkit-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5);
- -moz-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5);
- box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); }
-
-.twentytwenty-left-arrow {
- border-right: 6px solid white;
- left: 50%;
- margin-left: -17px; }
-
-.twentytwenty-right-arrow {
- border-left: 6px solid white;
- right: 50%;
- margin-right: -17px; }
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/twentytwenty.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/twentytwenty.js
deleted file mode 100644
index 7b264d3a68..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/image/res/twentytwenty.js
+++ /dev/null
@@ -1,90 +0,0 @@
-(function($){
-
- $.fn.twentytwenty = function(options) {
- var options = $.extend({default_offset_pct: 0.5}, options);
- return this.each(function() {
-
- var sliderPct = options.default_offset_pct;
- var container = $(this);
-
- container.wrap("<div class='twentytwenty-wrapper'></div>");
- container.append("<div class='twentytwenty-overlay'></div>");
- var beforeImg = container.find("img:first");
- var afterImg = container.find("img:last");
- container.append("<div class='twentytwenty-handle'></div>");
- var slider = container.find(".twentytwenty-handle");
- slider.append("<span class='twentytwenty-left-arrow'></span>");
- slider.append("<span class='twentytwenty-right-arrow'></span>");
- container.addClass("twentytwenty-container");
- beforeImg.addClass("twentytwenty-before");
- afterImg.addClass("twentytwenty-after");
-
- var overlay = container.find(".twentytwenty-overlay");
- overlay.append("<div class='twentytwenty-before-label'></div>");
- overlay.append("<div class='twentytwenty-after-label'></div>");
-
- var calcOffset = function(widthPct) {
- var w = beforeImg.width();
- var h = beforeImg.height();
- return {
- w: w+"px",
- h: h+"px",
- cw: (widthPct*w)+"px"
- };
- };
-
- var adjustContainer = function(offset) {
- beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
- container.css("height", Math.max(beforeImg.height(), afterImg.height()));
- container.css("width", Math.max(beforeImg.width(), afterImg.width()));
- };
-
- var adjustSlider = function(pct) {
- var offset = calcOffset(pct);
- //slider.css("height", offset.h);
- slider.css("left", offset.cw);
- adjustContainer(offset);
- }
-
- $(window).on("resize.twentytwenty", function(e) {
- adjustSlider(sliderPct);
- });
-
- var offsetX = 0;
- var imgWidth = 0;
-
- container.on("movestart", function(e) {
- if ((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) {
- e.preventDefault();
- }
- container.addClass("active");
- offsetX = container.offset().left;
- imgWidth = beforeImg.width();
- });
-
- container.on("moveend", function(e) {
- container.removeClass("active");
- });
-
- container.on("move", function(e) {
- if (container.hasClass("active")) {
- sliderPct = (e.pageX-offsetX)/imgWidth;
- if (sliderPct < 0) {
- sliderPct = 0;
- }
- if (sliderPct > 1) {
- sliderPct = 1;
- }
- adjustSlider(sliderPct);
- }
- });
-
- container.find("img").on("mousedown", function(e) {
- event.preventDefault();
- });
-
- $(window).trigger("resize.twentytwenty");
- });
- };
-
-})(jQuery);
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/ExpandContextLines.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/ExpandContextLines.java
deleted file mode 100644
index 03d8d726c9..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/ExpandContextLines.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.text;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-
-import com.pmease.commons.wicket.AjaxEvent;
-
-public class ExpandContextLines extends AjaxEvent {
-
- public static enum Direction {
- ABOVE, BELOW
- }
-
- private final Direction direction;
-
- public ExpandContextLines(AjaxRequestTarget target, Direction direction) {
- super(target);
- this.direction = direction;
- }
-
- public Direction getDirection() {
- return direction;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/HunkPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/HunkPanel.html
deleted file mode 100644
index 01f2903b99..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/HunkPanel.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <tr class="diff-line hunk-head" wicket:id="aboveexpander">
- <td class="diff-line-num expander" colspan="2">
- <a class="has-tip" data-toggle="tooltip" title="show more lines" wicket:id="expander"><i class="fa fa-sort"></i></a>
- </td>
- <td class="diff-line-code">
- <pre wicket:id="header">@@ xxx @@ context func</pre>
- </td>
- </tr>
- <tr wicket:id="hunklines">
- <wicket:container wicket:id="line"></wicket:container>
- </tr>
- <tr class="diff-line hunk-head" wicket:id="belowexpander">
- <td class="diff-line-num expander" colspan="2">
- <a class="has-tip" data-toggle="tooltip" data-placement="bottom" title="show more lines" wicket:id="expander"><i class="fa fa-sort"></i></a>
- </td>
- <td class="diff-line-code"></td>
- </tr>
-
- <wicket:fragment wicket:id="linefrag">
- <td class="diff-line-num old">
- <a class="add-comment" wicket:id="commentlink"><i class="fa fa-comments"></i></a>
- <span wicket:id="oldnum"></span>
- </td>
- <td class="diff-line-num new">
- <span wicket:id="newnum"></span>
- </td>
- <td class="diff-line-code">
- <pre wicket:id="code"></pre>
- </td>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="commentfrag">
- <td class="comment-count" colspan="2">
- <i class="fa fa-comment"></i> <b wicket:id="count"></b>
- </td>
-
- <td class="line-comment">
- <div wicket:id="commentsholder">
- <div class="inline-comment" wicket:id="comments">
- <div wicket:id="comment"></div>
- </div>
-
- <p class="addnote" wicket:id="addnotespan"><a class="btn btn-gray btn-sm" wicket:id="btnadd">Add a comment</a></p>
- </div>
-
- <div wicket:id="commentform"></div>
- </td>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/HunkPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/HunkPanel.java
deleted file mode 100644
index c0de05b778..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/HunkPanel.java
+++ /dev/null
@@ -1,790 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.text;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.list.Loop;
-import org.apache.wicket.markup.html.list.LoopItem;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.markup.repeater.RepeatingView;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.util.iterator.ComponentHierarchyIterator;
-import org.parboiled.common.Preconditions;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.OldCommitComment;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.Constants;
-import com.pmease.gitplex.web.GitPlexSession;
-import com.pmease.gitplex.web.component.comment.OldCommitCommentEditor;
-import com.pmease.gitplex.web.component.comment.OldCommitCommentPanel;
-import com.pmease.gitplex.web.component.comment.event.AbstractLineCommentEvent;
-import com.pmease.gitplex.web.component.comment.event.CloseLineCommentForm;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentAdded;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentEvent;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentRemoved;
-import com.pmease.gitplex.web.component.comment.event.OpenLineCommentForm;
-import com.pmease.gitplex.web.model.CommitCommentModel;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.CommitCommentsAware;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.HunkHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.HunkLine;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.HunkLine.LineType;
-
-import de.agilecoders.wicket.jquery.JQuery;
-
-@SuppressWarnings({ "serial", "deprecation" })
-public class HunkPanel extends Panel {
-
- private final IModel<Repository> repoModel;
-
- private final IModel<FileHeader> fileModel;
-
- private final IModel<List<String>> blobLinesModel;
-
- private final String revision;
-
- private RepeatingView linesView;
-
- private int startLine;
-
- private int endLine;
-
- private final IModel<Multimap<String, Long>> commentsModel;
-
- final static String INSERT_AFTER_ROW = "var item = document.createElement('tr'); item.id='%s'; $(item).insertAfter($('#%s'));";
- final static String INSERT_BEFORE_ROW = "var item = document.createElement('tr'); item.id='%s'; $(item).insertBefore($('#%s'));";
-
- public HunkPanel(String id,
- IModel<Repository> repoModel,
- String revision,
- IModel<Integer> indexModel,
- IModel<FileHeader> fileModel,
- IModel<List<String>> blobLinesModel) {
-
- super(id, indexModel);
-
- this.repoModel = repoModel;
- this.revision = revision;
- this.fileModel = fileModel;
- this.blobLinesModel = blobLinesModel;
-
- this.commentsModel = new LoadableDetachableModel<Multimap<String, Long>>() {
-
- @Override
- protected Multimap<String, Long> load() {
- List<OldCommitComment> comments = getCommentsAware().getCommitComments();
- Multimap<String, Long> map = LinkedListMultimap.<String, Long>create();
-
- String fileId = TextDiffPanel.getFileId(getFile());
- for (OldCommitComment each : comments) {
- String line = each.getLine();
- if (!Strings.isNullOrEmpty(line) && line.startsWith(fileId)) {
- map.put(line, each.getId());
- }
- }
-
- return map;
- }
- };
- }
-
- private CommitCommentsAware getCommentsAware() {
- Page page = getPage();
- Preconditions.checkState(page instanceof CommitCommentsAware);
- return (CommitCommentsAware) page;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(createAboveExpander());
- add(createHunkLines());
- add(createBelowExpander());
- }
-
- private Component createAboveExpander() {
- WebMarkupContainer aboveExpander = new WebMarkupContainer("aboveexpander") {
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- HunkHeader previous = getPreviousHunk();
- if (previous != null) {
- this.setVisibilityAllowed(startLine > previous.getNewEndLine() + 1);
- }
- }
- };
-
- aboveExpander.setOutputMarkupId(true);
-
- aboveExpander.add(new Label("header", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- HunkHeader current = getCurrentHunk();
- StringBuffer sb = new StringBuffer();
- if (startLine == current.getNewStartLine()) {
- sb.append("@@ ")
- .append("-")
- .append(current.getOldImage().getStartLine())
- .append(",")
- .append(current.getOldImage().getLineCount())
- .append(" +")
- .append(current.getNewStartLine())
- .append(",")
- .append(current.getNewLineCount())
- .append(" @@ ").append(current.getHunkFunction());
- } else {
- int offset = current.getNewStartLine() - startLine;
- int oldStart = current.getOldImage().getStartLine() - offset;
- offset = Math.min(offset, 20);
- sb.append("@@ ")
- .append("-")
- .append(oldStart).append(",").append(offset)
- .append(" +")
- .append(startLine).append(",").append(offset)
- .append(" @@");
- }
-
- return sb.toString();
- }
- }));
-
- aboveExpander.add(new AjaxLink<Void>("expander") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- expandAbove(target);
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisibilityAllowed(isAboveExpandable());
- }
- }.setOutputMarkupId(true));
-
- return aboveExpander;
- }
-
- private int expandAboveTo() {
- int start = Math.max(startLine - 20, 1);
- HunkHeader previous = getPreviousHunk();
- if (previous != null) {
- int previousEnd = previous.getNewEndLine();
- start = Math.max(previousEnd + 1, start);
- }
-
- return start;
- }
-
- private void expandAbove(AjaxRequestTarget target) {
- int newStart = expandAboveTo();
- if (newStart == startLine) {
- return;
- }
-
- Component expander = createAboveExpander();
- addOrReplace(expander);
- target.add(expander);
-
- String aboveMarkupId = expander.getMarkupId();
- target.appendJavaScript("$('#" + aboveMarkupId + " .has-tip').tooltip();");
-
- HunkHeader hunk = getCurrentHunk();
- List<String> blobLines = blobLinesModel.getObject();
-
- int totalOffset = hunk.getNewStartLine() - newStart;
- int oldStart = hunk.getOldImage().getStartLine() - totalOffset;
-
- for (int i = newStart; i < startLine; i++) {
- HunkLine line = HunkLine.builder()
- .lineType(LineType.CONTEXT)
- .oldLineNo(oldStart)
- .newLineNo(i)
- .text(blobLines.get(i - 1))
- .build();
-
- String markupId = linesView.newChildId();
- Component item = newLineRow(markupId, line, -1);
- item.setOutputMarkupId(true);
-
- insertRow(target, item, aboveMarkupId);
- oldStart++;
- aboveMarkupId = item.getMarkupId();
- }
-
- startLine = newStart;
- }
-
- private void insertRow(AjaxRequestTarget target, Component row, String afterId) {
- target.prependJavaScript(String.format(INSERT_AFTER_ROW, row.getMarkupId(), afterId));
- linesView.addOrReplace(row);
- target.add(row);
- }
-
- private boolean isAboveExpandable() {
- if (startLine == 1 || startLine < 0) {
- return false;
- }
-
- HunkHeader previous = getPreviousHunk();
- if (previous == null) {
- return true;
- }
-
- return startLine > previous.getNewEndLine() + 1;
- }
-
- private Multimap<String, Long> getInlineComments() {
- return commentsModel.getObject();
- }
-
- @Override
- public void onEvent(IEvent<?> event) {
- if (event.getPayload() instanceof OpenLineCommentForm) {
- OpenLineCommentForm e = (OpenLineCommentForm) event.getPayload();
- int position = e.getPosition();
- CommentRow commentRow = findCommentRow(position);
-
- if (commentRow == null) {
- // insert a comment row
- Component row = newCommentRow(position, true);
- Component lineRow = findLineRow(position);
- insertRow(e.getTarget(), row, lineRow.getParent().getMarkupId());
- }
- }
- }
-
- private LineRow findLineRow(int position) {
- ComponentHierarchyIterator it = linesView.visitChildren(LineRow.class);
- LineRow row = null;
- while (it.hasNext()) {
- LineRow each = (LineRow) it.next();
- if (each.position == position) {
- row = each;
- break;
- }
- }
-
- Preconditions.checkState(row != null, "line row " + position + " doesn't exist");
- return row;
- }
-
- private CommentRow findCommentRow(int position) {
- ComponentHierarchyIterator it = linesView.visitChildren(CommentRow.class);
- CommentRow row = null;
- while (it.hasNext()) {
- CommentRow each = (CommentRow) it.next();
- if (each.position == position) {
- row = each;
- break;
- }
- }
-
- return row;
- }
-
- String getLineId(int position) {
- return OldCommitComment.buildLineId(TextDiffPanel.getFileId(getFile()), getHunkIndex(), position);
- }
-
- private Component createHunkLines() {
- linesView = new RepeatingView("hunklines");
-
- List<HunkLine> lines = getCurrentHunk().getLines();
-
- Multimap<String, Long> inlineComments = getInlineComments();
-
- boolean showComments = getCommentsAware().isShowInlineComments();
-
- for (int i = 0; i < lines.size(); i++) {
- HunkLine line = lines.get(i);
- Component item = newLineRow(linesView.newChildId(), line, i + 1);
- linesView.add(item);
-
- if (showComments) {
- String lineId = getLineId(i + 1);
- if (inlineComments.containsKey(lineId)) {
- // create inline comment block
- item = newCommentRow(i + 1, false);
- linesView.add(item);
- }
- }
- }
-
- if (!lines.isEmpty()) {
- HunkLine line = Iterables.getFirst(lines, null);
- startLine = line.getNewLineNo();
- line = Iterables.getLast(lines);
- endLine = line.getNewLineNo();
- }
-
- return linesView;
- }
-
- int getPreviousTotalLines() {
- int lines = 0;
- for (int i = 0; i < getHunkIndex(); i++) {
- lines += getHunk(i).getLines().size();
- }
-
- return lines;
- }
-
- private WebMarkupContainer newCommentForm(final int position) {
- return new OldCommitCommentEditor("commentform") {
- @Override
- protected void onCancel(AjaxRequestTarget target, Form<?> form) {
- send(HunkPanel.this, Broadcast.DEPTH, new CloseLineCommentForm(target, position, getLineId(position)));
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- String lineId = getLineId(position);
- OldCommitComment comment = new OldCommitComment();
- comment.setAuthor(GitPlexSession.getCurrentUser().get());
- comment.setCommit(revision);
- comment.setLine(lineId);
- comment.setRepository(repoModel.getObject());
- comment.setContent(getCommentText());
- GitPlex.getInstance(Dao.class).persist(comment);
-
- send(getPage(), Broadcast.DEPTH, new CommitCommentAdded(target, comment));
- }
-
- @Override
- protected IModel<String> getCancelButtonLabel() {
- return Model.of("Close form");
- }
-
- @Override
- protected IModel<String> getSubmitButtonLabel() {
- return Model.of("Comment on this line");
- }
- };
- }
-
- /**
- * A row for rendering the source line information
- */
- private class LineRow extends Fragment {
-
- private final int position;
-
- public LineRow(String id, IModel<HunkLine> model, int position) {
- super(id, "linefrag", HunkPanel.this, model);
-
- this.position = position;
- }
-
- private HunkLine getLine() {
- return (HunkLine) getDefaultModelObject();
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- HunkLine line = getLine();
- String oldLineNo, newLineNo;
- if (line.getLineType() == LineType.CONTEXT) {
- oldLineNo = String.valueOf(line.getOldLineNo());
- newLineNo = String.valueOf(line.getNewLineNo());
- } else if (line.getLineType() == LineType.OLD) {
- oldLineNo = "- " + line.getOldLineNo();
- newLineNo = "&nbsp;";
- } else {
- oldLineNo = "&nbsp;";
- newLineNo = "+ " + line.getNewLineNo();
- }
-
- add(new Label("oldnum", oldLineNo).setEscapeModelStrings(false));
- add(new Label("newnum", newLineNo).setEscapeModelStrings(false));
- add(new Label("code", Model.of(line.getText())));
-
- if (position < 0
- || !GitPlexSession.getCurrentUser().isPresent()
- || !getCommentsAware().canAddComments()) {
- add(new WebMarkupContainer("commentlink").setVisibilityAllowed(false));
- } else {
- add(new AjaxLink<Void>("commentlink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- send(HunkPanel.this, Broadcast.BREADTH, new OpenLineCommentForm(target, position, getLineId(position)));
- }
- });
- }
- }
- }
-
- /**
- * Create a hunk line row, the row including old line number, new line number
- * and line code, the line can be one of OLD, NEW or CONTEXT
- *
- * @param id
- * @param line
- * @param position
- * @return
- */
- private Component newLineRow(String id, HunkLine line, final int position) {
- WebMarkupContainer item = new WebMarkupContainer(id);
- item.setOutputMarkupId(true);
- item.add(AttributeAppender.append("class", "diff-line " + line.getLineType().name().toLowerCase()));
- item.add(new LineRow("line", Model.of(line), position));
- return item;
- }
-
- /**
- * Comment row, including the discussions on a line and form for commenting
- * the line
- */
- private class CommentRow extends Fragment {
-
- final int position;
- boolean withForm;
-
- WebMarkupContainer commentForm;
- WebMarkupContainer commentsHolder;
-
- public CommentRow(String id, int position, boolean withForm) {
- super(id, "commentfrag", HunkPanel.this);
-
- this.position = position;
- this.withForm = withForm;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- IModel<Integer> sizeModel = new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- return getCommentIds().size();
- }
- };
-
- add(new Label("count", sizeModel).setOutputMarkupId(true));
-
- commentsHolder = new WebMarkupContainer("commentsholder");
-
- commentsHolder.setOutputMarkupId(true);
- add(commentsHolder);
-
- Loop commentsView = new Loop("comments", sizeModel) {
-
- @Override
- protected void populateItem(LoopItem item) {
- int index = item.getIndex();
- OldCommitComment comment = getComment(index);
- item.add(new OldCommitCommentPanel("comment", new CommitCommentModel(comment)));
- }
- };
-
- commentsHolder.add(commentsView);
-
- if (withForm) {
- commentForm = newCommentForm(position);
- } else {
- commentForm = newEmptyForm();
- }
-
- add(commentForm);
-
- // Add note button should be created after commentForm created
- commentsHolder.add(newAddNoteButton());
- }
-
- private Component newAddNoteButton() {
- WebMarkupContainer container = new WebMarkupContainer("addnotespan");
- container.setOutputMarkupId(true);
- Component result = new AjaxLink<Integer>("btnadd") {
- @Override
- public void onClick(AjaxRequestTarget target) {
- send(HunkPanel.this, Broadcast.BREADTH, new OpenLineCommentForm(target, position, getLineId(position)));
- }
- };
-
- result.setVisible(
- GitPlexSession.getCurrentUser().isPresent()
- && getCommentsAware().canAddComments()
- && !(commentForm instanceof OldCommitCommentEditor)
- && !getCommentIds().isEmpty());
-
- container.add(result);
- return container;
- }
-
- private WebMarkupContainer newEmptyForm() {
- WebMarkupContainer commentForm = new WebMarkupContainer("commentform");
- commentForm.setOutputMarkupId(true);
- return commentForm;
- }
-
- private OldCommitComment getComment(int index) {
- Long id = Iterables.get(getCommentIds(), index);
- return GitPlex.getInstance(Dao.class).load(OldCommitComment.class, id);
- }
-
- private List<Long> getCommentIds() {
- Multimap<String, Long> map = getInlineComments();
- final String lineId = getLineId(position);
- List<Long> ids = Lists.newArrayList(map.get(lineId));
- Collections.sort(ids);
- return ids;
- }
-
- private void updateAddNoteButton(AjaxRequestTarget target) {
- Component noteBtn = newAddNoteButton();
- commentsHolder.addOrReplace(noteBtn);
- target.add(noteBtn);
- }
-
- private void onCloseComment(CloseLineCommentForm e) {
- List<Long> ids = getCommentIds();
- if (ids.isEmpty()) {
- // remove the whole row
- Component parent = getParent();
- linesView.remove(parent);
- e.getTarget().appendJavaScript("$('#" + parent.getMarkupId() + "').remove()");
- } else {
- // only hide comment form and show add note button
- commentForm = newEmptyForm();
- addOrReplace(commentForm);
- e.getTarget().add(commentForm);
-
- updateAddNoteButton(e.getTarget());
- }
- }
-
- private void onAddComment(OpenLineCommentForm e) {
- // show this row first in case all comment rows are hidden
- e.getTarget().prependJavaScript("$('#" + getParent().getMarkupId(true) + "').show()");
-
- if (commentForm instanceof OldCommitCommentEditor) {
- // form maybe hidden
- e.getTarget().appendJavaScript("$('#" + commentForm.getMarkupId(true) + "').show()");
- } else {
- commentForm = newCommentForm(position);
- addOrReplace(commentForm);
- e.getTarget().add(commentForm);
- }
-
- updateAddNoteButton(e.getTarget());
- }
-
- private void onCommentAdded(CommitCommentAdded e) {
- e.getTarget().add(get("count"));
- commentForm = newEmptyForm();
- addOrReplace(commentForm);
- e.getTarget().add(commentForm);
-
- commentsHolder.addOrReplace(newAddNoteButton());
- e.getTarget().add(commentsHolder);
- e.getTarget().appendJavaScript(JQuery.$(commentsHolder, ".age").chain("tooltip").get());
- }
-
- private void onCommentRemoved(CommitCommentRemoved e) {
- List<Long> ids = getCommentIds();
- if (ids.isEmpty()) {
- // remove the whole row
- Component parent = getParent();
- linesView.remove(parent);
- e.getTarget().appendJavaScript("$('#" + parent.getMarkupId() + "').remove()");
- } else {
- e.getTarget().add(get("count"));
-
- commentsHolder.addOrReplace(newAddNoteButton());
- e.getTarget().add(commentsHolder);
- }
- }
-
- @Override
- public void onEvent(IEvent<?> sink) {
- if (sink.getPayload() instanceof AbstractLineCommentEvent) {
- AbstractLineCommentEvent e = (AbstractLineCommentEvent) sink.getPayload();
- if (e.getPosition() != position) {
- return;
- }
-
- if (e instanceof CloseLineCommentForm) {
- onCloseComment((CloseLineCommentForm) e);
-
- } else if (e instanceof OpenLineCommentForm) {
- onAddComment((OpenLineCommentForm) e);
-
- }
-
- } else if (sink.getPayload() instanceof CommitCommentEvent) {
- CommitCommentEvent e = (CommitCommentEvent) sink.getPayload();
- if (!e.getComment().isLineComment()) {
- return;
- }
-
- if (!Objects.equal(getLineId(position), e.getComment().getLine())) {
- return;
- }
-
- if (e instanceof CommitCommentAdded) {
- onCommentAdded((CommitCommentAdded) e);
- } else if (e instanceof CommitCommentRemoved) {
- onCommentRemoved((CommitCommentRemoved) e);
- }
- }
-
- }
- }
-
- private Component newCommentRow(int position, boolean withForm) {
- WebMarkupContainer item = new WebMarkupContainer(linesView.newChildId());
- item.setOutputMarkupId(true);
- item.add(AttributeAppender.append("class", "inline-comment-holder"));
- item.add(new CommentRow("line", position, withForm));
-
- return item;
- }
-
- private Component createBelowExpander() {
- WebMarkupContainer expanderTr = new WebMarkupContainer("belowexpander") {
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- setVisibilityAllowed(isLastHunk() && isBelowExpandable());
- }
- };
- expanderTr.setOutputMarkupId(true);
-
- expanderTr.add(new AjaxLink<Void>("expander") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- expandBelow(target);
- }
- });
-
- return expanderTr;
- }
-
- private boolean isLastHunk() {
- return getHunkIndex() == getFile().getHunks().size() - 1;
- }
-
- private void expandBelow(AjaxRequestTarget target) {
- int lineNo = endLine + 20;
- List<String> blobLines = blobLinesModel.getObject();
- lineNo = Math.min(lineNo, blobLines.size());
- if (lineNo == endLine) {
- return;
- }
-
- Component expander = createBelowExpander();
- addOrReplace(expander);
- target.add(expander);
- target.appendJavaScript("$('#" + expander.getMarkupId(true) + " a').tooltip();");
-
- int offset = endLine - getCurrentHunk().getNewEndLine() + 1;
- int oldLineNo = getCurrentHunk().getOldEndLine() + offset;
-
- String id = expander.getMarkupId();
- for (int i = lineNo; i >= endLine + 1; i--) {
- HunkLine line = HunkLine.builder()
- .text(blobLines.get(i - 1))
- .newLineNo(i)
- .oldLineNo(oldLineNo)
- .lineType(LineType.CONTEXT)
- .build();
-
- Component item = newLineRow(linesView.newChildId(), line, -1);
- item.setOutputMarkupId(true);
-
- target.prependJavaScript(String.format(INSERT_BEFORE_ROW, item.getMarkupId(), id));
- linesView.addOrReplace(item);
- target.add(item);
-
-// insertRow(target, item, belowMarkupId);
- oldLineNo++;
-// belowMarkupId = item.getMarkupId();
- id = item.getMarkupId();
- }
-
- endLine = lineNo;
- }
-
- private boolean isBelowExpandable() {
- List<HunkLine> lines = getCurrentHunk().getLines();
-
- if (lines.size() <= Constants.DEFAULT_CONTEXT_LINES) {
- // all lines have been displayed
- return false;
- } else {
- // check the last line but two
- HunkLine line = lines.get(lines.size() - Constants.DEFAULT_CONTEXT_LINES);
-
- if (line.getLineType() != LineType.CONTEXT) {
- return false;
- } else if (endLine > getCurrentHunk().getNewEndLine()) {
- // already expanded
- return endLine < blobLinesModel.getObject().size();
- }
- }
-
- return true;
- }
-
- private int getHunkIndex() {
- return (int) getDefaultModelObject();
- }
-
- private HunkHeader getHunk(int index) {
- return index < 0 ? null : getFile().getHunks().get(index);
- }
-
- private HunkHeader getCurrentHunk() {
- return getHunk(getHunkIndex());
- }
-
- private HunkHeader getPreviousHunk() {
- return getHunk(getHunkIndex() - 1);
- }
-
- private FileHeader getFile() {
- return fileModel.getObject();
- }
-
- @Override
- public void onDetach() {
- fileModel.detach();
- blobLinesModel.detach();
- commentsModel.detach();
- repoModel.detach();
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/TextDiffPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/TextDiffPanel.html
deleted file mode 100644
index da78b017c3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/TextDiffPanel.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
-
- <wicket:fragment wicket:id="tablefrag">
- <table class="table-diff">
- <wicket:container wicket:id="hunks">
- <wicket:container wicket:id="hunk"></wicket:container>
- </wicket:container>
- </table>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="actionsfrag">
- <span class="checkbox inline">
- <label>
- <input class="trigger-show-inline-comments" type="checkbox" checked> show inline comments
- </label>
- </span>
- </wicket:fragment>
-
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/TextDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/TextDiffPanel.java
deleted file mode 100644
index 31d794b602..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commit/diff/renderer/text/TextDiffPanel.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.text;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-import org.parboiled.common.Preconditions;
-
-import com.pmease.commons.git.GitUtils;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.model.OldCommitComment;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentAdded;
-import com.pmease.gitplex.web.component.comment.event.CommitCommentRemoved;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.CommitCommentsAware;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.FileHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.patch.HunkHeader;
-import com.pmease.gitplex.web.page.repository.code.commit.diff.renderer.BlobDiffPanel;
-import com.pmease.gitplex.web.service.FileBlob;
-import com.pmease.gitplex.web.service.FileBlobService;
-
-@SuppressWarnings("serial")
-public class TextDiffPanel extends BlobDiffPanel {
-
-// private IModel<Boolean> showInlineComments = Model.of(true);
-// private IModel<Boolean> enableAddComments = Model.of(true);
-
- private final IModel<FileBlob> newFileModel;
- private final IModel<FileBlob> oldFileModel;
-
- public TextDiffPanel(String id,
- int index,
- IModel<Repository> repoModel,
- IModel<FileHeader> fileModel,
- final String sinceRevision,
- final String untilRevision) {
-
- super(id, index, repoModel, fileModel, sinceRevision, untilRevision);
-
- this.newFileModel = new LoadableDetachableModel<FileBlob>() {
-
- @Override
- protected FileBlob load() {
- return loadBlob(untilRevision, getFile().getNewPath());
- }
-
- };
- this.oldFileModel = new LoadableDetachableModel<FileBlob>() {
-
- @Override
- protected FileBlob load() {
- return loadBlob(sinceRevision, getFile().getOldPath());
- }
- };
- }
-
- private FileBlob loadBlob(String revision, String path) {
- if (GitUtils.isNullHash(revision) || GitUtils.isEmptyPath(path)) {
- return null;
- }
-
- return GitPlex.getInstance(FileBlobService.class).get(repoModel.getObject(), revision, path);
- }
-
- WebMarkupContainer actionsBar;
-
- static String getFileId(FileHeader file) {
- if (file.getChangeType() == ChangeType.DELETE) {
- return file.getOldId().name();
- } else {
- return file.getNewId().name();
- }
- }
-
- private CommitCommentsAware getCommentsAware() {
- Page page = getPage();
- Preconditions.checkState(page instanceof CommitCommentsAware);
- return (CommitCommentsAware) page;
- }
-
- private boolean hasInlineComments() {
- List<OldCommitComment> comments = getCommentsAware().getCommitComments();
- String fileId = getFileId(getFile());
- for (OldCommitComment each : comments) {
- if (each.isLineComment() && each.getLine().startsWith(fileId)) {
- return true;
- }
- }
-
- return false;
- }
-
- static final String SHOW_INLINE_COMMENTS =
- "$('#%s .trigger-show-inline-comments').click(function() {\n"
- + " if ($(this).prop('checked')) {\n"
- + " $('#%s tr.inline-comment-holder').show();\n"
- + " } else {\n"
- + " $('#%s tr.inline-comment-holder').hide();\n"
- + " }\n"
- + "})";
-
- @Override
- protected Component createActionsBar(String id) {
- if (hasInlineComments()) {
- actionsBar = new Fragment(id, "actionsfrag", this) {
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript(String.format(SHOW_INLINE_COMMENTS,
- markupId, markupId, markupId)));
- }
- };
- } else {
- actionsBar = new WebMarkupContainer(id);
- }
-
- actionsBar.setOutputMarkupId(true);
- return actionsBar;
- }
-
- @Override
- public void onEvent(IEvent<?> sink) {
- if (sink.getPayload() instanceof CommitCommentAdded) {
- CommitCommentAdded e = (CommitCommentAdded) sink.getPayload();
-
- // inline comment added, enable view inline comments checkbox
- //
- if (e.getComment().isLineComment() && e.getComment().getLine().startsWith(getFileId(getFile()))) {
- addOrReplace(createActionsBar("actions"));
- e.getTarget().add(actionsBar);
- }
-
- } else if (sink.getPayload() instanceof CommitCommentRemoved) {
- CommitCommentRemoved e = (CommitCommentRemoved) sink.getPayload();
- if (!hasInlineComments()) {
- addOrReplace(createActionsBar("actions"));
- e.getTarget().add(actionsBar);
- }
- }
- }
-
- @Override
- protected Component createDiffContent(String id) {
- Fragment frag = new Fragment(id, "tablefrag", this);
- frag.add(new ListView<HunkHeader>("hunks", new LoadableDetachableModel<List<? extends HunkHeader>>() {
-
- @Override
- protected List<? extends HunkHeader> load() {
- return getFile().getHunks();
- }
-
- }) {
-
- @Override
- protected void populateItem(ListItem<HunkHeader> item) {
- item.add(new HunkPanel("hunk",
- repoModel,
- untilRevision,
- Model.of(item.getIndex()),
- getFileModel(),
- new LoadableDetachableModel<List<String>>() {
-
- @Override
- protected List<String> load() {
- FileHeader file = getFile();
- if (file.getChangeType() == ChangeType.DELETE) {
- return oldFileModel.getObject().getLines();
- } else {
- return newFileModel.getObject().getLines();
- }
- }
- }));
- }
- });
-
- return frag;
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
- }
-
- @Override
- public void onDetach() {
-
- if (newFileModel != null) {
- newFileModel.detach();
- }
-
- if (oldFileModel != null) {
- oldFileModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPage.html
deleted file mode 100644
index cf10499cf9..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPage.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <div class="padder">
- <div class="file-navigator">
- <wicket:container wicket:id="revselector"></wicket:container>
- <ol class="breadcrumb inline breadcrumb-paths">
- <li><a wicket:id="home"><b wicket:id="name"></b></a></li>
- <li wicket:id="pathSegments"><a wicket:id="link"><b wicket:id="name"></b></a></li>
- <li><b class="text-muted">Commits</b></li>
- </ol>
- </div>
-
- <div class="commits-view">
- <div wicket:id="commits"></div>
- <div class="btn-group">
- <a class="btn btn-default" wicket:id="newer"><i class="fa fa-long-arrow-left"></i> Newer</a>
- <a class="btn btn-default" wicket:id="older">Older <i class="fa fa-long-arrow-right"></i></a>
- </div>
- </div>
- </div>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPage.java
deleted file mode 100644
index 1123ed9b85..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPage.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commits;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.RestartResponseException;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-import com.pmease.commons.git.Commit;
-import com.pmease.commons.git.Git;
-import com.pmease.commons.git.GitPath;
-import com.pmease.commons.git.command.LogCommand;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.NoCommitsPage;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.code.component.RevisionSelector;
-
-@SuppressWarnings("serial")
-public class RepoCommitsPage extends RepositoryPage {
-
- public static final int COMMITS_PER_PAGE = 30;
-
- private final int page;
-
- private final IModel<List<Commit>> commitsModel;
-
- public static PageParameters paramsOf(Repository repository, String revision,
- String path, int page) {
- PageParameters params = paramsOf(repository, revision, path);
-
- if (page > 0)
- params.set("page", page);
-
- return params;
- }
-
- public RepoCommitsPage(PageParameters params) {
- super(params);
-
- if (!getRepository().git().hasCommits())
- throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
-
- page = params.get("page").toInt(1);
-
- commitsModel = new LoadableDetachableModel<List<Commit>>() {
-
- @Override
- protected List<Commit> load() {
- Git git = getRepository().git();
-
- // load additional one commit to see whether there is still more page
- LogCommand command = new LogCommand(git.repoDir())
- .toRev(getRepository().defaultBranchIfNull(getCurrentRevision()))
- .skip((page - 1) * COMMITS_PER_PAGE)
- .maxCount(COMMITS_PER_PAGE + 1);
- if (getCurrentPath() != null)
- command.path(getCurrentPath());
-
- List<Commit> commits = command.call();
- return commits;
- }
- };
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new RevisionSelector("revselector", repoModel, currentRevision, currentPath));
-// BookmarkablePageLink<Void> homeLink = new BookmarkablePageLink<Void>("home",
-// SourceTreePage.class,
-// PageSpec.forRepository(getRepository()).add(PageSpec.OBJECT_ID, getRevision()));
-// add(homeLink);
-// homeLink.add(new Label("name", new AbstractReadOnlyModel<String>() {
-//
-// @Override
-// public String getObject() {
-// return getRepository().getName();
-// }
-// }));
-
- add(newNavLink("home", -1));
- add(new ListView<String>("pathSegments", GitPath.split(currentPath)) {
-
- @Override
- protected void populateItem(ListItem<String> item) {
- item.add(newNavLink("link", item.getIndex()));
- }
- });
-
- add(new RepoCommitsPanel("commits", commitsModel, repoModel));
- add(new BookmarkablePageLink<Void>("newer", RepoCommitsPage.class,
- paramsOf(getRepository(), getCurrentRevision(), getCurrentPath(), page - 1)).setEnabled(page > 1));
- add(new BookmarkablePageLink<Void>("older", RepoCommitsPage.class,
- paramsOf(getRepository(), getCurrentRevision(), getCurrentPath(), page + 1)) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setEnabled(commitsModel.getObject().size() > COMMITS_PER_PAGE);
- }
-
- });
- }
-
- private Component newNavLink(String id, final int pathNum) {
- List<String> all = GitPath.split(currentPath);
-
- BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(id,
- RepoCommitsPage.class,
- paramsOf(getRepository(), getCurrentRevision(), getCurrentPath(), 0));
- link.setEnabled(pathNum < 0 || pathNum < all.size() - 1);
- link.add(new Label("name", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- if (pathNum < 0) {
- return getRepository().getName();
- } else {
- List<String> all = GitPath.split(currentPath);
- return all.get(pathNum);
- }
- }
-
- }));
-
- return link;
- }
-
- @Override
- protected String getPageTitle() {
- return "Commits - " + getRepository();
- }
-
- @Override
- public void onDetach() {
- if (commitsModel != null) {
- commitsModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPanel.html
deleted file mode 100644
index 713898756a..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPanel.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <section wicket:id="groups">
- <div class="panel panel-default panel-commit">
- <div class="panel-heading">
- <h3><span wicket:id="date"></span></h3>
- </div>
- <div class="panel-body">
- <table class="table table-commits table-compact">
- <tr wicket:id="rows">
- <td class="td-avatar">
- <wicket:container wicket:id="avatar"></wicket:container>
- </td>
- <td class="td-message">
- <wicket:container wicket:id="message"></wicket:container>
- <wicket:container wicket:id="meta"></wicket:container>
- </td>
- <td class="td-commitish">
- <a class="sha btn btn-default btn-xs btn-sha" wicket:id="shalink">
- <wicket:enclosure>
- <span class="comments-stat"><i class="fa fa-comment"></i><b wicket:id="commentsCount"></b></span></wicket:enclosure><span wicket:id="sha"></span> &rarr;
- </a> <br/>
- <a class="sha" wicket:id="treelink">Browse code &raquo;</a>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </section>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPanel.java
deleted file mode 100644
index 35a32632c7..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/commits/RepoCommitsPanel.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.commits;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.time.DateUtils;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import com.pmease.commons.git.Commit;
-import com.pmease.commons.git.GitUtils;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.OldCommitCommentManager;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.common.datatype.DataTypes;
-import com.pmease.gitplex.web.component.commit.OldCommitMessagePanel;
-import com.pmease.gitplex.web.component.commit.CommitMetaPanel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.component.user.PersonLink;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
-import com.pmease.gitplex.web.page.repository.code.tree.RepoTreePage;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
-import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig.Placement;
-
-@SuppressWarnings("serial")
-public class RepoCommitsPanel extends Panel {
-
- private final IModel<Repository> repositoryModel;
- private final IModel<Multimap<Date, Commit>> groupsModel;
- private final IModel<Map<String, Integer>> commentStatsModel;
-
- public RepoCommitsPanel(String id,
- IModel<List<Commit>> commitsModel,
- IModel<Repository> repositoryModel) {
- super(id, commitsModel);
-
- this.repositoryModel = repositoryModel;
-
- groupsModel = new LoadableDetachableModel<Multimap<Date, Commit>>() {
-
- @Override
- protected Multimap<Date, Commit> load() {
- List<Commit> commits = getCommits();
-
- LinkedListMultimap<Date, Commit> groups = LinkedListMultimap.<Date, Commit>create();
- for (Commit commit : commits) {
- Date date = commit.getAuthor().getWhen();
- date = DateUtils.round(date, Calendar.DAY_OF_MONTH);
- groups.put(date, commit);
- }
-
- return groups;
- }
- };
-
- commentStatsModel = new LoadableDetachableModel<Map<String, Integer>>() {
-
- @Override
- protected Map<String, Integer> load() {
- // XXX: this may slow, performance tuning later
- return GitPlex.getInstance(OldCommitCommentManager.class).getCommitCommentStats(getRepository());
- }
-
- };
- }
-
- private Multimap<Date, Commit> getGroups() {
- return groupsModel.getObject();
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new ListView<Date>("groups", new AbstractReadOnlyModel<List<Date>>() {
-
- @Override
- public List<Date> getObject() {
- List<Date> dates = Lists.newArrayList(getGroups().keySet());
- Collections.sort(dates);
- Collections.reverse(dates);
- return dates;
- }
- }) {
-
- @Override
- protected void populateItem(ListItem<Date> item) {
- final Date date = item.getModelObject();
- item.add(new Label("date", DataTypes.DATE.asString(date, "MMM dd, yyyy")));
- item.add(new ListView<Commit>("rows", new AbstractReadOnlyModel<List<Commit>>() {
-
- @Override
- public List<Commit> getObject() {
- Multimap<Date, Commit> groups = getGroups();
- return Lists.newArrayList(groups.get(date));
- }
- }) {
-
- @Override
- protected void populateItem(ListItem<Commit> item) {
- Commit commit = item.getModelObject();
-
- item.add(new PersonLink("avatar", Model.of(commit.getAuthor()), AvatarMode.AVATAR)
- .withTooltipConfig(new TooltipConfig().withPlacement(Placement.right)));
-
- item.add(new OldCommitMessagePanel("message", repositoryModel, item.getModel()));
- item.add(new CommitMetaPanel("meta", item.getModel()));
-
- AbstractLink shalink =new BookmarkablePageLink<Void>(
- "shalink", RepoCommitPage.class,
- RepoCommitPage.paramsOf(getRepository(), commit.getHash(), null));
- shalink.add(new Label("sha", GitUtils.abbreviateSHA(commit.getHash())));
- int commentsCount = getCommentCount(commit.getHash());
- shalink.add(new Label("commentsCount", commentsCount).setVisibilityAllowed(commentsCount > 0));
-
- item.add(shalink);
- item.add(new BookmarkablePageLink<Void>("treelink",
- RepoTreePage.class,
- RepoTreePage.paramsOf(getRepository(), commit.getHash(), null)));
- }
-
- });
- }
-
- });
- }
-
- private int getCommentCount(String sha) {
- Map<String, Integer> map = commentStatsModel.getObject();
- if (map.containsKey(sha)) {
- return map.get(sha);
- } else {
- return 0;
- }
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript("gitplex.commitMessage.toggle('.title-message .detailed-toggle');"));
-
- }
-
- private Repository getRepository() {
- return repositoryModel.getObject();
- }
-
- @SuppressWarnings("unchecked")
- private List<Commit> getCommits() {
- return (List<Commit>) getDefaultModelObject();
- }
-
- @Override
- public void onDetach() {
- if (repositoryModel != null) {
- repositoryModel.detach();
- }
-
- if (groupsModel != null) {
- groupsModel.detach();
- }
-
- if (commentStatsModel != null) {
- commentStatsModel.detach();
- }
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/PathsBreadcrumb.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/PathsBreadcrumb.html
deleted file mode 100644
index 345db9a87e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/PathsBreadcrumb.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <li>
- <a wicket:id="home"><b wicket:id="name"></b></a>
- </li>
- <li wicket:id="paths"><a wicket:id="link"><span wicket:id="name"></span></a></li>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/PathsBreadcrumb.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/PathsBreadcrumb.java
deleted file mode 100644
index 5ea37df544..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/PathsBreadcrumb.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.component;
-
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.commons.git.GitPath;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.code.tree.RepoTreePage;
-
-@SuppressWarnings("serial")
-public class PathsBreadcrumb extends Panel {
-
- private final IModel<Repository> repoModel;
-
- private final String currentRevision;
-
- private final String currentPath;
-
- public PathsBreadcrumb(String id, IModel<Repository> repoModel, String currentRevision, String currentPath) {
- super(id);
-
- this.repoModel = repoModel;
- this.currentRevision = currentRevision;
- this.currentPath = currentPath;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- BookmarkablePageLink<Void> homeLink = new BookmarkablePageLink<Void>("home",
- RepoTreePage.class,
- RepositoryPage.paramsOf(repoModel.getObject(), currentRevision));
- add(homeLink);
- homeLink.add(new Label("name", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return repoModel.getObject().getName();
- }
- }));
-
- ListView<String> pathsView = new ListView<String>("paths", GitPath.split(currentPath)) {
-
- @Override
- protected void populateItem(ListItem<String> item) {
- String path = item.getModelObject();
-
- BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>(
- "link",
- RepoTreePage.class,
- RepoTreePage.paramsOf(repoModel.getObject(),
- currentRevision,
- GitPath.join(GitPath.split(currentPath).subList(0, item.getIndex() + 1))));
-
- item.add(link);
- link.add(new Label("name", path));
- if (item.getIndex() == getList().size() - 1) {
- item.add(AttributeAppender.append("class", "active"));
- link.setEnabled(false);
- }
-
- }
- };
-
- add(pathsView);
- }
-
- @Override
- protected void onDetach() {
- repoModel.detach();
-
- super.onDetach();
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/RevisionSelector.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/RevisionSelector.html
deleted file mode 100644
index a5d260ebad..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/RevisionSelector.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <a class="btn btn-default" wicket:id="revselector" href="javascript:void(0)"><i class="icon" wicket:id="reftype"></i> <span wicket:id="rev"></span> <span class="caret"></span></a>
- <div wicket:id="dropdown"></div>
-
- <wicket:fragment wicket:id="dropdownfrag">
- <div class="popup-content">
- <div class=""></div>
- <form>
- <input type="search" class="form-control focusable input-md commitish-filter-field" placeholder="Filter branches ..." />
- </form>
- <p></p>
- <div wicket:id="tabs"></div>
- </div>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="revfrag">
- <div class="commitish-list">
- <ul class="menu-ul">
- <li><b wicket:id="norev"></b></li>
- <li wicket:id="revs">
- <a wicket:id="link" class="menu-item checkable"><i class="fa fa-check"></i> <span wicket:id="name"></span></a>
- </li>
- </ul>
- </div>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="norev">
- <p wicket:id="label"></p>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/RevisionSelector.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/RevisionSelector.java
deleted file mode 100644
index 755063a370..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/RevisionSelector.java
+++ /dev/null
@@ -1,266 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.component;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
-import org.apache.wicket.extensions.markup.html.tabs.ITab;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.pmease.commons.git.Git;
-import com.pmease.commons.git.GitUtils;
-import com.pmease.commons.wicket.behavior.dropdown.DropdownBehavior;
-import com.pmease.commons.wicket.behavior.dropdown.DropdownPanel;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.common.wicket.bootstrap.Icon;
-import com.pmease.gitplex.web.common.wicket.component.tab.BootstrapTabbedPanel;
-import com.pmease.gitplex.web.page.repository.RepositoryHomePage;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.code.tree.RepoTreePage;
-
-@SuppressWarnings("serial")
-public class RevisionSelector extends Panel {
-
- private final IModel<Repository> repoModel;
-
- private final String revision;
-
- private final String path;
-
- private final IModel<Map<RefType, List<String>>> refsModel;
-
- public RevisionSelector(String id, IModel<Repository> repoModel, @Nullable String revision, @Nullable String path) {
- super(id);
-
- this.repoModel = repoModel;
- this.revision = revision;
- this.path = path;
- this.refsModel = new LoadableDetachableModel<Map<RefType, List<String>>>() {
-
- @Override
- protected Map<RefType, List<String>> load() {
- Git git = RevisionSelector.this.repoModel.getObject().git();
- Map<RefType, List<String>> map = Maps.newHashMapWithExpectedSize(RefType.values().length);
- map.put(RefType.BRANCH, Lists.newArrayList(git.listBranches()));
- List<String> tags = Lists.newArrayList(git.listTags());
- Collections.reverse(tags);
- map.put(RefType.TAG, tags);
- return map;
- }
- };
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- WebMarkupContainer revSelector = new WebMarkupContainer("revselector");
- revSelector.setOutputMarkupId(true);
- add(revSelector);
- revSelector.add(new Label("rev", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- String revision = repoModel.getObject().defaultBranchIfNull(RevisionSelector.this.revision);
- RefType type = getRevisionType(revision);
- if (type == null) {
- return GitUtils.abbreviateSHA(revision);
- } else {
- return revision;
- }
- }
-
- }));
- revSelector.add(new Icon("reftype", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- RefType type = getRevisionType(repoModel.getObject().defaultBranchIfNull(revision));
- if (type == null) {
- return "fa-commit";
- } else if (type == RefType.BRANCH) {
- return "fa-branch";
- } else {
- return "fa-tag";
- }
- }
-
- }));
-
- DropdownPanel dropdown = new DropdownPanel("dropdown", true) {
-
- @Override
- protected Component newContent(String id) {
- Fragment frag = new Fragment(id, "dropdownfrag", RevisionSelector.this) {
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript("$('.commitish-list').liveFilter('.commitish-filter-field', 'li', {filterChildSelector: 'a.menu-item'})"));
- }
- };
-
- List<ITab> tabs = Lists.newArrayList();
- tabs.add(new AbstractTab(Model.of("Branches")) {
-
- @Override
- public WebMarkupContainer getPanel(String panelId) {
- return createRefList(panelId, RefType.BRANCH);
- }
-
- });
-
- tabs.add(new AbstractTab(Model.of("Tags")) {
-
- @Override
- public WebMarkupContainer getPanel(String panelId) {
- return createRefList(panelId, RefType.TAG);
- }
-
- });
-
- frag.add(new BootstrapTabbedPanel<ITab>("tabs", tabs, new AbstractReadOnlyModel<Integer>() {
-
- @Override
- public Integer getObject() {
- Map<RefType, List<String>> map = refsModel.getObject();
- for (RefType each : RefType.values()) {
- List<String> refs = map.get(each);
- for (String ref : refs) {
- if (ref.equalsIgnoreCase(repoModel.getObject().defaultBranchIfNull(revision))) {
- return each.ordinal();
- }
- }
- }
-
- return 0;
- }
-
- }));
-
- return frag;
- }
-
- };
-
- add(dropdown);
-
- revSelector.add(new DropdownBehavior(dropdown));
- }
-
- private RefType getRevisionType(String revision) {
- Map<RefType, List<String>> map = refsModel.getObject();
- for (RefType each : RefType.values()) {
- List<String> list = map.get(each);
- for (String ref : list) {
- if (ref.equalsIgnoreCase(revision)) {
- return each;
- }
- }
- }
- return null;
- }
-
- static enum RefType {
- BRANCH, TAG
- }
-
- private Fragment createRefList(String id, final RefType type) {
- Fragment frag = new Fragment(id, "revfrag", RevisionSelector.this);
- IModel<List<String>> refs = new LoadableDetachableModel<List<String>>() {
-
- @Override
- protected List<String> load() {
- return refsModel.getObject().get(type);
- }
- };
-
- ListView<String> view = new ListView<String>("revs", refs) {
- @Override
- protected void populateItem(ListItem<String> item) {
- final String ref = item.getModelObject();
-
- AbstractLink link = newRefLink("link", ref);
- link.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return Objects.equal(repoModel.getObject().defaultBranchIfNull(revision), ref) ? "checked" : "unchecked";
- }
- }));
-
- link.add(new Label("name", ref).setEscapeModelStrings(true));
- item.add(link);
- }
- };
-
- frag.add(view);
-
- frag.add(new Label("norev", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- if (type == RefType.BRANCH) {
- return "No branches found";
- } else {
- return "No tags found";
- }
- }
-
- }) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- setVisibilityAllowed(refsModel.getObject().get(type).isEmpty());
- }
- });
- return frag;
- }
-
- protected AbstractLink newRefLink(String id, String ref) {
- PageParameters params = RepositoryPage.paramsOf(repoModel.getObject(), ref, path);
-
- return new BookmarkablePageLink<Void>("link", getPageClass(), params);
- }
-
- private Class<? extends Page> getPageClass() {
- Page page = getPage();
- if (page instanceof RepositoryHomePage) {
- return RepoTreePage.class;
- } else {
- return page.getClass();
- }
- }
-
- @Override
- public void onDetach() {
- repoModel.detach();
- refsModel.detach();
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/SourceBreadcrumbPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/SourceBreadcrumbPanel.html
deleted file mode 100644
index b3d461271a..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/SourceBreadcrumbPanel.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="file-navigator">
- <a class="btn btn-success has-tip" data-toggle="tooltip" title="compare and review"><i class="fa fa-ext fa-branch-compare"></i></a>
- <wicket:container wicket:id="revselector"></wicket:container>
- <ol class="breadcrumb inline breadcrumb-paths">
- <wicket:container wicket:id="paths"></wicket:container>
- <li>
- <a class="has-tip" data-toggle="tooltip" title="Fork this repository and add a new file"><i class="fa fa-ext fa-file-added"></i></a>
- </li>
- </ol>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/SourceBreadcrumbPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/SourceBreadcrumbPanel.java
deleted file mode 100644
index c55d38f105..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/component/SourceBreadcrumbPanel.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.component;
-
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-
-import com.pmease.gitplex.core.model.Repository;
-
-@SuppressWarnings("serial")
-public class SourceBreadcrumbPanel extends Panel {
-
- private final IModel<Repository> repoModel;
-
- private final String revision;
-
- private final String path;
-
- public SourceBreadcrumbPanel(String id, IModel<Repository> repoModel, String revision, String path) {
- super(id);
-
- this.repoModel = repoModel;
- this.revision = revision;
- this.path = path;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new RevisionSelector("revselector", repoModel, revision, path));
- add(new PathsBreadcrumb("paths", repoModel, revision, path));
- }
-
- @Override
- protected void onDetach() {
- repoModel.detach();
-
- super.onDetach();
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/contributors/ContributorsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/contributors/ContributorsPage.java
deleted file mode 100644
index e3ae8fbab8..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/contributors/ContributorsPage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.contributors;
-
-import org.apache.wicket.RestartResponseException;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-import com.pmease.gitplex.web.page.repository.NoCommitsPage;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-
-@SuppressWarnings("serial")
-public class ContributorsPage extends RepositoryPage {
-
- public ContributorsPage(PageParameters params) {
- super(params);
-
- if (!getRepository().git().hasCommits())
- throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
- }
-
- @Override
- protected String getPageTitle() {
- return getRepository() + " - contributors";
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tags/GitArchiveResource.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tags/GitArchiveResource.java
deleted file mode 100644
index fcd79db97f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tags/GitArchiveResource.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.tags;
-
-import javax.persistence.EntityNotFoundException;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.tika.mime.MediaType;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.request.resource.AbstractResource;
-import org.apache.wicket.request.resource.ContentDisposition;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.exception.AccessDeniedException;
-import com.pmease.gitplex.web.git.command.ArchiveCommand;
-import com.pmease.gitplex.web.git.command.ArchiveCommand.Format;
-import com.pmease.gitplex.web.page.account.AccountPage;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-
-@SuppressWarnings("serial")
-public class GitArchiveResource extends AbstractResource {
-
- @Override
- protected ResourceResponse newResourceResponse(Attributes attributes) {
- PageParameters params = attributes.getParameters();
-
- final String username = params.get(AccountPage.PARAM_USER).toString();
- final String repoName = params.get(RepositoryPage.PARAM_REPO).toString();
- final String fileName = params.get("file").toString();
-
- Preconditions.checkArgument(username != null);
- Preconditions.checkArgument(!Strings.isNullOrEmpty(repoName));
- Preconditions.checkArgument(!Strings.isNullOrEmpty(fileName) &&
- (fileName.endsWith(".zip") || fileName.endsWith(".tar.gz")));
-
- Repository repository = GitPlex.getInstance(RepositoryManager.class).findBy(username, repoName);
- if (repository == null) {
- throw new EntityNotFoundException("Repository " + username + "/" + repoName + " doesn't exist");
- }
-
- if (!SecurityUtils.getSubject().isPermitted(Permission.ofRepositoryRead(repository))) {
- throw new AccessDeniedException("User " + SecurityUtils.getSubject()
- + " have no permission to access repository "
- + repository.getFQN());
- }
-
- ResourceResponse response = new ResourceResponse();
- response.setFileName(fileName);
-
- MediaType mt = MediaTypes.detectFrom(new byte[0], fileName);
- response.setContentType(mt.toString());
- response.setContentDisposition(ContentDisposition.ATTACHMENT);
- final Long repositoryId = repository.getId();
- response.setWriteCallback(new WriteCallback() {
- @Override
- public void writeData(final Attributes attributes) {
- Repository repository = GitPlex.getInstance(Dao.class).load(Repository.class, repositoryId);
- ArchiveCommand ac = new ArchiveCommand(repository.git().repoDir(),
- attributes.getResponse().getOutputStream());
-
- if (fileName.endsWith(".zip")) {
- String treeish = fileName.substring(0, fileName.length() - ".zip".length());
- ac.treeish(treeish).format(Format.ZIP);
- } else {
- // end with .tar.gz
- String treeish = fileName.substring(0, fileName.length() - ".tar.gz".length());
- ac.treeish(treeish).format(Format.TAR_GZ);
- }
-
- ac.call();
- }
- });
-
- return response;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tags/GitArchiveResourceReference.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tags/GitArchiveResourceReference.java
deleted file mode 100644
index 417a6a3d8d..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tags/GitArchiveResourceReference.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.tags;
-
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.request.resource.IResource;
-import org.apache.wicket.request.resource.ResourceReference;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.git.command.ArchiveCommand.Format;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-
-public class GitArchiveResourceReference extends ResourceReference {
-
- private static final long serialVersionUID = 1L;
-
- public static final String RESOURCE_NAME = "git-archive";
-
- public GitArchiveResourceReference() {
- super(RESOURCE_NAME);
- }
-
- @Override
- public IResource getResource() {
- return new GitArchiveResource();
- }
-
- public static PageParameters newParams(Repository repository, String treeish, Format format) {
- PageParameters params = RepositoryPage.paramsOf(repository);
- params.set("file", treeish + "" + format.getSuffix());
- return params;
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/ReadmePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/ReadmePanel.html
deleted file mode 100644
index a9b295fa71..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/ReadmePanel.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="readme">
- <div class="head">
- <i class="fa fa-file-text"></i>
- <span wicket:id="name"></span>
- </div>
- <div class="body" wicket:id="readme"></div>
- </div>
-
- <wicket:fragment wicket:id="rawfrag">
- <div class="plain"><pre wicket:id="text"></pre></div>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/ReadmePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/ReadmePanel.java
deleted file mode 100644
index c5f82ffe45..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/ReadmePanel.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.tree;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-
-import com.google.common.collect.ImmutableSet;
-import com.pmease.commons.git.TreeNode;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.component.wiki.WikiTextPanel;
-import com.pmease.gitplex.web.page.repository.code.blob.language.Language;
-import com.pmease.gitplex.web.service.FileBlob;
-
-@SuppressWarnings("serial")
-public class ReadmePanel extends Panel {
-
- private final IModel<Repository> repoModel;
-
- private final IModel<List<TreeNode>> nodesModel;
-
- private final IModel<FileBlob> blobModel;
-
- public ReadmePanel(String id, IModel<Repository> repoModel, final String revision, IModel<List<TreeNode>> nodesModel) {
-
- super(id);
-
- this.repoModel = repoModel;
- this.nodesModel = nodesModel;
-
- this.blobModel = new LoadableDetachableModel<FileBlob>() {
-
- @Override
- protected FileBlob load() {
- TreeNode node = getReadmeNode();
- if (node == null) {
- return null;
- }
-
- return FileBlob.of(ReadmePanel.this.repoModel.getObject(), revision, node.getPath());
- }
- };
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- FileBlob blob = blobModel.getObject();
- this.setVisibilityAllowed(
- blob != null
- && blob.isText()
- && !blob.isEmpty()
- && !blob.isLarge());
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- FileBlob blob = blobModel.getObject();
- if (blob == null) {
- return;
- }
-
- add(new Label("name", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return blobModel.getObject().getName();
- }
- }));
-
- Language lang = blob.getLanguage();
- if (lang != null && lang.getName().equals("Markdown")) {
- add(new WikiTextPanel("readme", new LoadableDetachableModel<String>() {
-
- @Override
- protected String load() {
- FileBlob blob = blobModel.getObject();
- if (blob == null) {
- return "";
- }
-
- return blob.getStringContent();
- }
- }));
- } else {
- Fragment frag = new Fragment("readme", "rawfrag", this);
- frag.add(new Label("text", new LoadableDetachableModel<String>() {
-
- @Override
- protected String load() {
- return blobModel.getObject().getStringContent();
- }
-
- }));
-
- add(frag);
- }
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
- }
-
- static Set<String> README_FILES = ImmutableSet.of(
- "README",
- "README.md",
- "README.markdown",
- "README.txt"
- );
-
- private TreeNode getReadmeNode() {
- List<TreeNode> nodes = nodesModel.getObject();
- for (TreeNode each : nodes) {
- if (README_FILES.contains(each.getName())) {
- return each;
- }
- }
-
- return null;
- }
-
- @Override
- public void onDetach() {
- repoModel.detach();
- nodesModel.detach();
- blobModel.detach();
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoDescribePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoDescribePanel.html
deleted file mode 100644
index 7fc2af7449..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoDescribePanel.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="well" wicket:id="description">
- </div>
-
- <wicket:fragment wicket:id="label">
- <span wicket:id="description"></span>
- <a wicket:id="editlink" href="javascript:void()" class="text-muted text-nowrap">- Edit <i class="fa fa-pencil"></i></a>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="editor">
- <form wicket:id="form" class="form-inline description-editor" role="form">
- <div class="form-group">
- <input placeholder="Description" class="form-control focusable" wicket:id="input" />
- </div>
- <button class="btn btn-gray" wicket:id="save">Save</button> or <a wicket:id="cancel">cancel</a>
- </form>
- </wicket:fragment>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoDescribePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoDescribePanel.java
deleted file mode 100644
index b482d5f503..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoDescribePanel.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.tree;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
-
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.model.Repository;
-
-public class RepoDescribePanel extends Panel {
- private static final long serialVersionUID = 1L;
-
- static enum Mode {
- LABEL, EDITOR
- }
-
- private Mode mode = Mode.LABEL;
-
- public RepoDescribePanel(String id, IModel<Repository> model) {
- super(id, model);
-
- setOutputMarkupId(true);
- }
-
- @SuppressWarnings("serial")
- private Component newContent(String id) {
- if (mode == Mode.LABEL) {
- Fragment frag = new Fragment(id, "label", RepoDescribePanel.this);
- frag.add(new Label("description", new PropertyModel<String>(getDefaultModel(), "description")));
- frag.add(new AjaxLink<Void>("editlink") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- mode = Mode.EDITOR;
- onModeChanged(target);
- }
- });
-
- return frag;
- } else {
- Fragment frag = new Fragment(id, "editor", RepoDescribePanel.this);
- Form<?> form = new Form<Void>("form");
- form.add(new TextField<String>("input", new PropertyModel<String>(getRepository(), "description")));
- form.add(new AjaxButton("save", form) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- GitPlex.getInstance(RepositoryManager.class).save(getRepository());
- mode = Mode.LABEL;
- onModeChanged(target);
- }
- });
-
- form.add(new AjaxLink<Void>("cancel") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- mode = Mode.LABEL;
- onModeChanged(target);
- }
-
- });
-
- frag.add(form);
- return frag;
- }
- }
-
- private Repository getRepository() {
- return (Repository) getDefaultModelObject();
- }
-
- private void onModeChanged(AjaxRequestTarget target) {
- Component c = newContent("description");
- addOrReplace(c);
- target.add(this);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
- add(newContent("description"));
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePage.java
index b128d01ca1..fbf2a91dbf 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePage.java
@@ -1,6 +1,7 @@
package com.pmease.gitplex.web.page.repository.code.tree;
import java.io.IOException;
+import java.io.Serializable;
import javax.annotation.Nullable;
@@ -18,6 +19,8 @@ import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.TreeWalk;
+import com.pmease.commons.git.GitPath;
+import com.pmease.commons.wicket.behavior.HistoryBehavior;
import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.web.component.pathnavigator.PathNavigator;
import com.pmease.gitplex.web.component.revisionselector.RevisionSelector;
@@ -28,27 +31,39 @@ import com.pmease.gitplex.web.page.repository.RepositoryPage;
@SuppressWarnings("serial")
public class RepoTreePage extends RepositoryPage {
+ private static final String PARAM_REVISION = "revision";
+
+ private static final String PARAM_PATH = "path";
+
+ protected IModel<Repository> repoModel;
+
private String revision = "master";
- @Nullable
private String path;
+ private RevisionSelector revisionSelector;
+
private PathNavigator pathNavigator;
private TreeList treeList;
+ private HistoryBehavior historyBehavior;
+
public RepoTreePage(PageParameters params) {
super(params);
if (!getRepository().git().hasCommits())
throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
+
+ revision = GitPath.normalize(params.get(PARAM_REVISION).toString());
+ path = GitPath.normalize(params.get(PARAM_PATH).toString());
}
@Override
protected void onInitialize() {
super.onInitialize();
- add(new RevisionSelector("revSelector", new IModel<String>() {
+ add(revisionSelector = new RevisionSelector("revSelector", new IModel<String>() {
@Override
public void detach() {
@@ -94,6 +109,8 @@ public class RepoTreePage extends RepositoryPage {
if (target != null) {
target.add(pathNavigator);
target.add(treeList);
+
+ pushState(target);
}
}
@@ -129,8 +146,10 @@ public class RepoTreePage extends RepositoryPage {
super.onModelChanged();
AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
- if (target != null)
+ if (target != null) {
target.add(treeList);
+ pushState(target);
+ }
}
});
@@ -165,12 +184,37 @@ public class RepoTreePage extends RepositoryPage {
super.onModelChanged();
AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
- if (target != null)
+ if (target != null) {
target.add(pathNavigator);
+ pushState(target);
+ }
}
});
+ add(historyBehavior = new HistoryBehavior() {
+
+ @Override
+ protected void onPopState(AjaxRequestTarget target, Serializable state) {
+ HistoryState historyState = (HistoryState) state;
+ revision = historyState.revision;
+ path = historyState.path;
+
+ target.add(revisionSelector);
+ target.add(pathNavigator);
+ target.add(treeList);
+ }
+
+ });
+ }
+
+ private void pushState(AjaxRequestTarget target) {
+ HistoryState state = new HistoryState();
+ state.revision = revision;
+ state.path = path;
+ PageParameters params = paramsOf(getRepository(), revision, path);
+ String url = RequestCycle.get().urlFor(RepoTreePage.class, params).toString();
+ historyBehavior.pushState(target, url, state);
}
@Override
@@ -180,4 +224,18 @@ public class RepoTreePage extends RepositoryPage {
response.render(CssHeaderItem.forReference(new CssResourceReference(RepoTreePage.class, "repo-tree-page.css")));
}
+ public static PageParameters paramsOf(Repository repository, @Nullable String revision, @Nullable String path) {
+ PageParameters params = paramsOf(repository);
+ if (revision != null)
+ params.set(PARAM_REVISION, revision);
+ if (path != null)
+ params.set(PARAM_PATH, path);
+ return params;
+ }
+
+ private static class HistoryState implements Serializable {
+ String revision;
+
+ String path;
+ }
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePanel.html
deleted file mode 100644
index 5965378306..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePanel.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<html xmlns:wicket>
-<wicket:panel>
- <div class="panel panel-default panel-sourcetree">
- <div class="panel-heading panel-message">
- <wicket:container wicket:id="message"></wicket:container>
- <a class="history-link" wicket:id="history"><i class="fa fa-history"></i> History</a>
- </div>
- <div class="panel-body">
- <div class="last-commit clearfix">
- <div class="pull-left" wicket:id="meta"></div>
- <div class="commitish right">
- <a wicket:id="commitlink">latest commit <span wicket:id="sha" class="sha"></span></a>
- </div>
- </div>
-
- <table class="table table-files">
- <wicket:enclosure>
- <tr>
- <td class="file-icon"><i class="fa fa-arrow-up"></i></td>
- <td class="file-name"><a wicket:id="parent" title="go to up level">..</a></td>
- <td class="message"></td>
- <td class="age"></td>
- </tr>
- </wicket:enclosure>
- <tr wicket:id="files">
- <td class="file-icon"><i wicket:id="icon" class="fa "></i></td>
- <td class="file-name"><a wicket:id="file"><span wicket:id="name"></span></a></td>
- <td class="message"></td>
- <td class="age"></td>
- </tr>
- </table>
- </div>
- </div>
-</wicket:panel>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePanel.java
deleted file mode 100644
index 3515f4bdb1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/code/tree/RepoTreePanel.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.pmease.gitplex.web.page.repository.code.tree;
-
-import java.util.List;
-
-import javax.annotation.Nullable;
-import javax.persistence.EntityNotFoundException;
-
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.eclipse.jgit.lib.FileMode;
-
-import com.google.common.collect.Iterables;
-import com.pmease.commons.git.Commit;
-import com.pmease.commons.git.Git;
-import com.pmease.commons.git.GitPath;
-import com.pmease.commons.git.GitUtils;
-import com.pmease.commons.git.TreeNode;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.component.commit.OldCommitMessagePanel;
-import com.pmease.gitplex.web.component.commit.CommitMetaPanel;
-import com.pmease.gitplex.web.component.user.AvatarMode;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.page.repository.code.blob.RepoBlobPage;
-import com.pmease.gitplex.web.page.repository.code.commit.RepoCommitPage;
-import com.pmease.gitplex.web.page.repository.code.commits.RepoCommitsPage;
-
-@SuppressWarnings("serial")
-public class RepoTreePanel extends Panel {
-
- private final IModel<Repository> repoModel;
-
- private final String currentRevision;
-
- private final String currentPath;
-
- private final IModel<Commit> lastCommitModel;
-
- private final IModel<List<TreeNode>> nodesModel;
-
- public RepoTreePanel(String id, final IModel<Repository> repoModel, final @Nullable String currentRevision,
- final @Nullable String currentPath, IModel<List<TreeNode>> nodesModel) {
- super(id);
-
- this.repoModel = repoModel;
- this.currentRevision = currentRevision;
- this.currentPath = currentPath;
-
- lastCommitModel = new LoadableDetachableModel<Commit>() {
-
- @Override
- protected Commit load() {
- Git git = repoModel.getObject().git();
- String revision = repoModel.getObject().defaultBranchIfNull(RepoTreePanel.this.currentRevision);
- List<Commit> commits = git.log(null, revision, currentPath, 1, 0);
- Commit c = Iterables.getFirst(commits, null);
- if (c == null) {
- throw new EntityNotFoundException("Unable to get commit for revision " + revision);
- } else {
- return c;
- }
- }
- };
-
- this.nodesModel = nodesModel;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new OldCommitMessagePanel("message", repoModel, lastCommitModel));
- add(new CommitMetaPanel("meta", lastCommitModel).setAuthorMode(AvatarMode.NAME_AND_AVATAR));
-
- BookmarkablePageLink<Void> historyLink = new BookmarkablePageLink<Void>(
- "history",
- RepoCommitsPage.class,
- RepoCommitsPage.paramsOf(repoModel.getObject(), currentRevision, currentPath, 0));
-
- add(historyLink);
- BookmarkablePageLink<Void> commitLink = new BookmarkablePageLink<Void>(
- "commitlink",
- RepoCommitPage.class,
- RepoCommitPage.paramsOf(repoModel.getObject(), getLastCommit().getHash(), null));
- add(commitLink);
- commitLink.add(new Label("sha", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- return GitUtils.abbreviateSHA(getLastCommit().getHash());
- }
- }));
-
- List<String> pathElements = GitPath.split(currentPath);
- if (pathElements.isEmpty()) {
- add(new WebMarkupContainer("parent").setVisibilityAllowed(false));
- } else {
- BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("parent",
- RepoTreePage.class,
- RepoTreePage.paramsOf(repoModel.getObject(), currentRevision, GitPath.join(pathElements.subList(0, pathElements.size() - 1))));
-
- add(link);
- }
-
- ListView<TreeNode> fileTree = new ListView<TreeNode>("files", nodesModel) {
-
- @Override
- protected void populateItem(ListItem<TreeNode> item) {
- TreeNode node = item.getModelObject();
- final int bits = node.getMode();
- final String path = node.getPath();
- item.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- if (bits == FileMode.TYPE_TREE)
- return "fa-ext fa-folder-o";
- else if (bits == FileMode.TYPE_GITLINK)
- return "fa-ext fa-folder-submodule-o";
- else if (bits == FileMode.TYPE_SYMLINK) {
- Git git = repoModel.getObject().git();
- if (git.isTreeLink(path, repoModel.getObject().defaultBranchIfNull(currentRevision)))
- return "fa-ext fa-folder-symbol-link-o";
- else
- return "fa-ext fa-file-symbol-link";
- } else
- return "fa-file-text-o";
- }})));
-
- List<String> pathElements = GitPath.split(currentPath);
- pathElements.add(node.getName());
-
- PageParameters params = RepositoryPage.paramsOf(repoModel.getObject(),
- currentRevision, GitPath.join(pathElements));
-
- AbstractLink link;
- if (node.getMode() == FileMode.TYPE_TREE) {
- link = new BookmarkablePageLink<Void>("file", RepoTreePage.class, params);
- } else {
- link = new BookmarkablePageLink<Void>("file", RepoBlobPage.class, params);
- }
-
- link.add(new Label("name", node.getName()));
- item.add(link);
- }
- };
-
- add(fileTree);
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
- response.render(OnDomReadyHeaderItem.forScript("gitplex.commitMessage.toggle('.title-message .detailed-toggle');"));
- }
-
- private Commit getLastCommit() {
- return lastCommitModel.getObject();
- }
-
- @Override
- public void onDetach() {
- repoModel.detach();
- lastCommitModel.detach();
- nodesModel.detach();
-
- super.onDetach();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.html
new file mode 100644
index 0000000000..0e5c1b9fae
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.html
@@ -0,0 +1,4 @@
+<wicket:extend>
+ <div class="padder repo-commit">
+ </div>
+</wicket:extend>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.java
new file mode 100644
index 0000000000..a0cff82c2a
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.java
@@ -0,0 +1,41 @@
+package com.pmease.gitplex.web.page.repository.commit;
+
+import org.apache.wicket.RestartResponseException;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+import com.pmease.commons.git.GitPath;
+import com.pmease.gitplex.core.model.Repository;
+import com.pmease.gitplex.web.page.repository.NoCommitsPage;
+import com.pmease.gitplex.web.page.repository.RepositoryPage;
+
+@SuppressWarnings("serial")
+public class RepoCommitPage extends RepositoryPage {
+
+ private static final String PARAM_REVISION = "revision";
+
+ protected IModel<Repository> repoModel;
+
+ protected String revision;
+
+ public RepoCommitPage(PageParameters params) {
+ super(params);
+
+ if (!getRepository().git().hasCommits())
+ throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
+
+ revision = GitPath.normalize(params.get(PARAM_REVISION).toString());
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+ }
+
+ public static PageParameters paramsOf(Repository repository, String revision) {
+ PageParameters params = paramsOf(repository);
+ params.set(PARAM_REVISION, revision);
+ return params;
+ }
+
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html
new file mode 100644
index 0000000000..ae5ea4c3d1
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html
@@ -0,0 +1,4 @@
+<wicket:extend>
+ <div class="padder repo-commits">
+ </div>
+</wicket:extend>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java
new file mode 100644
index 0000000000..aaec6f826c
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java
@@ -0,0 +1,41 @@
+package com.pmease.gitplex.web.page.repository.commit;
+
+import org.apache.wicket.RestartResponseException;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+import com.pmease.commons.git.GitPath;
+import com.pmease.gitplex.core.model.Repository;
+import com.pmease.gitplex.web.page.repository.NoCommitsPage;
+import com.pmease.gitplex.web.page.repository.RepositoryPage;
+
+@SuppressWarnings("serial")
+public class RepoCommitsPage extends RepositoryPage {
+
+ private static final String PARAM_REVISION = "revision";
+
+ protected IModel<Repository> repoModel;
+
+ protected String revision;
+
+ public RepoCommitsPage(PageParameters params) {
+ super(params);
+
+ if (!getRepository().git().hasCommits())
+ throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
+
+ revision = GitPath.normalize(params.get(PARAM_REVISION).toString());
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+ }
+
+ public static PageParameters paramsOf(Repository repository, String revision) {
+ PageParameters params = paramsOf(repository);
+ params.set(PARAM_REVISION, revision);
+ return params;
+ }
+
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/NewRequestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/NewRequestPage.java
index e009700b73..071322d2e5 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/NewRequestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/NewRequestPage.java
@@ -57,15 +57,14 @@ import com.pmease.gitplex.core.permission.Permission;
import com.pmease.gitplex.web.component.branch.AffinalBranchSingleChoice;
import com.pmease.gitplex.web.component.branch.BranchLink;
import com.pmease.gitplex.web.component.comment.CommentInput;
-import com.pmease.gitplex.web.component.commit.CommitsTablePanel;
import com.pmease.gitplex.web.component.diff.CompareResultPanel;
import com.pmease.gitplex.web.component.pullrequest.AssigneeChoice;
import com.pmease.gitplex.web.component.pullrequest.ReviewerAvatar;
import com.pmease.gitplex.web.component.pullrequest.ReviewerChoice;
import com.pmease.gitplex.web.model.ReviewersModel;
+import com.pmease.gitplex.web.page.LoginPage;
import com.pmease.gitplex.web.page.repository.NoCommitsPage;
import com.pmease.gitplex.web.page.repository.RepositoryPage;
-import com.pmease.gitplex.web.shiro.LoginPage;
@SuppressWarnings("serial")
public class NewRequestPage extends RepositoryPage {
@@ -251,15 +250,6 @@ public class NewRequestPage extends RepositoryPage {
}
add(fragment);
- final IModel<Repository> repositoryModel = new AbstractReadOnlyModel<Repository>() {
-
- @Override
- public Repository getObject() {
- return pullRequest.getTarget().getRepository();
- }
-
- };
-
List<Tab> tabs = new ArrayList<>();
tabs.add(new AjaxActionTab(Model.of("Pending Commits")) {
@@ -300,13 +290,13 @@ public class NewRequestPage extends RepositoryPage {
});
- add(new CommitsTablePanel("tabPanel", commitsModel, repositoryModel).setOutputMarkupId(true));
+ add(new WebMarkupContainer("tabPanel").setOutputMarkupId(true));
add(new BackToTop("backToTop"));
}
private Component newCommitsPanel() {
- return new CommitsTablePanel("tabPanel", commitsModel, repoModel).setOutputMarkupId(true);
+ return new WebMarkupContainer("tabPanel").setOutputMarkupId(true);
}
private Component newChangedFilesPanel() {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java
index 80ab2898ca..a07a962665 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java
@@ -36,6 +36,7 @@ import com.pmease.commons.hibernate.HibernateUtils;
import com.pmease.commons.hibernate.dao.Dao;
import com.pmease.commons.loader.InheritableThreadLocalData;
import com.pmease.commons.util.diff.AroundContext;
+import com.pmease.commons.wicket.behavior.HistoryBehavior;
import com.pmease.commons.wicket.behavior.StickyBehavior;
import com.pmease.commons.wicket.behavior.TooltipBehavior;
import com.pmease.commons.wicket.behavior.dropdown.DropdownBehavior;
@@ -43,7 +44,6 @@ import com.pmease.commons.wicket.behavior.dropdown.DropdownPanel;
import com.pmease.commons.wicket.behavior.menu.MenuBehavior;
import com.pmease.commons.wicket.behavior.menu.MenuItem;
import com.pmease.commons.wicket.behavior.menu.MenuPanel;
-import com.pmease.commons.wicket.component.history.HistoryAwarePanel;
import com.pmease.commons.wicket.websocket.WebSocketRenderBehavior.PageId;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.comment.InlineComment;
@@ -385,94 +385,97 @@ public class RequestComparePage extends RequestDetailPage {
});
- add(new HistoryAwarePanel("compareResult") {
+ add(compareResult = new CompareResultPanel("compareResult", repoModel, oldCommitHash, newCommitHash, file) {
+
+ private HistoryBehavior historyBehavior;
@Override
- public void onPopState(AjaxRequestTarget target, Serializable state) {
- compareResult.select(target, (String) state);
- target.add(optionsContainer);
- }
+ protected void onInitialize() {
+ super.onInitialize();
+
+ add(historyBehavior = new HistoryBehavior() {
- @Override
- protected Component newContent(String id) {
- compareResult = new CompareResultPanel(id, repoModel, oldCommitHash, newCommitHash, file) {
-
@Override
- protected InlineCommentSupport getInlineCommentSupport(final Change change) {
- List<String> commentables = getPullRequest().getCommentables();
- int oldCommitIndex = commentables.indexOf(oldCommitHash);
- int newCommitIndex = commentables.indexOf(newCommitHash);
- if (oldCommitIndex == -1 || newCommitIndex == -1 || oldCommitIndex > newCommitIndex) {
- return null;
- } else {
- return new InlineCommentSupport() {
-
- @Override
- public Map<Integer, List<InlineComment>> getOldComments() {
- return getPullRequest().getChangeComments(change).getOldComments();
- }
-
- @Override
- public Map<Integer, List<InlineComment>> getNewComments() {
- return getPullRequest().getChangeComments(change).getNewComments();
- }
-
- @Override
- public InlineComment getConcernedComment() {
- return RequestComparePage.this.getComment();
- }
-
- @Override
- public InlineComment addComment(BlobInfo blobInfo, BlobInfo compareWith,
- AroundContext commentContext, int line, String content) {
- User user = GitPlex.getInstance(UserManager.class).getCurrent();
- Preconditions.checkNotNull(user);
- PullRequestComment comment = new PullRequestComment();
- getPullRequest().getComments().add(comment);
- comment.setUser(user);
- comment.setDate(new Date());
- comment.setContent(content);
- comment.setRequest(getPullRequest());
- comment.setBlobInfo(blobInfo);
- comment.setCompareWith(compareWith);
- comment.setLine(line);
- comment.setContext(commentContext);
- InheritableThreadLocalData.set(new PageId(getPageId()));
- try {
- GitPlex.getInstance(PullRequestCommentManager.class).save(comment, true);
- } finally {
- InheritableThreadLocalData.clear();
- }
- return comment;
- }
- };
- }
+ protected void onPopState(AjaxRequestTarget target, Serializable state) {
+ compareResult.select(target, (String) state);
+ target.add(optionsContainer);
}
+
+ });
+ }
- @Override
- protected void onSelection(AjaxRequestTarget target, Change change) {
- file = change.getPath();
-
- String original = getPageParameters().get(ORIGINAL_PARAM).toString();
- String revised = getPageParameters().get(REVISED_PARAM).toString();
- Long commentId = getPageParameters().get(COMMENT_PARAM).toOptionalLong();
+ @Override
+ protected InlineCommentSupport getInlineCommentSupport(final Change change) {
+ List<String> commentables = getPullRequest().getCommentables();
+ int oldCommitIndex = commentables.indexOf(oldCommitHash);
+ int newCommitIndex = commentables.indexOf(newCommitHash);
+ if (oldCommitIndex == -1 || newCommitIndex == -1 || oldCommitIndex > newCommitIndex) {
+ return null;
+ } else {
+ return new InlineCommentSupport() {
- StringBuilder url = new StringBuilder("compare?file=");
- url.append(file);
- if (original != null)
- url.append("&original=").append(original);
- if (revised != null)
- url.append("&revised=").append(revised);
- if (commentId != null)
- url.append("&comment=").append(commentId);
+ @Override
+ public Map<Integer, List<InlineComment>> getOldComments() {
+ return getPullRequest().getChangeComments(change).getOldComments();
+ }
- pushState(target, url.toString(), file);
- }
-
- };
- return compareResult;
+ @Override
+ public Map<Integer, List<InlineComment>> getNewComments() {
+ return getPullRequest().getChangeComments(change).getNewComments();
+ }
+
+ @Override
+ public InlineComment getConcernedComment() {
+ return RequestComparePage.this.getComment();
+ }
+
+ @Override
+ public InlineComment addComment(BlobInfo blobInfo, BlobInfo compareWith,
+ AroundContext commentContext, int line, String content) {
+ User user = GitPlex.getInstance(UserManager.class).getCurrent();
+ Preconditions.checkNotNull(user);
+ PullRequestComment comment = new PullRequestComment();
+ getPullRequest().getComments().add(comment);
+ comment.setUser(user);
+ comment.setDate(new Date());
+ comment.setContent(content);
+ comment.setRequest(getPullRequest());
+ comment.setBlobInfo(blobInfo);
+ comment.setCompareWith(compareWith);
+ comment.setLine(line);
+ comment.setContext(commentContext);
+ InheritableThreadLocalData.set(new PageId(getPageId()));
+ try {
+ GitPlex.getInstance(PullRequestCommentManager.class).save(comment, true);
+ } finally {
+ InheritableThreadLocalData.clear();
+ }
+ return comment;
+ }
+ };
+ }
}
+ @Override
+ protected void onSelection(AjaxRequestTarget target, Change change) {
+ file = change.getPath();
+
+ String original = getPageParameters().get(ORIGINAL_PARAM).toString();
+ String revised = getPageParameters().get(REVISED_PARAM).toString();
+ Long commentId = getPageParameters().get(COMMENT_PARAM).toOptionalLong();
+
+ StringBuilder url = new StringBuilder("compare?file=");
+ url.append(file);
+ if (original != null)
+ url.append("&original=").append(original);
+ if (revised != null)
+ url.append("&revised=").append(revised);
+ if (commentId != null)
+ url.append("&comment=").append(commentId);
+
+ historyBehavior.pushState(target, url.toString(), file);
+ }
+
});
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestUpdatesPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestUpdatesPage.java
index 45f4b465f6..0d3d3fb006 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestUpdatesPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestUpdatesPage.java
@@ -32,8 +32,8 @@ import com.pmease.gitplex.core.model.PullRequestVerification;
import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.core.model.Review;
import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.component.commit.CommitHashLink;
-import com.pmease.gitplex.web.component.commit.OldCommitMessagePanel;
+import com.pmease.gitplex.web.component.commitlink.CommitHashLink;
+import com.pmease.gitplex.web.component.commitmessage.OldCommitMessagePanel;
import com.pmease.gitplex.web.component.label.AgeLabel;
import com.pmease.gitplex.web.component.pullrequest.ReviewResultIcon;
import com.pmease.gitplex.web.component.user.AvatarMode;
@@ -184,7 +184,7 @@ public class RequestUpdatesPage extends RequestDetailPage {
commitItem.add(new CommitHashLink("hashLink", repoModel, commit.getHash()));
commitItem.add(new BookmarkablePageLink<Void>("treeLink", RepoTreePage.class,
- RepoTreePage.paramsOf(repoModel.getObject(), commit.getHash())));
+ RepoTreePage.paramsOf(repoModel.getObject(), commit.getHash(), null)));
commitItem.add(new VerificationStatusPanel("verification", requestModel, Model.of(commit.getHash())) {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/UpdateActivityPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/UpdateActivityPanel.java
index 1d26124a54..969f0c8ec5 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/UpdateActivityPanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/UpdateActivityPanel.java
@@ -21,8 +21,8 @@ import com.pmease.gitplex.core.model.PullRequest;
import com.pmease.gitplex.core.model.PullRequestUpdate;
import com.pmease.gitplex.core.model.PullRequestVerification;
import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.component.commit.CommitHashLink;
-import com.pmease.gitplex.web.component.commit.OldCommitMessagePanel;
+import com.pmease.gitplex.web.component.commitlink.CommitHashLink;
+import com.pmease.gitplex.web.component.commitmessage.OldCommitMessagePanel;
import com.pmease.gitplex.web.component.user.AvatarMode;
import com.pmease.gitplex.web.component.user.PersonLink;
import com.pmease.gitplex.web.page.repository.pullrequest.VerificationStatusPanel;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/RunModePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/RunModePage.html
similarity index 100%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/page/RunModePage.html
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/RunModePage.html
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/RunModePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/RunModePage.java
similarity index 97%
rename from gitplex.web/src/main/java/com/pmease/gitplex/web/page/RunModePage.java
rename to gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/RunModePage.java
index 87a74afb97..fe9aa02e62 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/RunModePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/RunModePage.java
@@ -1,4 +1,4 @@
-package com.pmease.gitplex.web.page;
+package com.pmease.gitplex.web.page.test;
import java.io.File;
import java.io.IOException;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
new file mode 100644
index 0000000000..52347806c0
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
@@ -0,0 +1,2 @@
+<wicket:extend>
+</wicket:extend>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
new file mode 100644
index 0000000000..328e92692b
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
@@ -0,0 +1,8 @@
+package com.pmease.gitplex.web.page.test;
+
+import com.pmease.gitplex.web.page.BasePage;
+
+@SuppressWarnings("serial")
+public class TestPage extends BasePage {
+
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/resource/BlobResource.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/resource/BlobResource.java
deleted file mode 100644
index 027278d6e4..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/resource/BlobResource.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.pmease.gitplex.web.resource;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.StreamingOutput;
-
-import org.apache.shiro.SecurityUtils;
-import org.eclipse.jgit.lib.ObjectStream;
-import org.parboiled.common.Preconditions;
-
-import com.google.common.base.Strings;
-import com.google.common.io.ByteStreams;
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.RepositoryManager;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.core.permission.Permission;
-import com.pmease.gitplex.web.service.FileBlob;
-import com.pmease.gitplex.web.service.FileBlobService;
-
-@Path("/blob")
-public class BlobResource {
-
- @GET
- @Path("raw/{user}/{repository}/{objectId}/{path:.*}")
- public Response getRawContent(@PathParam("user") String username,
- @PathParam("repository") String repositoryName,
- final @PathParam("objectId") String revision,
- final @PathParam("path") String path) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(username));
- Preconditions.checkArgument(!Strings.isNullOrEmpty(repositoryName));
- Preconditions.checkArgument(!Strings.isNullOrEmpty(revision));
- Preconditions.checkArgument(!Strings.isNullOrEmpty(path));
-
- final Repository repository = GitPlex.getInstance(RepositoryManager.class).findBy(username, repositoryName);
-
- if (repository == null) {
- return Response.status(Status.NOT_FOUND)
- .entity("Repository " + username + "/" + repositoryName + " doesn't exist")
- .build();
- }
-
- if (!SecurityUtils.getSubject().isPermitted(Permission.ofRepositoryRead(repository))) {
- return Response.status(Status.FORBIDDEN)
- .entity("You have no permission to access this resource")
- .build();
- }
-
- FileBlob blob = GitPlex.getInstance(FileBlobService.class).get(repository, revision, path);
-
- StreamingOutput stream = new StreamingOutput() {
-
- @Override
- public void write(OutputStream output) throws IOException,
- WebApplicationException {
- ObjectStream os = GitPlex.getInstance(FileBlobService.class).openStream(repository, revision, path);
- ByteStreams.copy(os, output);
- }
- };
-
- String disposition = MediaTypes.isSafeInline(blob.getMediaType()) ?
- "inline" : "attachment; filename = " + blob.getName();
-
- return Response.ok(stream, blob.getMediaType().toString())
- .header("content-disposition", disposition)
- .build();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/resource/ResourceLocator.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/resource/ResourceLocator.java
deleted file mode 100644
index 749c3ec37f..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/resource/ResourceLocator.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.pmease.gitplex.web.resource;
-
-public class ResourceLocator {
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/FileBlob.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/service/FileBlob.java
deleted file mode 100644
index 853bcb1f7b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/FileBlob.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package com.pmease.gitplex.web.service;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import com.pmease.gitplex.core.GitPlex;
-
-import org.apache.commons.io.FilenameUtils;
-import org.apache.tika.mime.MediaType;
-import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.util.RawParseUtils;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
-import com.google.common.io.CharSource;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.common.quantity.Data;
-import com.pmease.gitplex.web.page.repository.code.blob.language.Language;
-import com.pmease.gitplex.web.page.repository.code.blob.language.Languages;
-
-public class FileBlob implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private final Long repositoryId;
- private final String revision;
- private final String file;
-
- // calculated fields
- private String objectId;
- private MediaType mediaType;
- private byte[] data;
- private long size;
- private FileMode mode;
- private Charset charset;
-
- private static final long LARGE_FILE_SIZE = 2 * Data.ONE_MB;
-
- public FileBlob(final Long repositoryId, final String revision, final String file) {
- this.repositoryId = Preconditions.checkNotNull(repositoryId);
- this.revision = Preconditions.checkNotNull(revision);
- this.file = Preconditions.checkNotNull(file);
- }
-
- public static FileBlob of(Repository repository, String revision, String file) {
- return GitPlex.getInstance(FileBlobService.class).get(repository, repository.defaultBranchIfNull(revision), file);
- }
-
- public boolean isText() {
- return MediaTypes.isText(mediaType);
- }
-
- public boolean isImage() {
- return MediaTypes.isImage(mediaType);
- }
-
- public boolean isEmpty() {
- return size <= 0L;
- }
-
- public boolean isLarge() {
- return size > LARGE_FILE_SIZE;
- }
-
- public boolean isExecutable() {
- return mode == FileMode.EXECUTABLE_FILE;
- }
-
- public @Nullable Language getLanguage() {
- Language lang = Languages.INSTANCE.findByMediaType(mediaType);
- if ((lang == null) && (MediaTypes.isXML(mediaType))) {
- return Languages.INSTANCE.findByMediaType(MediaType.APPLICATION_XML);
- }
-
- return lang;
- }
-
- public boolean isHighlightable() {
- return getSize() < LARGE_FILE_SIZE
- && isText()
- && getLanguage() != null;
- }
-
- public @Nullable String getStringContent() {
- if (data == null) {
- return null;
- }
-
- return RawParseUtils.decode(charset, data);
- }
-
- public List<String> getLines() {
- if (isEmpty() || isLarge() || !isText() || data == null) {
- return Collections.emptyList();
- }
-
- try {
- return CharSource.wrap(getStringContent()).readLines();
- } catch (IOException e) {
- throw Throwables.propagate(e);
- }
- }
-
- public String getName() {
- return FilenameUtils.getName(getFilePath());
- }
-
- /**
- * Example:
- * /a/b/c.txt -> /a/b/
- *
- * @return
- */
- public String getFullPath() {
- return FilenameUtils.getFullPath(getFilePath());
- }
-
- public Long getRepositoryId() {
- return repositoryId;
- }
-
- public Repository getRepository() {
- return GitPlex.getInstance(Dao.class).load(Repository.class, Preconditions.checkNotNull(getRepositoryId()));
- }
-
- public String getRevision() {
- return revision;
- }
-
- /**
- * Returns the full file name
- *
- * @return
- */
- public String getFilePath() {
- return file;
- }
-
- public String getObjectId() {
- return objectId;
- }
-
- public MediaType getMediaType() {
- return mediaType;
- }
-
- public @Nullable byte[] getData() {
- return data;
- }
-
- public long getSize() {
- return size;
- }
-
- public FileMode getMode() {
- return mode;
- }
-
- public Charset getCharset() {
- return charset;
- }
-
- public void setObjectId(String objectId) {
- this.objectId = objectId;
- }
-
- public void setMediaType(MediaType mediaType) {
- this.mediaType = mediaType;
- }
-
- public void setData(byte[] data) {
- this.data = data;
- }
-
- public void setSize(long size) {
- this.size = size;
- }
-
- public void setMode(FileMode mode) {
- this.mode = mode;
- }
-
- public void setCharset(Charset charset) {
- this.charset = charset;
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof FileBlob))
- return false;
-
- FileBlob rhs = (FileBlob) other;
- return Objects.equal(repositoryId, rhs.repositoryId)
- && Objects.equal(revision, rhs.revision)
- && Objects.equal(file, rhs.file);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(repositoryId, revision, file);
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper(this)
- .add("Repository Id", repositoryId)
- .add("Revision", revision)
- .add("Path", file)
- .toString();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/FileBlobService.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/service/FileBlobService.java
deleted file mode 100644
index 784ed148f7..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/FileBlobService.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.pmease.gitplex.web.service;
-
-import org.eclipse.jgit.lib.ObjectStream;
-
-import com.pmease.gitplex.core.model.Repository;
-
-public interface FileBlobService {
-
- FileBlob get(Repository repository, String revision, String path);
-
- ObjectStream openStream(Repository repository, String revision, String path);
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/IRepositoryManager.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/service/IRepositoryManager.java
deleted file mode 100644
index 8662b4d7f2..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/IRepositoryManager.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.pmease.gitplex.web.service;
-
-public class IRepositoryManager {
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/impl/DefaultFileBlobService.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/service/impl/DefaultFileBlobService.java
deleted file mode 100644
index b14d43ed1e..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/service/impl/DefaultFileBlobService.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.pmease.gitplex.web.service.impl;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-
-import javax.inject.Singleton;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.tika.mime.MediaType;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.ObjectLoader;
-import org.eclipse.jgit.lib.ObjectStream;
-import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.treewalk.TreeWalk;
-import org.gitective.core.BlobUtils;
-import org.gitective.core.CommitUtils;
-
-import com.google.common.base.Objects;
-import com.google.common.io.ByteStreams;
-import com.pmease.commons.util.Charsets;
-import com.pmease.commons.util.MediaTypes;
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.git.RepoUtils;
-import com.pmease.gitplex.web.git.RepositoryException;
-import com.pmease.gitplex.web.service.FileBlob;
-import com.pmease.gitplex.web.service.FileBlobService;
-
-@Singleton
-public class DefaultFileBlobService implements FileBlobService {
-
- @Override
- public FileBlob get(Repository repository, String revision, String path) {
- FileBlob blob = new FileBlob(repository.getId(), revision, path);
-
- File gitDir = repository.git().repoDir();
- org.eclipse.jgit.lib.Repository repo = null;
- try {
- repo = RepoUtils.open(gitDir);
- RevCommit commit = CommitUtils.getCommit(repo, revision);
- TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree());
- if (tw == null) {
- throw new RepositoryException("File " + path + " at " + revision + " doesn't exist");
- }
- if (tw.isSubtree()) {
- throw new RepositoryException("Not a file blob");
- }
-
- FileMode mode = tw.getFileMode(0);
- blob.setMode(mode);
- ObjectId blobId = tw.getObjectId(0);
- blob.setObjectId(blobId.name());
- ObjectLoader ol = repo.open(blobId, Constants.OBJ_BLOB);
- blob.setSize(ol.getSize());
-
- if (blob.isEmpty()) {
- blob.setMediaType(MediaType.TEXT_PLAIN);
- } else {
- BufferedInputStream stream = null;
- try {
- stream = new BufferedInputStream(ol.openStream());
- blob.setMediaType(MediaTypes.detectFrom(stream, path));
-
- if (!Charsets.isBinary(stream)
- && Objects.equal(blob.getMediaType(), MediaType.OCTET_STREAM)) {
- // error detecting by tika
- blob.setMediaType(MediaType.TEXT_PLAIN);
- }
-
- if (!blob.isLarge() && MediaTypes.isSafeInline(blob.getMediaType())) {
- blob.setCharset(Charsets.detectFrom(stream));
- blob.setData(ByteStreams.toByteArray(stream));
- }
- } finally {
- IOUtils.closeQuietly(stream);
- }
- }
-
- return blob;
- } catch (IOException e) {
- throw new RepositoryException(e);
- } finally {
- RepoUtils.close(repo);
- }
- }
-
- @Override
- public ObjectStream openStream(Repository repository, String revision, String path) {
- File gitDir = repository.git().repoDir();
- org.eclipse.jgit.lib.Repository repo = null;
- try {
- repo = RepoUtils.open(gitDir);
- return BlobUtils.getStream(repo, revision, path);
- } finally {
- RepoUtils.close(repo);
- }
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LoginPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LoginPage.html
deleted file mode 100644
index 0b8ebe64e3..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LoginPage.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<html xmlns:wicket>
-<wicket:extend>
- <div id="login-form">
- <h1>Sign in</h1>
-
- <div wicket:id="feedback"></div>
- <form wicket:id="login" method="post">
- <div class="input-group user-group">
- <span class="input-group-addon"><i class="fa fa-user fa-fw"></i></span>
- <input wicket:id="username" type="text" class="form-control input-lg focusable" placeholder="User name"/>
- </div>
- <div class="input-group password-group">
- <span class="input-group-addon"><i class="fa fa-lock fa-fw"></i></span>
- <input wicket:id="password" type="password" class="form-control input-lg" placeholder="Password"/>
- </div>
- <div class="row">
- <div class="col-sm-6">
- <div wicket:id="rememberme"></div>
- </div>
- <div class="col-sm-6">
- <button class="btn btn-primary dirty-aware" type="submit">Sign in</button>
- </div>
- </div>
- </form>
- <hr/>
- <p class="text-right">
- <a>Forgot your password?</a> - <a>Request an account</a>
- </p>
- </div>
-</wicket:extend>
-</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LoginPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LoginPage.java
deleted file mode 100644
index 06cb5c166b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LoginPage.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.pmease.gitplex.web.shiro;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.AuthenticationException;
-import org.apache.wicket.Component;
-import org.apache.wicket.RestartResponseException;
-import org.apache.wicket.markup.html.form.PasswordTextField;
-import org.apache.wicket.markup.html.form.StatelessForm;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.pmease.commons.wicket.component.feedback.FeedbackPanel;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.manager.UserManager;
-import com.pmease.gitplex.web.GitPlexSession;
-import com.pmease.gitplex.web.common.wicket.form.checkbox.CheckBoxElement;
-import com.pmease.gitplex.web.page.LayoutPage;
-import com.pmease.gitplex.web.page.account.AccountHomePage;
-
-@SuppressWarnings("serial")
-public class LoginPage extends LayoutPage {
- private static final Logger logger = LoggerFactory.getLogger(LoginPage.class);
-
- public LoginPage() {
- if (SecurityUtils.getSubject().isAuthenticated()) {
- throw new RestartResponseException(getApplication().getHomePage());
- }
-
- add(new LoginForm("login"));
- FeedbackPanel feedback = new FeedbackPanel("feedback", get("login"));
- add(feedback);
- }
-
- private class LoginForm extends StatelessForm<Void> {
-
- public LoginForm(String id) {
- super(id);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- add(new TextField<String>("username", new Model<String>()).setRequired(true));
- add(new PasswordTextField("password", new Model<String>()).setResetPassword(false));
- add(new CheckBoxElement("rememberme", Model.of(false),
- Model.of("Remember me on this computer")));
- }
-
- private Component getUsernameField() {
- return get("username");
- }
-
- private Component getPasswordField() {
- return get("password");
- }
-
- /**
- * Delegate to {@link #loginShiro loginShiro()} to peform the
- * authentication; if it succeeds, redirect to the user's original intended
- * destination or to the application home page.
- */
- @Override
- protected void onSubmit() {
- String username = getUsernameField().getDefaultModelObjectAsString();
- String password = getPasswordField().getDefaultModelObjectAsString();
-
- // Convert username to lowercase just in case the backend authentication
- // system is case sensitive and the user accidentally typed in uppercase.
- if (username != null) {
- username = username.toLowerCase();
- }
-
- if (loginShiro(username, password, remember())) {
- continueToOriginalDestination();
- setResponsePage(
- AccountHomePage.class,
- AccountHomePage.paramsOf(GitPlex.getInstance(UserManager.class).getCurrent()));
- }
- }
-
- protected boolean loginShiro(String loginName, String password, boolean remember) {
- try {
- GitPlexSession.get().login(loginName, password, remember);
- return true;
- } catch (AuthenticationException ae) {
- onAuthenticationException(ae);
- }
- return false;
- }
-
- /**
- * Handle any exceptions that are thrown upon login failure by setting an
- * appropriate feedback message. The default implemention adds an error
- * feedback message with the key {@code loginFailed} to the email field.
- */
- protected void onAuthenticationException(AuthenticationException ae) {
- logger.debug("Shiro Subject.login() failed", ae);
- getUsernameField().error(getString("loginFailed", null, "Invalid user name and/or password."));
- }
-
- /**
- * Override this method to return {@code true} if you want to enable Shiro's
- * "remember me" feature. By default this returns {@code false}.
- */
- protected boolean remember() {
- CheckBoxElement c = (CheckBoxElement) get("rememberme");
- Boolean b = (Boolean) c.getFormComponent().getDefaultModelObject();
-// System.out.println(b);
- return b;
- }
-
- }
-
-
- @Override
- protected String getPageTitle() {
- return "GitPlex - Log in";
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LogoutPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LogoutPage.java
deleted file mode 100644
index d0276ae83b..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/LogoutPage.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.pmease.gitplex.web.shiro;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.wicket.request.flow.RedirectToUrlException;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.string.StringValue;
-
-import com.pmease.commons.wicket.CommonPage;
-
-@SuppressWarnings("serial")
-public class LogoutPage extends CommonPage {
-
- /**
- * Bookmarkable constructor. If a {@code "to"} parameter is provided, assume
- * it is a URI and redirect to that URI upon logout. Otherwise redirect to
- * the home page.
- */
- public LogoutPage(PageParameters params) {
- super(params);
- }
-
- /**
- * Interrupt the rendering process and perform the logout, then redirect to
- * a different page by throwing an exception. The {@code LogoutPage} itself
- * will therefore never be rendered.
- */
- @Override
- protected void onBeforeRender() throws RedirectToUrlException {
- logout();
- redirectAfterLogout();
- }
-
- /**
- * Called by {@link #onBeforeRender} to instruct Shiro to log the current
- * user out, then delegate to {@link ShiroWicketPlugin#onLoggedOut} to place
- * a feedback message in the session.
- */
- protected void logout() {
- // Perform Shiro logout
- SecurityUtils.getSubject().logout();
-
- // Delegate to plugin to perform any futher logout tasks
- ShiroWicketPlugin.get().onLoggedOut();
- }
-
- /**
- * Called by {@link #onBeforeRender} after {@link #logout} to redirect to
- * another page. By default this is the application home page. However if a
- * {@code "to"} page parameter was provided, assume it is a URI and redirect
- * to that URI instead. For security reasons, full URLs (i.e. something
- * starting with {@code http}) are ignored.
- *
- * @throws RedirectToUrlException
- * to cause Wicket to perform a 302 redirect
- */
- protected void redirectAfterLogout() throws RedirectToUrlException {
- StringValue to = getPageParameters().get("to");
-
- // If "to" param was not specified, or was erroneously set to
- // an absolute URL (i.e. containing a ":" like "http://blah"), then fall
- // back
- // to the home page.
- if (null == to || to.isNull() || to.toString().indexOf(":") >= 0) {
- to = StringValue.valueOf(urlFor(getApplication().getHomePage(),
- null));
- }
-
- throw new RedirectToUrlException(to.toString(), 302);
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/ShiroWicketPlugin.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/ShiroWicketPlugin.java
deleted file mode 100644
index ec7f7c47fb..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/shiro/ShiroWicketPlugin.java
+++ /dev/null
@@ -1,733 +0,0 @@
-package com.pmease.gitplex.web.shiro;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.shiro.authz.AuthorizationException;
-import org.apache.shiro.authz.UnauthenticatedException;
-import org.apache.shiro.authz.aop.AuthenticatedAnnotationHandler;
-import org.apache.shiro.authz.aop.AuthorizingAnnotationHandler;
-import org.apache.shiro.authz.aop.GuestAnnotationHandler;
-import org.apache.shiro.authz.aop.PermissionAnnotationHandler;
-import org.apache.shiro.authz.aop.RoleAnnotationHandler;
-import org.apache.shiro.authz.aop.UserAnnotationHandler;
-import org.apache.wicket.Application;
-import org.apache.wicket.Component;
-import org.apache.wicket.MetaDataKey;
-import org.apache.wicket.Page;
-import org.apache.wicket.RestartResponseAtInterceptPageException;
-import org.apache.wicket.Session;
-import org.apache.wicket.authorization.Action;
-import org.apache.wicket.authorization.IAuthorizationStrategy;
-import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener;
-import org.apache.wicket.authorization.UnauthorizedInstantiationException;
-import org.apache.wicket.core.request.handler.PageProvider;
-import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
-import org.apache.wicket.core.request.handler.RenderPageRequestHandler.RedirectPolicy;
-import org.apache.wicket.core.request.mapper.MountedMapper;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.request.IRequestHandler;
-import org.apache.wicket.request.component.IRequestableComponent;
-import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
-import org.apache.wicket.request.cycle.IRequestCycleListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.flow.ResetResponseException;
-import org.apache.wicket.request.http.WebRequest;
-import org.apache.wicket.settings.ISecuritySettings;
-import org.apache.wicket.util.lang.Args;
-
-
-/**
- * Borrowed from:
- * https://github.com/55minutes/fiftyfive-wicket/blob/master/fiftyfive-wicket-shiro/src/main/java/fiftyfive/wicket/shiro/ShiroWicketPlugin.java
- *
- *
- * Enhances Wicket to integrate closely with the Apache Shiro security
- * framework. With the {@code ShiroWicketPlugin} installed in your Wicket
- * application, you will gain the following features:
- * <ul>
- * <li>You can use all of Shiro's authorization annotations
- * (like
- * {@link org.apache.shiro.authz.annotation.RequiresAuthentication @RequiresAuthentication}
- * and
- * {@link org.apache.shiro.authz.annotation.RequiresPermissions @RequiresPermissions})
- * on Wicket Pages. The {@code ShiroWicketPlugin} will ensure that only
- * authorized users can access these pages, and will show an appropriate
- * error page or login page otherwise.
- * See {@link #isInstantiationAuthorized isInstantiationAuthorized()}.
- * </li>
- * <li>You can also use the same Shiro annotations on individual components,
- * like Links and Panels. The {@code ShiroWicketPlugin} will automatically
- * hide these components from unauthorized users.
- * See {@link #isActionAuthorized isActionAuthorized()}.
- * </li>
- * <li>You can access Shiro directly at any time in your Wicket code
- * by calling
- * {@link org.apache.shiro.SecurityUtils#getSubject SecurityUtils.getSubject()}.
- * This gives you access to the rich set of security operations on the
- * Shiro {@link org.apache.shiro.subject.Subject Subject} that represents
- * the current user.
- * </li>
- * <li>Any uncaught Shiro
- * {@link AuthorizationException AuthorizationExceptions}
- * will be handled gracefully by redirecting the user to the
- * login page or an unauthorized page (by default, the home page).
- * This allows you to implement
- * comprehensive security rules using Shiro at any tier of your
- * application and be confident that your UI will handle them
- * appropriately.
- * See {@link #onException onException()}.
- * </li>
- * </ul>
- * <h2>Installation</h2>
- * Before you can use the {@code ShiroWicketPlugin}, you must have Shiro
- * properly added to your application's {@code web.xml} file. Refer to the
- * <a href="package-summary.html">package summary</a> of this Javadoc
- * for a brief tutorial.
- * <h3>{@code Application.init()}</h3>
- * Once Shiro itself is installed, adding {@code ShiroWicketPlugin} can be as
- * simple as adding one line to your Wicket application {@code init()}:
- * <pre class="example">
- * public class MyApplication extends WebApplication
- * {
- * &#064;Override
- * protected void init()
- * {
- * super.init();
- * new ShiroWicketPlugin().install(this);
- * }
- * }</pre>
- * Most developers will want to customize the login page.
- * The more complex real-world installation is thus:
- * <pre class="example">
- * public class MyApplication extends WebApplication
- * {
- * &#064;Override
- * protected void init()
- * {
- * super.init();
- * new ShiroWicketPlugin()
- * .mountLoginPage("login", MyLoginPage.class)
- * .install(this);
- * }
- * }</pre>
- *
- */
-@SuppressWarnings("serial")
-public class ShiroWicketPlugin
- extends AbstractRequestCycleListener
- implements IAuthorizationStrategy,
- IUnauthorizedComponentInstantiationListener
-{
- /**
- * The key that will be used to obtain a localized message
- * when access is denied due to the user be unauthorized;
- * for example, "you are not allowed to access that page".
- */
- public static final String UNAUTHORIZED_MESSAGE_KEY = "unauthorized";
-
- /**
- * The key that will be used to obtain a localized message
- * when access is denied due to the user be unauthenticated;
- * for example, "you need to be logged in to continue".
- */
- public static final String LOGIN_REQUIRED_MESSAGE_KEY = "loginRequired";
-
- /**
- * The key that will be used to obtain a localized message
- * when logout is performed; for example, "you have been logged out".
- */
- public static final String LOGGED_OUT_MESSAGE_KEY = "loggedOut";
-
- private static final MetaDataKey<AuthorizationException> EXCEPTION_KEY =
- new MetaDataKey<AuthorizationException>() {};
-
- private static final MetaDataKey<ShiroWicketPlugin> PLUGIN_KEY =
- new MetaDataKey<ShiroWicketPlugin>() {};
-
- private static final AuthorizingAnnotationHandler[] HANDLERS =
- new AuthorizingAnnotationHandler[] {
- new AuthenticatedAnnotationHandler(),
- new GuestAnnotationHandler(),
- new PermissionAnnotationHandler(),
- new RoleAnnotationHandler(),
- new UserAnnotationHandler()
- };
-
- /**
- * Returns the {@code ShiroWicketPlugin} instance that has been installed
- * in the current Wicket application. This is a convenience method that
- * only works within a Wicket thread, and it assumes that
- * {@link #install install()} has already been called.
- *
- * @throws IllegalStateException if there is no Wicket application bound
- * to the current thread, or if a
- * {@code ShiroWicketPlugin} has not been
- * installed.
- */
- public static ShiroWicketPlugin get()
- {
- Application app = Application.get();
- if(null == app)
- {
- throw new IllegalStateException(
- "No wicket application is bound to the current thread."
- );
- }
- ShiroWicketPlugin plugin = app.getMetaData(PLUGIN_KEY);
- if(null == plugin)
- {
- throw new IllegalStateException(
- "A ShiroWicketPlugin has not been installed in this Wicket " +
- "application. You must call ShiroWicketPlugin.install() in " +
- "your application init()."
- );
- }
- return plugin;
- }
-
- /**
- * Register the specified {@code ShiroWicketPlugin} in the application so that
- * {@link #get} will work. You should never need to call this method directly, unless you
- * are subclassing and overriding the {@link #install} method.
- */
- public static void set(Application app, ShiroWicketPlugin plugin)
- {
- app.setMetaData(PLUGIN_KEY, plugin);
- }
-
-
- private String loginPath = "login";
- private String logoutPath = "logout";
- private Class<? extends Page> loginPage = LoginPage.class;
- private Class<? extends Page> logoutPage = LogoutPage.class;
- private Class<? extends Page> unauthorizedPage = null;
- private boolean unauthorizedRedirect = true;
-
- /**
- * The login page class as provided to {@link #mountLoginPage}; the default is
- * {@link LoginPage}.
- */
- public Class<? extends Page> getLoginPage()
- {
- return loginPage;
- }
-
- /**
- * The logout page class as provided to {@link #mountLogoutPage}; the default is
- * {@link LogoutPage}.
- */
- public Class<? extends Page> getLogoutPage()
- {
- return logoutPage;
- }
-
- /**
- * Set the bookmarkable page that will be displayed when an <em>unauthenticated</em> user
- * attempts to access a page that requires authentication.
- *
- * @param mountPath The bookmarkable URI where the login page will be mounted when
- * {@link #install install} is called. The default is {@code "/login"}.
- * May be {@code null}, in which case the login page will not be mounted.
- * You would want to pass {@code null}, for example, if you use your home
- * page as the login page, since in that case the home page is already
- * implicitly mounted on {@code "/"}.
- *
- * @param loginPage The page to use as the login page when the user needs to be
- * authenticated. Cannot be {@code null}. The default is a simple
- * out-of-the-box {@link LoginPage}.
- *
- * @return {@code this} to allow chaining
- */
- public ShiroWicketPlugin mountLoginPage(String mountPath, Class<? extends Page> loginPage)
- {
- Args.notNull(loginPage, "loginPage");
- this.loginPath = mountPath;
- this.loginPage = loginPage;
- return this;
- }
-
- /**
- * Set the bookmarkable page that will be loaded to perform logout when the
- * {@link fiftyfive.wicket.shiro.markup.LogoutLink LogoutLink} is clicked.
- *
- * @param mountPath The bookmarkable URI where the logout page will be mounted when
- * {@link #install install} is called. The default is {@code "/logout"}.
- *
- * @param logoutPage The page to load when the user clicks the
- * {@link fiftyfive.wicket.shiro.markup.LogoutLink LogoutLink}. This page
- * is responsible for actually logging the user out of the Shiro system.
- * Cannot be {@code null}. The default is {@link LogoutPage},
- * which should be sufficient for most applications.
- *
- * @return {@code this} to allow chaining
- */
- public ShiroWicketPlugin mountLogoutPage(String mountPath, Class<? extends Page> logoutPage)
- {
- Args.notNull(logoutPage, "logoutPage");
- this.logoutPath = mountPath;
- this.logoutPage = logoutPage;
- return this;
- }
-
- /**
- * The page class that was set via {@link #setUnauthorizedPage}; otherwise the
- * application home page.
- */
- public Class<? extends Page> getUnauthorizedPage()
- {
- return unauthorizedPage != null ? unauthorizedPage : Application.get().getHomePage();
- }
-
- /**
- * The redirect flag that was set via {@link #setUnauthorizedPage}; {@code true} by default.
- */
- public boolean getUnauthorizedRedirect()
- {
- return unauthorizedRedirect;
- }
-
- /**
- * Set the bookmarkable page that will be displayed when an <em>authenticated</em> user
- * attempts to access a page that they are not allowed to see. By default it is
- * {@code null}, indicating that the application home page should be used.
- *
- * @param page The page to display when the user is unauthorized; if {@code null}, the
- * application home page will be used
- *
- * @param redirect If {@code true}, a 302 redirect will be performed to display the page;
- * if {@code false}, no redirect will occur and the URL will not change.
- * The latter is appropriate for an error page.
- *
- * @return {@code this} to allow chaining
- */
- public ShiroWicketPlugin setUnauthorizedPage(Class<? extends Page> page, boolean redirect)
- {
- this.unauthorizedPage = page;
- this.unauthorizedRedirect = redirect;
- return this;
- }
-
- /**
- * The mount path for the login page as provided to {@link #mountLoginPage}; the default is
- * {@code "login"}.
- */
- public String getLoginPath()
- {
- return loginPath;
- }
-
- /**
- * The mount path for the logout action as provided to {@link #mountLogoutPage}; the default is
- * {@code "logout"}.
- */
- public String getLogoutPath()
- {
- return logoutPath;
- }
-
- /**
- * Installs this {@code ShiroWicketPlugin} by doing the following:
- * <ul>
- * <li>Sets itself as the {@link IAuthorizationStrategy}</li>
- * <li>And as the {@link IUnauthorizedComponentInstantiationListener}</li>
- * <li>And as an {@link IRequestCycleListener}</li>
- * <li>Mounts the login page</li>
- * <li>Mounts the logout page</li>
- * </ul>
- */
- public void install(WebApplication app)
- {
- Args.notNull(app, "app");
-
- ISecuritySettings settings = app.getSecuritySettings();
- settings.setAuthorizationStrategy(this);
- settings.setUnauthorizedComponentInstantiationListener(this);
- app.getRequestCycleListeners().add(this);
-
- // Mount bookmarkable URLs
- if(this.loginPath != null)
- {
- app.mount(new MountedMapper(this.loginPath, this.loginPage));
- }
- if(this.logoutPath != null)
- {
- app.mount(new MountedMapper(this.logoutPath, this.logoutPage));
- }
-
- // Install self in app metadata so that static get() can work
- ShiroWicketPlugin.set(app, this);
- }
-
- // Start feedback message callbacks --------------------------------------
-
- /**
- * Called by {@link LogoutPage} once the user has been logged out.
- * The default implementation adds a feedback message to the session that says
- * "you have been logged out". To override or localize this message,
- * define {@code loggedOut} in your application properties. You can disable the
- * message entirely by defining {@code loggedOut} as an empty string.
- */
- public void onLoggedOut()
- {
- String message = getLocalizedMessage(LOGGED_OUT_MESSAGE_KEY, "You have been logged out.");
- if(message != null && !message.matches("^\\s*$"))
- {
- // Invalidate current session and create a new one.
- // We need a new session because otherwise our feedback message won't "stick".
- Session session = Session.get();
- session.replaceSession();
-
- // Add localized "you have been logged out" message to session
- session.info(message);
- }
- }
-
- /**
- * Invoked by {@code ShiroWicketPlugin} when an anonymous or remembered user has tried to
- * access a page that requires authentication. The default implementation places a
- * "you need to be logged in to continue" feedback message in the session.
- * To override or localize this message,
- * define {@code loginRequired} in your application properties. You can disable the
- * message entirely by defining {@code loginRequired} as an empty string.
- */
- public void onLoginRequired()
- {
- String message = getLocalizedMessage(
- LOGIN_REQUIRED_MESSAGE_KEY,
- "You need to be logged in to continue.");
-
- if(message != null && !message.matches("^\\s*$"))
- {
- // We need a new session because otherwise our feedback message won't "stick".
- Session session = Session.get();
- session.bind();
-
- // Add localized "you have been logged out" message to session
- session.info(message);
- }
- }
-
- /**
- * Invoked by {@code ShiroWicketPlugin} when the user has tried to access a page
- * but lacks the necessary role or permission. The default implementation places a
- * "sorry, you are not allowed to access that page" feedback message in the session.
- * To override or localize this message,
- * define {@code unauthorized} in your application properties. You can disable the
- * message entirely by defining {@code unauthorized} as an empty string.
- */
- public void onUnauthorized()
- {
- String message = getLocalizedMessage(
- UNAUTHORIZED_MESSAGE_KEY,
- "Sorry, you are not allowed to access that page.");
-
- if(message != null && !message.matches("^\\s*$"))
- {
- // We need a new session because otherwise our feedback message won't "stick".
- Session session = Session.get();
- session.bind();
-
- // Add localized "sorry, you are not allowed to access that page" message to session
- session.error(message);
- }
- }
-
- // End feedback message callbacks ----------------------------------------
-
- // Start IRequestCycleListener methods -----------------------------------
-
- /**
- * React to an uncaught Exception by redirecting the browser to
- * the unauthorized page or login page if appropriate. This method will automatically be
- * called by Wicket if this plugin was installed by the standard {@link #install install()}
- * mechanism, via the {@link IRequestCycleListener} system.
- * This allows uncaught Shiro exceptions thrown by the backend to be
- * handled gracefully by the Wicket layer.
- * <p>
- * If the exception is a Shiro {@link AuthorizationException}, redirect
- * to the unauthorized page or login page depending on the type of error.
- * If the exception is not a Shiro {@link AuthorizationException}
- * return {@code null}.
- *
- * @param cycle The current request cycle, as provided by Wicket.
- *
- * @param error The exception to handle. If it is not a subclass of
- * Shiro's {@link AuthorizationException}, this method will
- * not have any effect.
- *
- * @return A {@link RenderPageRequestHandler} redirect to the login
- * page if the error is due to the user being
- * <em>unauthenticated</em>;
- * {@link RenderPageRequestHandler} to render the unauthorized page
- * if the error is due to the user being
- * <em>unauthorized</em>.
- */
- @Override
- public IRequestHandler onException(RequestCycle cycle, Exception error)
- {
- Class<? extends Page> respondWithPage = null;
- RedirectPolicy redirectPolicy = RedirectPolicy.NEVER_REDIRECT;
-
- if(error instanceof AuthorizationException)
- {
- AuthorizationException ae = (AuthorizationException) error;
- if(authenticationNeeded(ae))
- {
- if(loginPage != null)
- {
- onLoginRequired();
-
- // Create a RestartResponseAtInterceptPageException to set the intercept,
- // even though we don't throw the exception. (The magic happens in the
- // RestartResponseAtInterceptPageException constructor.)
- new RestartResponseAtInterceptPageException(loginPage);
- respondWithPage = loginPage;
- redirectPolicy = RedirectPolicy.ALWAYS_REDIRECT;
- }
- }
- else
- {
- onUnauthorized();
-
- if(this.unauthorizedRedirect || (
- cycle.getRequest() instanceof WebRequest &&
- ((WebRequest) cycle.getRequest()).isAjax()))
- {
- redirectPolicy = RedirectPolicy.ALWAYS_REDIRECT;
- }
- respondWithPage = getUnauthorizedPage();
- }
- }
- if(respondWithPage != null)
- {
- return new RenderPageRequestHandler(new PageProvider(respondWithPage), redirectPolicy);
- }
- return null;
- }
-
- // End IRequestCycleListener methods -------------------------------------
-
- // Start IUnauthorizedComponentInstantiationListener methods -------------
-
- /**
- * Determine what caused the unauthorized instantiation of the given
- * component. If access was denied due to being unauthenticated, and
- * the login page specified in the constructor was not {@code null},
- * call {@link #onLoginRequired} and redirect to the login page.
- * <p>
- * Otherwise, access was denied due to authorization failure (e.g. insufficient privileges),
- * call {@link #onUnauthorized} and render the unauthorized page (which is the home page by
- * default).
- *
- * @param component The component that failed to initialize due to
- * authorization or authentication failure
- *
- * @throws {@link ResetResponseException} to render the login page or unauthorized page
- *
- * @throws UnauthorizedInstantiationException the login page
- * has not been configured (i.e. is {@code null})
- */
- @Override
- public void onUnauthorizedInstantiation(Component component)
- {
- AuthorizationException cause;
- RequestCycle rc = RequestCycle.get();
- cause = rc.getMetaData(EXCEPTION_KEY);
-
- // Show appropriate login or error page if possible
- IRequestHandler handler = onException(rc, cause);
- if(handler != null)
- {
- throw new ResetResponseException(handler) {};
- }
-
- // Otherwise bubble up the error
- UnauthorizedInstantiationException ex;
- ex = new UnauthorizedInstantiationException(component.getClass());
- ex.initCause(cause);
- throw ex;
- }
-
- // End IUnauthorizedComponentInstantiationListener methods ---------------
-
- // Start IAuthorizationStrategy methods ----------------------------------
-
- /**
- * Performs authorization checks for the {@link Component#RENDER RENDER}
- * action only. Other actions are always allowed.
- * <p>
- * If the action is {@code RENDER}, the component class <em>and its
- * superclasses</em> are checked for the presence of
- * {@link org.apache.shiro.authz.annotation Shiro annotations}.
- * <p>
- * The absence of any Shiro annotation means that the component may be
- * rendered, and {@code true} is returned. Otherwise, each annotation is
- * evaluated against the current Shiro Subject. If any of the requirements
- * dictated by the annotations fail, {@code false} is returned and
- * rendering for the component will be skipped.
- * <p>
- * For example, this link will be hidden if the user is already
- * authenticated:
- * <pre class="example">
- * &#064;RequiresGuest
- * public class LoginLink extends StatelessLink
- * {
- * ...
- * }</pre>
- */
- @Override
- public boolean isActionAuthorized(Component component, Action action)
- {
- if(Component.RENDER.equals(action))
- {
- try
- {
- assertAuthorized(component.getClass());
- }
- catch(AuthorizationException ae)
- {
- return false;
- }
- }
- return true;
- }
-
- /**
- * If {@code componentClass} is a subclass of {@link Page},
- * return {@code true} or {@code false} based on evaluation of any
- * {@link org.apache.shiro.authz.annotation Shiro annotations}
- * that are present on the page class declaration, <em>plus any annotations
- * present on its superclasses</em>.
- * <p>
- * The absence of any Shiro annotation means that the page can always be
- * instantiated, meaning {@code true} will always be returned. Otherwise,
- * each annotation is evaluated against the current Shiro Subject. If any
- * of the requirements dictated by the annotations fail, {@code false} will
- * be returned and instantiation will be denied.
- * <p>
- * For example, this page may only be instantiated if the user has
- * explictly authenticated (i.e. not just "remembered" via cookie) and
- * additionally has the "admin" role:
- * <pre class="example">
- * &#064;RequiresAuthentication
- * &#064;RequiresRoles("admin")
- * public class TopSecretPage extends WebPage
- * {
- * ...
- * }</pre>
- * If {@code componentClass} is not a subclass of Page, always return
- * {@code true}. Non-page components may always be instantiated; however
- * their rendering can be controlled via annotations. See
- * {@link #isActionAuthorized isActionAuthorized()}.
- */
- @Override
- public <T extends IRequestableComponent> boolean isInstantiationAuthorized(
- Class<T> componentClass)
- {
- if(Page.class.isAssignableFrom(componentClass))
- {
- try
- {
- assertAuthorized(componentClass);
- }
- catch(AuthorizationException ae)
- {
- // Store exception for use later in the request by onUnauthorizedInstantiation()
- RequestCycle.get().setMetaData(EXCEPTION_KEY, ae);
- return false;
- }
- }
- return true;
- }
-
- // End IAuthorizationStrategy methods ------------------------------------
-
- /**
- * Looks up a localized string from the application properties.
- */
- protected String getLocalizedMessage(String key, String theDefault)
- {
- return Application.get().getResourceSettings().getLocalizer().getString(
- key,
- null,
- null,
- theDefault);
- }
-
- /**
- * Returns {@code true} if the reason the user was denied access is
- * because she needs to authenticate.
- */
- protected boolean authenticationNeeded(AuthorizationException cause)
- {
- // IMPLEMENTATION NOTE - A simple solution would be:
- // return ! SecurityUtils.getSubject().isAuthenticated();
- // In other words, the user needs to authenticate if she is not
- // already logged in (this is how it is done in Wicket auth-roles).
- // However this does not take into account the subtle difference in
- // Shiro between "authenticated" and "remembered" states. To ensure the
- // correct behavior we have to inspect the actual exception to see what
- // action to take.
-
- boolean needLogin = false;
-
- // Check if Shiro blocked access due to authentication
- if(cause instanceof UnauthenticatedException)
- {
- needLogin = true;
-
- // But... there is a rare case where Shiro can throw an
- // UnauthenticatedException even when the user is already logged
- // in. If the user is logged in and the page was annotated with
- // @RequiresGuest, Shiro throws an UnauthenticatedException, which
- // which is very misleading. Our only way to detect this scenario
- // is to parse the exception message. Yes, this is a hack.
-
- String msg = cause.getMessage();
- String guestError = "Attempting to perform a guest-only operation.";
- if(msg != null && msg.startsWith(guestError))
- {
- needLogin = false;
- }
- }
- return needLogin;
- }
-
- /**
- * @throws AuthorizationException if the given class, or any of its
- * superclasses, has a Shiro annotation that fails its
- * authorization check.
- */
- private void assertAuthorized(final Class<?> cls)
- throws AuthorizationException
- {
- Collection<Annotation> annotations = findAnnotations(cls);
- for(Annotation annot : annotations)
- {
- for(AuthorizingAnnotationHandler h : HANDLERS)
- {
- h.assertAuthorized(annot);
- }
- }
- }
-
- /**
- * Returns all annotations present on the given class and all of its
- * superclasses.
- */
- private Collection<Annotation> findAnnotations(final Class<?> cls)
- {
- List<Annotation> annots = new ArrayList<Annotation>(5);
- Class<?> currClass = cls;
- while(currClass != null)
- {
- annots.addAll(Arrays.asList(currClass.getDeclaredAnnotations()));
- currClass = currClass.getSuperclass();
- }
- return annots;
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Classes.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Classes.java
deleted file mode 100644
index 764cc38ec4..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Classes.java
+++ /dev/null
@@ -1,338 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-
-/**
- * Utilities for working with {@link Class}es and reflection.
- */
-public class Classes {
-
- /**
- * Creates a new instance of the given {@link Class}, using the given arguments.
- * <p/>
- * A new instance object of the given {@link Class} is created, using reflection, providing the
- * given arguments to the constructor.
- *
- * @param clazz the {@link Class} of the object to instantiate.
- * @param args the arguments to pass to the constructor, if any.
- * @param <T> the type of the {@link Class} to return.
- * @return a new instance of the given {@link Class}, constructed using the given <i>args</i>.
- *
- * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can
- * be applied to the given arguments.
- * @throws IllegalAccessException if the appropriate constructor is inaccessible.
- * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an
- * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,
- * a parameter value cannot be converted to the corresponding formal parameter type by a
- * method invocation conversion; if this constructor pertains to an enum type.
- * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an
- * <i>interface</i>, an array or doesn't define a nullary constructor.
- * @throws InvocationTargetException if the underlying constructor throws an exception.
- * @throws ExceptionInInitializerError if the initialization provoked by this method fails.
- */
- public static <T> T newInstance(final Class<T> clazz, final Object... args)
- throws NoSuchMethodException, InstantiationException, IllegalAccessException,
- InvocationTargetException {
- return getApplicableConstructor(clazz, Classes.of(args)).newInstance(args);
- }
-
- /**
- * Creates a new instance of the same {@link Class} as the given <i>template</i>, using the given
- * constructor arguments.
- * <p/>
- * Given an object of type <code>T</code>, a new instance of {@link Class<T>} will be created,
- * passing the given <i>args</i> to the constructor.
- *
- * @param template an object that provides the {@link Class} to instantiate.
- * @param args the arguments to pass to the constructor, if any.
- * @param <T> the type of the object to return
- * @return a new instance of the same {@link Class} as <i>template</i>, constructed using the
- * given <i>args</i>.
- *
- * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can
- * be applied to the given arguments.
- * @throws IllegalAccessException if the appropriate constructor is inaccessible.
- * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an
- * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,
- * a parameter value cannot be converted to the corresponding formal parameter type by a
- * method invocation conversion; if this constructor pertains to an enum type.
- * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an
- * <i>interface</i>, an array or doesn't define a nullary constructor.
- * @throws InvocationTargetException if the underlying constructor throws an exception.
- * @throws ExceptionInInitializerError if the initialization provoked by this method fails.
- */
- @SuppressWarnings("unchecked")
- public static <T> T newInstanceFrom(final T template, final Object... args)
- throws NoSuchMethodException, InstantiationException, IllegalAccessException,
- InvocationTargetException {
- return newInstance(((Class<? extends T>) template.getClass()), args);
- }
-
- /**
- * Creates a new instance of the given {@link Class}, using the given arguments, ignoring
- * visibility.
- * <p/>
- * A new instance object of the given {@link Class} is created, using reflection, providing the
- * given arguments to the constructor.
- * <p/>
- * The visibility of the {@link Constructor} defined by the arguments is ignored and a new
- * instance created irrespective of the defined visibility. This is potentially dangerous, as the
- * API likely makes no guarantee as to the behaviour when instantiating from a non-public
- * constructor.
- *
- * @param clazz the {@link Class} of the object to instantiate.
- * @param args the arguments to pass to the constructor, if any.
- * @param <T> the type of the {@link Class} to return.
- * @return a new instance of the given {@link Class}, constructed using the given <i>args</i>.
- *
- * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can
- * be applied to the given arguments.
- * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an
- * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,
- * a parameter value cannot be converted to the corresponding formal parameter type by a
- * method invocation conversion; if this constructor pertains to an enum type.
- * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an
- * <i>interface</i>, an array or doesn't define a nullary constructor.
- * @throws InvocationTargetException if the underlying constructor throws an exception.
- * @throws ExceptionInInitializerError if the initialization provoked by this method fails.
- */
- public static <T> T unsafeNewInstance(final Class<T> clazz, final Object... args)
- throws NoSuchMethodException, InstantiationException, InvocationTargetException {
- final Constructor<T> constructor = getApplicableConstructor(clazz, Classes.of(args));
- constructor.setAccessible(true);
- try {
- return constructor.newInstance(args);
- } catch (final IllegalAccessException e) {
- throw new AssertionError("IllegalAccessError while instantiating " + clazz
- + " with access controls disabled");
- }
- }
-
- /**
- * Creates a new instance of the same {@link Class} as the given <i>template</i>, using the given
- * constructor arguments and ignoring visibility.
- * <p/>
- * Given an object of type <code>T</code>, a new instance of {@link Class<T>} will be created,
- * passing the given <i>args</i> to the constructor.
- * <p/>
- * The visibility of the {@link Constructor} defined by the arguments is ignored and a new
- * instance created irrespective of the defined visibility. This is potentially dangerous, as the
- * API likely makes no guarantee as to the behaviour when instantiating from a non-public
- * constructor.
- *
- * @param template an object that provides the {@link Class} to instantiate.
- * @param args the arguments to pass to the constructor, if any.
- * @param <T> the type of the object to return
- * @return a new instance of the same {@link Class} as <i>template</i>, constructed using the
- * given <i>args</i>.
- *
- * @throws NoSuchMethodException if the given {@link Class} doesn't provide a constructor that can
- * be applied to the given arguments.
- * @throws IllegalArgumentException if the number of actual and formal parameters differ; if an
- * unwrapping conversion for primitive arguments fails; or if, after possible unwrapping,
- * a parameter value cannot be converted to the corresponding formal parameter type by a
- * method invocation conversion; if this constructor pertains to an enum type.
- * @throws InstantiationException if the given {@link Class} is <i>abstract</i>, an
- * <i>interface</i>, an array or doesn't define a nullary constructor.
- * @throws InvocationTargetException if the underlying constructor throws an exception.
- * @throws ExceptionInInitializerError if the initialization provoked by this method fails.
- */
- @SuppressWarnings("unchecked")
- public static <T> T unsafeNewInstanceFrom(final T template, final Object... args)
- throws NoSuchMethodException, InstantiationException, InvocationTargetException {
- return unsafeNewInstance((Class<? extends T>) template.getClass(), args);
- }
-
- /**
- * Gets the {@link Class} for multiple objects.
- * <p/>
- * The resulting array of {@link Class} objects that are ordered in parallel with the argument
- * list that produced it. This is especially useful for getting a {@link Constructor} for a given
- * set of arguments:
- * <p/>
- * <code>
- * clazz.getConstructor(Classes.of("abc", 123));
- * </code>
- *
- * @param arguments the objects to generate {@link Class}es for
- * @return an array of {@link Class} objects, in the same order as the argument list
- */
- @SuppressWarnings("rawtypes")
- public static Class[] of(final Object... arguments) {
- final Object[] args = resolveVarArgs(arguments);
- final Class[] classes = new Class[args.length];
- for (int i = 0; i < args.length; i++) {
- classes[i] = args[i] == null ? Null.class : args[i].getClass();
- }
- return classes;
- }
-
- /**
- * Ensures a variable argument list has been properly passed.
- * <p/>
- * Sometimes, you want to pass a single array-typed argument to a method that accepts variable
- * arguments. In these situations, that array will be unwrapped in to a list of multiple
- * arguments, instead of a single argument that is an array.
- * <p/>
- * Example: <code>
- * Classes.of(TableNotFoundException.class, tableName.getBytes());
- * </code>
- * <p/>
- * Resolving will differentiate a variable argument list from a single argument of the following
- * types:
- * <ul>
- * <li>All primitive array types: e.g. <i>byte[]</i>, <i>int[]</i>, <i>boolean[]</i>, etc.</li>
- * <li>Arrays of reference types that are not <i>Object</i>: e.g. <i>String[]</i>,
- * <i>java.lang.Integer[]</i>, <i>Class[]</i>; but <i>not</i> <i>Object[]</i></li>
- * </ul>
- * An argument of type <i>Object[]</i> is considered to be a variable list of arguments, each with
- * their own distinct type.
- *
- * @param args the argument list to resolve
- * @return the argument list, wrapped to protect single array-typed arguments
- */
- public static Object[] resolveVarArgs(final Object... args) {
- return args != null && args.getClass() == Object[].class ? args : new Object[] {args};
- }
-
- /**
- * Gets a {@link Constructor} from the given {@link Class} that is applicable to the given
- * arguments.
- * <p/>
- * If the types of the given arguments are not an exact match for any declared {@link Constructor}
- * s, a Constructor that will accept the arguments (e.g. because they are sub-types of the
- * parameters) will be searched for.
- * <p/>
- * If the given {@link Class} has no {@link Constructor} that is applicable to the given
- * arguments, a {@link NoSuchMethodException} will be thrown.
- * <p/>
- * No guarantees are made about the visibility of the {@link Constructor} returned; it may not be
- * accessible from the calling scope.
- *
- * @param clazz the {@link Class} to search for a {@link Constructor} for.
- * @param args the types the {@link Constructor} must be applicable to.
- * @param <T> the type of the objects instantiated by the {@link Constructor}.
- * @return a {@link Constructor} that is applicable to the given arguments for constructing
- * objects of type {@link T}.
- * @throws NoSuchMethodException if no {@link Constructor} is found that is applicable to the
- * given arguments.
- */
- @SuppressWarnings({"unchecked", "rawtypes"})
- public static <T> Constructor<T> getApplicableConstructor(final Class<T> clazz,
- final Class... args) throws NoSuchMethodException {
- final Constructor[] constructors = clazz.getDeclaredConstructors();
- for (final Constructor<T> constructor : constructors) {
- if (isAssignableFrom(constructor.getParameterTypes(), args)) {
- return constructor;
- }
- }
- throw new NoSuchMethodException(String.format(
- "No applicable constructor for %s found for argument types: %s", clazz.getName(),
- Arrays.toString(args)));
- }
-
- /**
- * Gets the {@link Method} of the given name from the given {@link Class} that is applicable to
- * the given argument types.
- * <p/>
- * If the types of the given arguments are not an exact match for any declared {@link Method}s, a
- * {@link Method} that will accept the arguments (e.g. because they are sub-types of the
- * parameters) will be searched for.
- * <p/>
- * If the given {@link Class} has no {@link Method} with the given name that is applicable to the
- * given arguments, a {@link NoSuchMethodException} will be thrown.
- * <p/>
- * No guarantees are made about the visibility of the {@link Method} returned; it may not be
- * accessible from the calling scope. Similarly, the {@link Method} may be static or may be an
- * instance method.
- *
- * @param clazz the {@link Class} to get the {@link Method} from.
- * @param name the name of the {@link Method} to get.
- * @param args the types the {@link Method} must be applicable to.
- * @return a {@link Method} of the given name from the given {@link Class} that is applicable to
- * the given arguments.
- * @throws NoSuchMethodException if no {@link Method} is found that is applicable to the given
- * arguments.
- */
- @SuppressWarnings("rawtypes")
- public static Method getApplicableMethod(final Class clazz, final String name,
- final Class... args) throws NoSuchMethodException {
- final Method[] methods = clazz.getDeclaredMethods();
- for (final Method m : methods) {
- if (m.getName().equals(name) && isAssignableFrom(m.getParameterTypes(), args)) {
- return m;
- }
- }
- throw new NoSuchMethodException(String.format(
- "No applicable method overload %s#%s found for argument types: %s", clazz.getName(), name,
- Arrays.toString(args)));
- }
-
- /**
- * Determines if the {@link Class}s for the given target types can be assigned to from the types
- * represented by the given source {@link Class}s.
- * <p/>
- * Each target type will be matched up with the corresponding source type. If the length of the
- * two arrays differ, they are considered not assignable.
- *
- * @param targets the {@link Class}s representing the types to assign to.
- * @param sources the {@link Class}s representing the types to assign from.
- * @return true if all source {@link Class}es represent a type that can be assigned to their
- * corresponding target {@link Class}.
- */
- @SuppressWarnings("rawtypes")
- public static boolean isAssignableFrom(final Class[] targets, final Class[] sources) {
- // must have same number of types
- if (sources.length != targets.length) {
- return false;
- }
-
- // quick check for exact matches
- if (Arrays.equals(sources, targets)) {
- return true;
- }
-
- // check if each source type can be assigned to each target type
- for (int i = 0; i < targets.length; i++) {
- if (!isAssignableFrom(targets[i], sources[i])) {
- return false;
- }
- }
-
- return true;
- }
-
- /***
- * Determines if the given source {@link Class} represents a type that can be assigned to the
- * given target {@link Class}.
- * <p/>
- * If the source {@link Class} represents null (via {@link Null}), it can be assigned to any
- * {@link Class} that represents a reference type.
- *
- * @param target the {@link Class} of the type to assign to.
- * @param source the {@link Class} of the type to assign from.
- * @return true if the source {@link Class} represents a type that can be assigned to the type
- * represented by the target {@link Class}.
- */
- public static boolean isAssignableFrom(final Class<?> target, final Class<?> source) {
- if (target.equals(Null.class)) {
- throw new NullPointerException("target for type assignment may not be the null type");
- }
-
- return Primitives.isPrimitive(target) ? Primitives.isAssignableFrom(target, source) : source
- .equals(Null.class) || target.isAssignableFrom(source);
- }
-
- /**
- * A placeholder Null type.
- * <p/>
- * This Null type provides a means to get a {@link Class} for null values. This should never be
- * used except for special-casing nulls.
- */
- static class Null {
- private Null() {}
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/CookieUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/CookieUtils.java
deleted file mode 100644
index cf70a651fb..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/CookieUtils.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Cookie utility class for dealing with cookies
- * <p/>
- * Includes code from Jive 1.2.4 (released under the Apache license)
- */
-public final class CookieUtils {
- private static final Logger log = LoggerFactory.getLogger(CookieUtils.class);
-
-
- // Character used to separate username and password in persistent cookies.
- // 0x13 == "Device Control 3" non-printing ASCII char. Unlikely to appear in a username
- private static final char DELIMITER = 0x13;
-
- // "Tweakable" parameters for the cookie encoding. NOTE: changing these
- // and recompiling this class will essentially invalidate old cookies.
- private final static int ENCODE_XORMASK = 0x5A;
- private final static char ENCODE_CHAR_OFFSET1 = 'C';
- private final static char ENCODE_CHAR_OFFSET2 = 'i';
-
- /**
- * Invalidate the specified cookie and delete it from the response object.
- *
- * @param response The HttpServletResponse object, known as "response" in a JSP page.
- * @param cookieName The name of the cookie you want to delete.
- * @param path of the path the cookie you want to delete.
- */
- public static void invalidateCookie(HttpServletRequest request, HttpServletResponse response,
- String cookieName, String path) {
- log.debug("CookieUtils.invalidateCookie " + cookieName + " for path " + path);
- setCookie(request, response, cookieName, null, 0, path);
- }
-
- /**
- * Invalidate the specified cookie and delete it from the response object. Deletes only cookies
- * mapped against the root "/" path. Otherwise use
- * {@link #invalidateCookie(HttpServletRequest, HttpServletResponse, String, String)}
- *
- * @param response The HttpServletResponse object, known as "response" in a JSP page.
- * @param cookieName The name of the cookie you want to delete.
- * @see #invalidateCookie(HttpServletRequest, HttpServletResponse, String, String)
- */
- public static void invalidateCookie(HttpServletRequest request, HttpServletResponse response,
- String cookieName) {
- invalidateCookie(request, response, cookieName, "/");
- }
-
- /**
- * Returns the specified Cookie object, or null if the cookie does not exist.
- *
- * @param request The HttpServletRequest object, known as "request" in a JSP page.
- * @param name the name of the cookie.
- * @return the Cookie object if it exists, otherwise null.
- */
- public static Cookie getCookie(HttpServletRequest request, String name) {
- Cookie cookies[] = request.getCookies();
- if (cookies == null || name == null || name.length() == 0) {
- return null;
- }
- // Otherwise, we have to do a linear scan for the cookie.
- for (int i = 0; i < cookies.length; i++) {
- if (cookies[i].getName().equals(name)) {
- return cookies[i];
- }
- }
- return null;
- }
-
- /**
- * Sets a cookie
- * <p/>
- * This will also put the cookie in a list of cookies to send with this request's response (so
- * that in case of a redirect occurring down the chain, the first filter will always try to set
- * this cookie again)
- */
- public static Cookie setCookie(HttpServletRequest request, HttpServletResponse response,
- String name, String value, int maxAge, String path) {
- log.debug("CookieUtils.setCookie " + name + ":" + value);
- Cookie cookie = new Cookie(name, value);
- cookie.setMaxAge(maxAge);
- cookie.setPath(path);
- response.addCookie(cookie);
-
- return cookie;
- }
-
- /**
- * Returns the value of the specified cookie as a String. If the cookie does not exist, the method
- * returns null.
- *
- * @param request the HttpServletRequest object, known as "request" in a JSP page.
- * @param name the name of the cookie
- * @return the value of the cookie, or null if the cookie does not exist.
- */
- public static String getCookieValue(HttpServletRequest request, String name) {
- Cookie cookie = getCookie(request, name);
- if (cookie != null) {
- return cookie.getValue();
- }
- return null;
- }
-
- /**
- * Builds a cookie string containing a username and password.
- * <p>
- * <p/>
- * Note: with open source this is not really secure, but it prevents users from snooping the
- * cookie file of others and by changing the XOR mask and character offsets, you can easily tweak
- * results.
- *
- * @param username The username.
- * @param password The password.
- * @return String encoding the input parameters, an empty string if one of the arguments equals
- * <code>null</code>.
- */
- public static String encodePasswordCookie(String username, String password) {
- return encodePasswordCookie(username, password, new String(new char[] {DELIMITER,
- ENCODE_CHAR_OFFSET1, ENCODE_CHAR_OFFSET2}));
- }
-
- /**
- * Builds a cookie string containing a username and password, using offsets to customise the
- * encoding.
- * <p>
- * <p/>
- * Note: with open source this is not really secure, but it prevents users from snooping the
- * cookie file of others and by changing the XOR mask and character offsets, you can easily tweak
- * results.
- *
- * @param username The username.
- * @param password The password.
- * @param encoding A String used to customise cookie encoding (only the first 3 characters are
- * used)
- * @return String encoding the input parameters, an empty string if one of the arguments equals
- * <code>null</code>.
- */
- public static String encodePasswordCookie(String username, String password, String encoding) {
- StringBuffer buf = new StringBuffer();
- if (username != null && password != null) {
- char offset1 =
- (encoding != null && encoding.length() > 1) ? encoding.charAt(1) : ENCODE_CHAR_OFFSET1;
- char offset2 =
- (encoding != null && encoding.length() > 2) ? encoding.charAt(2) : ENCODE_CHAR_OFFSET2;
-
- byte[] bytes = (username + DELIMITER + password).getBytes();
- int b;
-
- for (int n = 0; n < bytes.length; n++) {
- b = bytes[n] ^ (ENCODE_XORMASK + n);
- buf.append((char) (offset1 + (b & 0x0F)));
- buf.append((char) (offset2 + ((b >> 4) & 0x0F)));
- }
- }
- return buf.toString();
- }
-
- /**
- * Decodes a cookie string containing a username and password.
- *
- * @param cookieVal The cookie value.
- * @return String[] containing the username at index 0 and the password at index 1, or
- * <code>{ null, null }</code> if cookieVal equals <code>null</code> or the empty string.
- */
- public static String[] decodePasswordCookie(String cookieVal) {
- return decodePasswordCookie(cookieVal, new String(new char[] {DELIMITER, ENCODE_CHAR_OFFSET1,
- ENCODE_CHAR_OFFSET2}));
- }
-
- /**
- * Decodes a cookie string containing a username and password.
- *
- * @param cookieVal The cookie value.
- * @param encoding A String used to customise cookie encoding (only the first 3 characters are
- * used) - should be the same string you used to encode the cookie!
- * @return String[] containing the username at index 0 and the password at index 1, or
- * <code>{ null, null }</code> if cookieVal equals <code>null</code> or the empty string.
- */
- public static String[] decodePasswordCookie(String cookieVal, String encoding) {
- // check that the cookie value isn't null or zero-length
- if (cookieVal == null || cookieVal.length() <= 0) {
- return null;
- }
-
- char offset1 =
- (encoding != null && encoding.length() > 1) ? encoding.charAt(1) : ENCODE_CHAR_OFFSET1;
- char offset2 =
- (encoding != null && encoding.length() > 2) ? encoding.charAt(2) : ENCODE_CHAR_OFFSET2;
-
- // decode the cookie value
- char[] chars = cookieVal.toCharArray();
- byte[] bytes = new byte[chars.length / 2];
- int b;
- for (int n = 0, m = 0; n < bytes.length; n++) {
- b = chars[m++] - offset1;
- b |= (chars[m++] - offset2) << 4;
- bytes[n] = (byte) (b ^ (ENCODE_XORMASK + n));
- }
- cookieVal = new String(bytes);
- int pos = cookieVal.indexOf(DELIMITER);
- String username = (pos < 0) ? "" : cookieVal.substring(0, pos);
- String password = (pos < 0) ? "" : cookieVal.substring(pos + 1);
-
- return new String[] {username, password};
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/DateUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/DateUtils.java
index c92cbe4b49..e2285cc76b 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/DateUtils.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/DateUtils.java
@@ -1,121 +1,17 @@
package com.pmease.gitplex.web.util;
-import java.util.Calendar;
import java.util.Date;
-import org.apache.commons.lang3.time.DurationFormatUtils;
import org.joda.time.DateTime;
-import org.joda.time.DateTimeConstants;
-import org.joda.time.DateTimeZone;
-import org.joda.time.Days;
-import org.joda.time.Duration;
-import org.joda.time.Hours;
-import org.joda.time.Period;
-import org.joda.time.PeriodType;
-import org.joda.time.chrono.ISOChronology;
import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.PeriodFormatter;
-import org.joda.time.format.PeriodFormatterBuilder;
import org.ocpsoft.prettytime.PrettyTime;
-import com.google.common.base.Preconditions;
import com.pmease.gitplex.web.Constants;
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
- public static final String AGE = "age";
-
- static enum DurationUnit {
- YEAR, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND
- }
-
- static String formatAge(DateTime dtBefore, DateTime dtNow) {
- return formatAge(dtBefore, dtNow, Constants.DATETIME_FORMAT);
- }
-
- static String formatAge(DateTime dtBefore, DateTime dtNow,
- String fullDateFormat) {
- Preconditions.checkArgument(dtBefore != null && dtNow != null);
-
- Period period = new Period(dtBefore, dtNow);
-
- int years = period.getYears();
- int months = period.getMonths();
- int weeks = period.getWeeks();
- int days = Days.daysBetween(dtBefore.toDateMidnight(),
- dtNow.toDateMidnight()).getDays();
-
-// if (years > 0 || months > 0 || weeks > 0 || days > 6) {
-// return DateUtils.formatDate(dtBefore.toDate(), fullDateFormat);
-// }
-
- if (years > 0) {
- return formatDurationPart(years, DurationUnit.YEAR);
- }
-
- if (months > 0) {
- return formatDurationPart(months, DurationUnit.MONTH);
- }
-
- if (weeks > 0 && weeks * 7 >= days) {
- return formatDurationPart(weeks, DurationUnit.WEEK);
- }
-
- if (days > 1) {
- return formatDurationPart(days, DurationUnit.DAY);
- }
-
- // acutal hours
- int hours = Hours.hoursBetween(
- dtBefore.hourOfDay().roundHalfFloorCopy(),
- dtNow.hourOfDay().roundHalfFloorCopy()).getHours();
-
- if ((hours >= DateTimeConstants.HOURS_PER_DAY)
- || (days == 1 && hours > 12)) {
- return formatDurationPart(days, DurationUnit.DAY);
- }
-
- if (hours > 0) {
- return formatDurationPart(hours, DurationUnit.HOUR);
- }
-
- int minutes = period.getMinutes();
- if (minutes > 0) {
- return formatDurationPart(minutes, DurationUnit.MINUTE);
- }
- return formatDurationPart(period.getSeconds(), DurationUnit.SECOND);
- }
-
- private static String formatDurationPart(int dur, DurationUnit unit) {
- if (unit == DurationUnit.SECOND && dur < 30) { // < 30 seconds
- return "just now";
- }
-
- StringBuffer sb = new StringBuffer();
-
- if (dur == 1) {
- if (unit == DurationUnit.HOUR) {
- sb.append("an");
- } else {
- sb.append("a");
- }
- } else {
- sb.append(dur);
- }
-
- sb.append(" ").append(unit.name().toLowerCase());
-
- if (dur > 1) {
- sb.append("s");
- }
- sb.append(" ago");
-
- return sb.toString();
- }
-
public static String formatAge(Date date) {
return new PrettyTime().format(date);
-// return formatAge(new DateTime(date), DateTime.now());
}
public static String formatDate(Date date) {
@@ -127,68 +23,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
public static String formatDate(Date date, String pattern) {
- return DateTimeFormat.forPattern(pattern)
- .withZone(DateTimeZone.UTC)
- .print(new DateTime(date));
+ return DateTimeFormat.forPattern(pattern).print(new DateTime(date));
}
- public static String formatDuration(long durationMillis) {
- if (durationMillis < 1000) {
- return durationMillis + " ms";
- } else {
- return DurationFormatUtils.formatDurationWords(durationMillis,
- true, true);
- }
- }
-
- public static String formatDurationShortWords(long durationMills) {
- if (durationMills < DateTimeConstants.MILLIS_PER_SECOND) {
- return durationMills + " ms";
- } else {
- Duration duration = new Duration(durationMills);
- return shortWordFormatter.print(duration.toPeriod(
- PeriodType.yearMonthDayTime(),
- ISOChronology.getInstanceUTC()));
- }
- }
-
- public static boolean isSameDay(Date d1, Date d2) {
- Calendar cal1 = Calendar.getInstance(DateTimeZone.UTC.toTimeZone());
- Calendar cal2 = Calendar.getInstance(DateTimeZone.UTC.toTimeZone());
- cal1.setTime(d1);
- cal2.setTime(d2);
-
- return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
- && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH)
- && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR);
- }
-
- public static void main(String[] argv) {
- Calendar cal = Calendar.getInstance();
- cal.set(Calendar.YEAR, 2012);
- cal.set(Calendar.MONTH, 9); // Oct.
- cal.set(Calendar.DAY_OF_MONTH, 21);
- cal.set(Calendar.HOUR_OF_DAY, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- cal.setTimeZone(DateTimeZone.forID("America/Sao_Paulo").toTimeZone());
- DateTime dt = new DateTime(cal);
- try {
- dt.withMillisOfDay(0);
- } catch (IllegalArgumentException e) {
- // Illegal instant due to time zone offset transition
- e.printStackTrace();
- }
-
- System.out.println(dt.toDateMidnight());
- }
-
- static PeriodFormatter shortWordFormatter = new PeriodFormatterBuilder()
- .appendDays().appendSuffix("d").appendSeparator(", ").appendHours()
- .appendSuffix("h").appendSeparator(":").appendMinutes()
- .appendSuffix("m").appendSeparator(":").appendSeconds()
- .appendSuffix("s")
- // .appendSeparator(", ")
- // .appendMillis()
- .toFormatter();
}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/EnumUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/EnumUtils.java
deleted file mode 100644
index 9235b9676a..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/EnumUtils.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-public class EnumUtils {
-
- private EnumUtils() {
- }
-
- public static <T extends Enum<T>> T inc(Enum<T> v) {
- Class<T> clazz = v.getDeclaringClass();
- return inc(v, clazz.getEnumConstants()[clazz.getEnumConstants().length - 1]);
- }
-
- public static <T extends Enum<T>> T inc(Enum<T> v, T max) {
- Class<T> clazz = v.getDeclaringClass();
- if (v.ordinal() + 1 >= clazz.getEnumConstants().length - 1) {
- return max;
- }
-
- int ordinal = (v.ordinal() + 1) % clazz.getEnumConstants().length;
- return clazz.getEnumConstants()[ordinal];
- }
-
- public static <T extends Enum<T>> T dec(Enum<T> v) {
- int ordinal = Math.max(v.ordinal() - 1, 0);
- return v.getDeclaringClass().getEnumConstants()[ordinal];
- }
-
- public static <T extends Enum<T>> List<T> toList(Class<T> clazz) {
- return ImmutableList.<T>copyOf(clazz.getEnumConstants());
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Generics.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Generics.java
deleted file mode 100644
index 990e1cd468..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Generics.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-
-/**
- * Copied from dropwizard-util
- * @author zhenyu
- *
- * Helper methods for class type parameters.
- * @see <a href="http://gafter.blogspot.com/2006/12/super-type-tokens.html">Super Type Tokens</a>
- */
-public class Generics {
- private Generics() { /* singleton */ }
-
- /**
- * Finds the type parameter for the given class.
- *
- * @param klass a parameterized class
- * @return the class's type parameter
- */
- public static Class<?> getTypeParameter(Class<?> klass) {
- return getTypeParameter(klass, Object.class);
- }
-
- /**
- * Finds the type parameter for the given class which is assignable to the bound class.
- *
- * @param klass a parameterized class
- * @param bound the type bound
- * @param <T> the type bound
- * @return the class's type parameter
- */
- public static <T> Class<T> getTypeParameter(Class<?> klass, Class<? super T> bound) {
- Type t = checkNotNull(klass);
- while (t instanceof Class<?>) {
- t = ((Class<?>) t).getGenericSuperclass();
- }
- /* This is not guaranteed to work for all cases with convoluted piping
- * of type parameters: but it can at least resolve straight-forward
- * extension with single type parameter (as per [Issue-89]).
- * And when it fails to do that, will indicate with specific exception.
- */
- if (t instanceof ParameterizedType) {
- // should typically have one of type parameters (first one) that matches:
- for (Type param : ((ParameterizedType) t).getActualTypeArguments()) {
- if (param instanceof Class<?>) {
- final Class<T> cls = determineClass(bound, param);
- if (cls != null) { return cls; }
- }
- else if (param instanceof TypeVariable) {
- for (Type paramBound : ((TypeVariable<?>) param).getBounds()) {
- if (paramBound instanceof Class<?>) {
- final Class<T> cls = determineClass(bound, paramBound);
- if (cls != null) { return cls; }
- }
- }
- }
- }
- }
- throw new IllegalStateException("Cannot figure out type parameterization for " + klass.getName());
- }
-
- @SuppressWarnings("unchecked")
- private static <T> Class<T> determineClass(Class<? super T> bound, Type candidate) {
- if (candidate instanceof Class<?>) {
- final Class<?> cls = (Class<?>) candidate;
- if (bound.isAssignableFrom(cls)) {
- return (Class<T>) cls;
- }
- }
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/JnaUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/JnaUtils.java
deleted file mode 100644
index 6e28ed214c..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/JnaUtils.java
+++ /dev/null
@@ -1,365 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.sun.jna.Library;
-import com.sun.jna.Native;
-
-/*
- * Copyright 2013 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Collection of static methods to access native OS library functionality.
- *
- * @author Florian Zschocke
- */
-public class JnaUtils {
- public static final int S_ISUID = 0004000; // set user id on execution
- public static final int S_ISGID = 0002000; // set group id on execution
- public static final int S_ISVTX = 0001000; // sticky bit, save swapped text even after use
-
- public static final int S_IRWXU = 0000700; // RWX mask for owner
- public static final int S_IRUSR = 0000400; // read permission for owner
- public static final int S_IWUSR = 0000200; // write permission for owner
- public static final int S_IXUSR = 0000100; // execute/search permission for owner
- public static final int S_IRWXG = 0000070; // RWX mask for group
- public static final int S_IRGRP = 0000040; // read permission for group
- public static final int S_IWGRP = 0000020; // write permission for group
- public static final int S_IXGRP = 0000010; // execute/search permission for group
- public static final int S_IRWXO = 0000007; // RWX mask for other
- public static final int S_IROTH = 0000004; // read permission for other
- public static final int S_IWOTH = 0000002; // write permission for other
- public static final int S_IXOTH = 0000001; // execute/search permission for other
-
- public static final int S_IFMT = 0170000; // type of file mask
- public static final int S_IFIFO = 0010000; // named pipe (fifo)
- public static final int S_IFCHR = 0020000; // character special device
- public static final int S_IFDIR = 0040000; // directory
- public static final int S_IFBLK = 0060000; // block special device
- public static final int S_IFREG = 0100000; // regular file
- public static final int S_IFLNK = 0120000; // symbolic link
- public static final int S_IFSOCK = 0140000; // socket
-
-
- private static final Logger LOGGER = LoggerFactory.getLogger(JnaUtils.class);
-
- private static UnixCLibrary unixlibc = null;
-
-
- /**
- * Utility method to check if the JVM is running on a Windows OS.
- *
- * @return true, if the system property 'os.name' starts with 'Windows'.
- */
- public static boolean isWindows()
- {
- return System.getProperty("os.name").toLowerCase().startsWith("windows");
- }
-
-
- private interface UnixCLibrary extends Library {
- public int chmod(String path, int mode);
- public int getgid();
- public int getegid();
- }
-
-
- public static int getgid()
- {
- if (isWindows()) {
- throw new UnsupportedOperationException("The method JnaUtils.getgid is not supported under Windows.");
- }
-
- return getUnixCLibrary().getgid();
- }
-
-
- public static int getegid()
- {
- if (isWindows()) {
- throw new UnsupportedOperationException("The method JnaUtils.getegid is not supported under Windows.");
- }
-
- return getUnixCLibrary().getegid();
- }
-
-
- /**
- * Set the permission bits of a file.
- *
- * The permission bits are set to the provided mode. This method is only
- * implemented for OSes of the Unix family and makes use of the 'chmod'
- * function of the native C library. See 'man 2 chmod' for more information.
- *
- * @param path
- * File/directory to set the permission bits for.
- * @param mode
- * A mode created from or'd permission bit masks S_I*
- * @return Upon successful completion, a value of 0 returned. Otherwise, a value of -1 is returned.
- */
- public static int setFilemode(File file, int mode)
- {
- return setFilemode(file.getAbsolutePath(), mode);
- }
-
- /**
- * Set the permission bits of a file.
- *
- * The permission bits are set to the provided mode. This method is only
- * implemented for OSes of the Unix family and makes use of the 'chmod'
- * function of the native C library. See 'man 2 chmod' for more information.
- *
- * @param path
- * Path to a file/directory to set the permission bits for.
- * @param mode
- * A mode created from or'd permission bit masks S_I*
- * @return Upon successful completion, a value of 0 returned. Otherwise, a value of -1 is returned.
- */
- public static int setFilemode(String path, int mode)
- {
- if (isWindows()) {
- throw new UnsupportedOperationException("The method JnaUtils.getFilemode is not supported under Windows.");
- }
-
- return getUnixCLibrary().chmod(path, mode);
- }
-
-
-
- /**
- * Get the file mode bits of a file.
- *
- * This method is only implemented for OSes of the Unix family. It returns the file mode
- * information as available in the st_mode member of the resulting struct stat when calling
- * 'lstat' on a file.
- *
- * @param path
- * File/directory to get the file mode from.
- * @return Upon successful completion, the file mode bits are returned. Otherwise, a value of -1 is returned.
- */
- public static int getFilemode(File path)
- {
- return getFilemode(path.getAbsolutePath());
- }
-
- /**
- * Get the file mode bits of a file.
- *
- * This method is only implemented for OSes of the Unix family. It returns the file mode
- * information as available in the st_mode member of the resulting struct stat when calling
- * 'lstat' on a file.
- *
- * @param path
- * Path to a file/directory to get the file mode from.
- * @return Upon successful completion, the file mode bits are returned. Otherwise, a value of -1 is returned.
- */
- public static int getFilemode(String path)
- {
- if (isWindows()) {
- throw new UnsupportedOperationException("The method JnaUtils.getFilemode is not supported under Windows.");
- }
-
- Filestat stat = getFilestat(path);
- if ( stat == null ) return -1;
- return stat.mode;
- }
-
-
- /**
- * Status information of a file.
- */
- public static class Filestat
- {
- public int mode; // file mode, permissions, type
- public int uid; // user Id of owner
- public int gid; // group Id of owner
-
- Filestat(int mode, int uid, int gid) {
- this.mode = mode; this.uid = uid; this.gid = gid;
- }
- }
-
-
- /**
- * Get Unix file status information for a file.
- *
- * This method is only implemented for OSes of the Unix family. It returns file status
- * information for a file. Currently this is the file mode, the user id and group id of the owner.
- *
- * @param path
- * File/directory to get the file status from.
- * @return Upon successful completion, a Filestat object containing the file information is returned.
- * Otherwise, null is returned.
- */
- public static Filestat getFilestat(File path)
- {
- return getFilestat(path.getAbsolutePath());
- }
-
-
- /**
- * Get Unix file status information for a file.
- *
- * This method is only implemented for OSes of the Unix family. It returns file status
- * information for a file. Currently this is the file mode, the user id and group id of the owner.
- *
- * @param path
- * Path to a file/directory to get the file status from.
- * @return Upon successful completion, a Filestat object containing the file information is returned.
- * Otherwise, null is returned.
- */
- public static Filestat getFilestat(String path)
- {
- if (isWindows()) {
- throw new UnsupportedOperationException("The method JnaUtils.getFilestat is not supported under Windows.");
- }
-
-
- int mode = 0;
-
- // Use a Runtime, because implementing stat() via JNA is just too much trouble.
- // This could be done with the 'stat' command, too. But that may have a shell specific implementation, so we use 'ls' instead.
- String lsLine = runProcessLs(path);
- if (lsLine == null) {
- LOGGER.debug("Could not get file information for path " + path);
- return null;
- }
-
- Pattern p = Pattern.compile("^(([-bcdlspCDMnP?])([-r][-w][-xSs])([-r][-w][-xSs])([-r][-w][-xTt]))[@+.]? +[0-9]+ +([0-9]+) +([0-9]+) ");
- Matcher m = p.matcher(lsLine);
- if ( !m.lookingAt() ) {
- LOGGER.debug("Could not parse valid file mode information for path " + path);
- return null;
- }
-
- // Parse mode string to mode bits
- String group = m.group(2);
- switch (group.charAt(0)) {
- case 'p' :
- mode |= 0010000; break;
- case 'c':
- mode |= 0020000; break;
- case 'd':
- mode |= 0040000; break;
- case 'b':
- mode |= 0060000; break;
- case '-':
- mode |= 0100000; break;
- case 'l':
- mode |= 0120000; break;
- case 's':
- mode |= 0140000; break;
- }
-
- for ( int i = 0; i < 3; i++) {
- group = m.group(3 + i);
- switch (group.charAt(0)) {
- case 'r':
- mode |= (0400 >> i*3); break;
- case '-':
- break;
- }
-
- switch (group.charAt(1)) {
- case 'w':
- mode |= (0200 >> i*3); break;
- case '-':
- break;
- }
-
- switch (group.charAt(2)) {
- case 'x':
- mode |= (0100 >> i*3); break;
- case 'S':
- mode |= (04000 >> i); break;
- case 's':
- mode |= (0100 >> i*3);
- mode |= (04000 >> i); break;
- case 'T':
- mode |= 01000; break;
- case 't':
- mode |= (0100 >> i*3);
- mode |= 01000; break;
- case '-':
- break;
- }
- }
-
- return new Filestat(mode, Integer.parseInt(m.group(6)), Integer.parseInt(m.group(7)));
- }
-
-
- /**
- * Run the unix command 'ls -ldn' on a single file and return the resulting output line.
- *
- * @param path
- * Path to a single file or directory.
- * @return The first line of output from the 'ls' command. Null, if an error occurred and no line could be read.
- */
- private static String runProcessLs(String path)
- {
- String cmd = "ls -ldn " + path;
- Runtime rt = Runtime.getRuntime();
- Process pr = null;
- InputStreamReader ir = null;
- BufferedReader br = null;
- String output = null;
-
- try {
- pr = rt.exec(cmd);
- ir = new InputStreamReader(pr.getInputStream());
- br = new BufferedReader(ir);
-
- output = br.readLine();
-
- while (br.readLine() != null) ; // Swallow remaining output
- }
- catch (IOException e) {
- LOGGER.debug("Exception while running unix command '" + cmd + "': " + e);
- }
- finally {
- if (pr != null) try { pr.waitFor(); } catch (Exception ignored) {}
-
- if (br != null) try { br.close(); } catch (Exception ignored) {}
- if (ir != null) try { ir.close(); } catch (Exception ignored) {}
-
- if (pr != null) try { pr.getOutputStream().close(); } catch (Exception ignored) {}
- if (pr != null) try { pr.getInputStream().close(); } catch (Exception ignored) {}
- if (pr != null) try { pr.getErrorStream().close(); } catch (Exception ignored) {}
- }
-
- return output;
- }
-
-
- private static UnixCLibrary getUnixCLibrary()
- {
- if (unixlibc == null) {
- unixlibc = (UnixCLibrary) Native.loadLibrary("c", UnixCLibrary.class);
- if (unixlibc == null) throw new RuntimeException("Could not initialize native C library.");
- }
- return unixlibc;
- }
-
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/JsUtil.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/JsUtil.java
deleted file mode 100644
index 236f8018c1..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/JsUtil.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.google.common.base.Throwables;
-
-public class JsUtil {
-
- public static String formatOptions(Object option) {
- try {
- return StandardObjectMapper.getInstance().writeValueAsString(option);
- } catch (JsonProcessingException e) {
- throw Throwables.propagate(e);
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/MarkdownUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/MarkdownUtils.java
deleted file mode 100644
index f3156df218..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/MarkdownUtils.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import static org.pegdown.Extensions.ALL;
-import static org.pegdown.Extensions.SMARTYPANTS;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringWriter;
-
-import org.apache.commons.io.IOUtils;
-import org.pegdown.LinkRenderer;
-import org.pegdown.PegDownProcessor;
-
-/**
- * Utility methods for transforming raw markdown text to html.
- *
- * @author James Moger
- *
- */
-
-public class MarkdownUtils {
-
- /**
- * Returns the html version of the plain source text.
- *
- * @param text
- * @return html version of plain text
- * @throws java.text.ParseException
- */
- public static String transformPlainText(String text) {
- // url auto-linking
- text = text.replaceAll("((http|https)://[0-9A-Za-z-_=\\?\\.\\$#&/]*)", "<a href=\"$1\">$1</a>");
- String html = "<pre>" + text + "</pre>";
- return html;
- }
-
-
- /**
- * Returns the html version of the markdown source text.
- *
- * @param markdown
- * @return html version of markdown text
- * @throws java.text.ParseException
- */
- public static String transformMarkdown(String markdown) {
- return transformMarkdown(markdown, null);
- }
-
- /**
- * Returns the html version of the markdown source text.
- *
- * @param markdown
- * @return html version of markdown text
- * @throws java.text.ParseException
- */
- public static String transformMarkdown(String markdown, LinkRenderer linkRenderer) {
- PegDownProcessor pd = new PegDownProcessor(ALL & ~SMARTYPANTS);
- String html = pd.markdownToHtml(markdown, linkRenderer == null ? new LinkRenderer() : linkRenderer);
- return html;
- }
-
- /**
- * Returns the html version of the markdown source reader. The reader is
- * closed regardless of success or failure.
- *
- * @param markdownReader
- * @return html version of the markdown text
- * @throws java.text.ParseException
- */
- public static String transformMarkdown(Reader markdownReader) throws IOException {
- // Read raw markdown content and transform it to html
- StringWriter writer = new StringWriter();
- try {
- IOUtils.copy(markdownReader, writer);
- String markdown = writer.toString();
- return transformMarkdown(markdown);
- } finally {
- try {
- writer.close();
- } catch (IOException e) {
- // IGNORE
- }
- }
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Primitives.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Primitives.java
deleted file mode 100644
index 8dc37ea952..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/Primitives.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import java.util.Map;
-import java.util.Set;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.ImmutableBiMap;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Utilities for working with primitive types and reflection.
- * <p/>
- * <b>Terminology:</b>
- * <p/>
- * Non-reference primitive types (e.g. <code>int</code>, <code>double</code>, <code>void</code>) are
- * considered <i>native primitives</i>, or sometimes, <i>unboxed primitives</i>.
- * <p/>
- * Reference primitive types (e.g. {@link Integer}, {@link Double}, {@link Void}) are considered
- * <i>boxed primitives</i>.
- * <p/>
- * Conversion between native primitves and boxed primitives can be done with
- * {@link Primitives#box(Class)} and {@link Primitives#unbox(Class)}.
- * <p/>
- * Whenever possible, boxing/unboxing will be implicit and transparent, with a preference for native
- * primitive types.
- */
-@SuppressWarnings("rawtypes")
-public class Primitives {
-
- // a mapping of primitive types that are assignable to a wider primitive
- private static final Map<Class, Set<Class>> ASSIGNABLES;
- static {
- final ImmutableMap.Builder<Class, Set<Class>> builder = ImmutableMap.builder();
- builder.put(Short.TYPE, ImmutableSet.<Class>of(Byte.TYPE));
- builder.put(Integer.TYPE, ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE));
- builder.put(Long.TYPE, ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE, Integer.TYPE));
- builder.put(Float.TYPE,
- ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE, Character.TYPE));
- builder.put(Double.TYPE, ImmutableSet.<Class>of(Byte.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE,
- Float.TYPE, Character.TYPE));
- ASSIGNABLES = builder.build();
- }
-
- // a mapping of primitive Class instances to their boxed counterparts
- private static final BiMap<Class, Class> BOXED_CLASSES;
- static {
- final ImmutableBiMap.Builder<Class, Class> builder = ImmutableBiMap.builder();
- builder.put(Byte.TYPE, Byte.class);
- builder.put(Short.TYPE, Short.class);
- builder.put(Integer.TYPE, Integer.class);
- builder.put(Long.TYPE, Long.class);
- builder.put(Float.TYPE, Float.class);
- builder.put(Double.TYPE, Double.class);
- builder.put(Boolean.TYPE, Boolean.class);
- builder.put(Character.TYPE, Character.class);
- builder.put(Void.TYPE, Void.class);
- BOXED_CLASSES = builder.build();
- }
-
- /**
- * Produces the {@link Class} for the boxed counterpart of the given primitive {@link Class}.
- *
- * @param clazz the {@link Class} of the primitive type to get the boxed counterpart for.
- * @return the {@link Class} of the boxed counterpart to the given primitive type {@link Class}
- * or; if the argument is already a boxed primitive, the argument itself.
- * @throws IllegalArgumentException if the given {@link Class} is not for a primitive type.
- */
- public static Class box(final Class clazz) {
- return isNativePrimitive(clazz) && BOXED_CLASSES.containsKey(clazz)
- ? BOXED_CLASSES.get(clazz)
- : requirePrimitiveClass(clazz);
- }
-
- /**
- * Produces the {@link Class} for the native primitive counterpart of the given boxed primitive
- * {@link Class}.
- *
- * @param clazz the {@link Class} of the boxed primitive type to unbox to a native primitive.
- * @return the {@link Class} of the native primitive counterpart to the given boxed primitive
- * {@link Class} or; if the argument is already a native primitive, the argument itself.
- * @throws IllegalArgumentException if the given {@link Class} is not for a primitive type.
- */
- public static Class unbox(final Class clazz) {
- return isBoxedPrimitive(clazz)
- ? BOXED_CLASSES.inverse().get(clazz)
- : requirePrimitiveClass(clazz);
- }
-
- /**
- * Determines whether the objects of the given source {@link Class} can be assigned to the
- * primitive type of the given target {@link Class}.
- * <p/>
- * If either type is a boxed-primitive, it will be unboxed automatically; all comparisons will be
- * of the native primitive types.
- *
- * @param target the {@link Class} of the type you wish to assign to.
- * @param source the {@link Class} of the type you wish to assign from.
- * @return true if objects of the source {@link Class} can be assigned to the type of the target
- * {@link Class}; otherwise, false.
- */
- public static boolean isAssignableFrom(final Class target, final Class source) {
- if (target.equals(Classes.Null.class)) {
- throw new NullPointerException("target for type assignment may not be the null type");
- }
-
- // permit null sources for boxed targets
- if (Primitives.isBoxedPrimitive(target) && source.equals(Classes.Null.class)) {
- return true;
- }
-
- // ensure source type is a primitive type
- if (!Primitives.isPrimitive(source)) {
- return false;
- }
-
- // unbox both types for comparison
- final Class unboxedTarget = unbox(target);
- final Class unboxedSource = unbox(source);
-
- return unboxedTarget.equals(unboxedSource)
- || (ASSIGNABLES.containsKey(unboxedTarget) && ASSIGNABLES.get(unboxedTarget).contains(
- unboxedSource));
- }
-
- /**
- * Determines whether the given {@link Class} is for a primitive type; either native or boxed.
- * <p/>
- * Both boxed and native primitive types are considered "primitives". Example: <code>
- * Primitives.isPrimitive(int.class) == true;
- * Primitives.isPrimitive(Integer.class) == true;
- * Primitives.isPrimitive(String.class) == false;
- * </code>
- *
- * @param clazz the {@link Class} of the type to determine whether or not it is for a primitive
- * type.
- * @return true if the given {@link Class} is for a primitive type, boxed or native; false if the
- * given {@link Class} is for any other type.
- */
- public static boolean isPrimitive(final Class clazz) {
- return clazz.isPrimitive() || BOXED_CLASSES.containsValue(clazz);
- }
-
- /**
- * Determines whether the given {@link Class} is for a boxed primitive type.
- * <p/>
- * Only boxed primitive types are accepted. Example: <code>
- * Primitives.isPrimitive(int.class) == false;
- * Primitives.isPrimitive(Integer.class) == true;
- * Primitives.isPrimitive(String.class) == false;
- * </code>
- *
- * @param clazz the {@link Class} of the type to determine whether or not it is for a boxed
- * primitive type.
- * @return true if the given {@link Class} is for a boxed primitive type; false if the given
- * {@link Class} is for any other type, including native primitive types.
- */
- public static boolean isBoxedPrimitive(final Class clazz) {
- return !clazz.isPrimitive() && BOXED_CLASSES.containsValue(clazz);
- }
-
- /**
- * Determines whether the given {@link Class} is for a native primitive type.
- * <p/>
- * Only native primitive types are accepted. Example: <code>
- * Primitives.isPrimitive(int.class) == true;
- * Primitives.isPrimitive(Integer.class) == false;
- * Primitives.isPrimitive(String.class) == false;
- * </code>
- *
- * @param clazz the {@link Class} of the type to determine whether or not it is for a native
- * primitive type.
- * @return true if the given {@link Class} is for a native primitive type; false if the given
- * {@link Class} is for any other type, including boxed primitive types.
- */
- public static boolean isNativePrimitive(final Class clazz) {
- return clazz.isPrimitive();
- }
-
- /**
- * Asserts that the given {@link Class} is for a primitive type, either native or boxed.
- *
- * @param clazz the {@link Class} to assert is for a primitive type.
- * @return the given {@link Class}, without modifications, to facilitate chaining.
- * @throws AssertionError if the given {@link Class} is for a non-primitive type.
- */
- public static Class requirePrimitiveClass(final Class clazz) {
- if (!isPrimitive(clazz)) {
- throw new AssertionError("Class must be for a primitive type; " + clazz + " given");
- }
- return clazz;
- }
-}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/StandardObjectMapper.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/StandardObjectMapper.java
deleted file mode 100644
index 9353a54d35..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/StandardObjectMapper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-public class StandardObjectMapper {
- private static final ObjectMapper MAPPER = newObjectMapper();
-
- public static ObjectMapper getInstance() {
- return MAPPER;
- }
-
- /**
- * Creates a new {@link ObjectMapper} which is compatible with DropWizard
- */
- private static ObjectMapper newObjectMapper() {
- final ObjectMapper mapper = new ObjectMapper();
- mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
- mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
- mapper.disable(MapperFeature.USE_GETTERS_AS_SETTERS);
- mapper.disable(MapperFeature.AUTO_DETECT_GETTERS);
- mapper.disable(MapperFeature.AUTO_DETECT_IS_GETTERS);
- // to allow C/C++ style comments in JSON (non-standard, disabled by
- // default)
- JsonFactory jsonFactory = mapper.getFactory();
- jsonFactory.enable(JsonParser.Feature.ALLOW_COMMENTS);
- // to allow (non-standard) unquoted field names in JSON:
- jsonFactory.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES);
- // to allow use of apostrophes (single quotes), non standard
- jsonFactory.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
- jsonFactory.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS);
- jsonFactory
- .enable(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER);
- return mapper;
- }
-
- private StandardObjectMapper() {
- throw new AssertionError();
- }
-}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/UrlUtils.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/util/UrlUtils.java
deleted file mode 100644
index b8ad7f1bc8..0000000000
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/util/UrlUtils.java
+++ /dev/null
@@ -1,246 +0,0 @@
-package com.pmease.gitplex.web.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.JarURLConnection;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.regex.Pattern;
-
-import javax.annotation.Nullable;
-
-import org.apache.commons.lang3.StringUtils;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class UrlUtils {
-
- private UrlUtils() {
- }
-
- public static long getLastModified(Set<URL> fileset) {
- long lastModified = 0;
- for (URL each : fileset) {
- lastModified = Math.max(lastModified, getLastModified(each));
- }
-
- return lastModified;
- }
-
- /**
- * Copied from dropwizard
- *
- * Returns the last modified time for file:// and jar:// URLs. This is
- * slightly tricky for a couple of reasons: 1) calling getConnection on a
- * {@link URLConnection} to a file opens an {@link InputStream} to that file
- * that must then be closed — though this is not true for
- * {@code URLConnection}s to jar resources 2) calling getLastModified on
- * {@link JarURLConnection}s returns the last modified time of the jar file,
- * rather than the file within
- *
- * @param resourceURL
- * the URL to return the last modified time for
- * @return the last modified time of the resource, expressed as the number
- * of milliseconds since the epoch, or 0 if there was a problem
- */
- public static long getLastModified(URL resourceURL) {
- final String protocol = resourceURL.getProtocol();
- switch (protocol) {
- case "jar":
- try {
- final JarURLConnection jarConnection = (JarURLConnection) resourceURL
- .openConnection();
- final JarEntry entry = jarConnection.getJarEntry();
- return entry.getTime();
- } catch (IOException ignored) {
- return 0;
- }
- case "file":
- URLConnection connection = null;
- try {
- connection = resourceURL.openConnection();
- return connection.getLastModified();
- } catch (IOException ignored) {
- return 0;
- } finally {
- if (connection != null) {
- try {
- connection.getInputStream().close();
- } catch (IOException ignored) {
- // do nothing.
- }
- }
- }
- default:
- throw new IllegalArgumentException("Unsupported protocol "
- + resourceURL.getProtocol() + " for resource "
- + resourceURL);
- }
- }
-
- /**
- * Encode url segment
- *
- * @param segment
- * @return
- */
- public static String encodeUrl(final String segment) {
- try {
- return URLEncoder.encode(segment, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw Throwables.propagate(e);
- }
- }
-
- /**
- * Decode url
- *
- * @param value
- * @return
- */
- public static String decodeUrl(final String value) {
- try {
- return URLDecoder.decode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public static List<String> normalizeUrlSegments(List<String> segments) {
- List<String> normalized = new ArrayList<String>();
- for (String each: segments) {
- each = StringUtils.remove(each, '/');
- if (each.length() != 0)
- normalized.add(each);
- }
- return normalized;
- }
-
- /**
- * Concatenate url segments into one
- *
- * @param segments
- * @return
- */
- public static String concatSegments(String[] segments) {
- String url = Joiner.on("/").skipNulls().join(segments);
- return UrlUtils.removeRedundantSlashes(url);
- }
-
- public static String concatSegments(List<String> segments) {
- return concatSegments(Iterables.toArray(segments, String.class));
- }
-
- public static String concatSegments(String base, String... segments) {
- List<String> list = ImmutableList.<String>builder().add(base).add(segments).build();
- return concatSegments(Iterables.toArray(list, String.class));
- }
-
- private static final Pattern SLASHES = Pattern.compile("//+");
-
- /**
- * Reduces redundant slashes to a single slash.
- *
- * @param path
- * @return null or the reduced string
- */
- public static @Nullable String removeRedundantSlashes(@Nullable String path) {
- if (path == null) {
- return null;
- }
-
- return SLASHES.matcher(path).replaceAll("/");
- }
-
- /**
- * Trims any trailing slashes from a URL path (see {@link URI#getPath()}.
- *
- * @param uri a URI with a path component
- * @return the URI with any trailing slashes from the path removed
- * @throws IllegalArgumentException if the value is no longer a valid URI after the slashes have been trimmed
- */
- public static URI trimTrailingSlashesFromPath(URI uri) {
- String path = uri.getPath();
- if (path.endsWith("/")) {
- while (path.endsWith("/")) {
- path = path.substring(0, path.length() - 1);
- }
-
- try {
- return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), path, uri.getQuery(), uri.getFragment());
- } catch (URISyntaxException e) {
- throw Throwables.propagate(e);
- }
- }
-
- return uri;
- }
-
-
- /**
- * Add encoded parameter to URI
- *
- * @param name
- * @param value
- * @param uri
- */
- public static void addParam(final String name, final String value,
- final StringBuilder uri) {
- if (uri.length() > 0)
- uri.append('&');
- uri.append(encodeUrl(name)).append('=');
- if (value != null)
- uri.append(encodeUrl(value));
- }
-
- /**
- * Add request parameters to URI
- *
- * @param params
- * @param uri
- */
- public static void addParams(final Map<String, String> params,
- final StringBuilder uri) {
- if (params == null || params.isEmpty())
- return;
- for (Entry<String, String> param : params.entrySet())
- addParam(param.getKey(), param.getValue(), uri);
- }
-
- /**
- * Get parameter value with name
- *
- * @param uri
- * @param name
- * @return value or null if not found in URI query
- */
- public static String getParam(final URI uri, final String name) {
- final String query = uri.getRawQuery();
- if (query == null || query.length() == 0)
- return null;
- final String[] params = query.split("&"); //$NON-NLS-1$
- for (String param : params) {
- final String[] parts = param.split("="); //$NON-NLS-1$
- if (parts.length != 2)
- continue;
- if (!name.equals(parts[0]))
- continue;
- return decodeUrl(parts[1]);
- }
- return null;
- }
-}
diff --git a/gitplex.web/src/main/java/org/apache/tika/mime/custom-mimetypes.xml b/gitplex.web/src/main/java/org/apache/tika/mime/custom-mimetypes.xml
deleted file mode 100644
index a01f722e6a..0000000000
--- a/gitplex.web/src/main/java/org/apache/tika/mime/custom-mimetypes.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<mime-info>
- <mime-type type="text/x-abap">
- <_comment>ABAP</_comment>
- <glob pattern="*.abap" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-antlr">
- <_comment>Antlr grammer</_comment>
- <glob pattern="*.g4" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-scss">
- <_comment>SCSS</_comment>
- <glob pattern="*.scss" />
- <sub-class-of type="text/css" />
- </mime-type>
-
- <mime-type type="text/x-apache">
- <_comment>Apache conf file</_comment>
- <glob pattern="*.htaccess" />
- <glob pattern="apache2.conf" />
- <glob pattern="httpd.conf" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-asp">
- <_comment>ASP</_comment>
- <glob pattern="*.asax" />
- <glob pattern="*.ascx" />
- <glob pattern="*.ashx" />
- <glob pattern="*.asmx" />
- <glob pattern="*.axd" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-agda">
- <_comment>AGDA source code</_comment>
- <glob pattern="*.agda" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-apl">
- <_comment>APL template source code</_comment>
- <glob pattern="*.apl" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-java">
- <_comment>Java source code</_comment>
- <alias type="text/x-java-source" />
- <glob pattern="*.java" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-ruby">
- <_comment>Ruby source code</_comment>
- <glob pattern="*.rb" />
- <magic priority="50">
- <match value="#!/usr/bin/env macruby" type="string" offset="0" />
- <match value="#! /usr/bin/env ruby" type="string" offset="0" />
- </magic>
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-makefile">
- <_comment>Makefile</_comment>
- <glob pattern="Makefile" />
- <glob pattern="makefile" />
- <glob pattern="GNUmakefile" />
-
- <glob pattern="*.mak" />
- <glob pattern="*.mk" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-properties">
- <_comment>Properties source code</_comment>
- <glob pattern="*.properties" />
- <glob pattern="*.prefs" />
- <glob pattern="*.gitconfig" />
- <glob pattern="*.editorconfig" />
-
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-nginx">
- <_comment>Nginx conf</_comment>
- <glob pattern="*.nginxconf" />
- </mime-type>
-
- <mime-type type="text/x-dart">
- <_comment>Dart lang</_comment>
- <glob pattern="*.dart" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-clojure">
- <_comment>Clojure source code</_comment>
- <glob pattern="*.clj" />
- <glob pattern="*.cl2" />
- <glob pattern="*.cljc" />
- <glob pattern="*.cljs" />
- <glob pattern="*.cljscm" />
- <glob pattern="*.cljx" />
- <glob pattern="*.hic" />
- <glob pattern="riemann.config" />
- <sub-class-of type="text/plain" />
- </mime-type>
-
- <mime-type type="text/x-sh">
- <_comment>UNIX/LINUX Shell Script</_comment>
-
- <glob pattern="*.zsh"/>
-
- <glob pattern=".bash_logout" />
- <glob pattern=".bash_profile" />
- <glob pattern=".bashrc"/>
- <glob pattern=".cshrc"/>
- <glob pattern=".login"/>
- <glob pattern=".profile"/>
- <glob pattern=".zlogin"/>
- <glob pattern=".zlogout"/>
- <glob pattern=".zprofile"/>
- <glob pattern=".zshenv"/>
- <glob pattern=".zshrc"/>
- <glob pattern="Dockerfile"/>
- <glob pattern="bash_logout"/>
- <glob pattern="bash_profile"/>
- <glob pattern="bashrc"/>
- <glob pattern="cshrc"/>
- <glob pattern="login"/>
- <glob pattern="profile"/>
- <glob pattern="zlogin"/>
- <glob pattern="zlogout"/>
- <glob pattern="zprofile"/>
- <glob pattern="zshenv"/>
- <glob pattern="zshrc"/>
-
- <sub-class-of type="text/plain"/>
- </mime-type>
-
- <mime-type type="text/x-erlang">
- <_comment>Erlang source code</_comment>
- <magic priority="50">
- <match value="#!/usr/bin/env escript" type="string" offset="0" />
- </magic>
- <sub-class-of type="text/plain"/>
- </mime-type>
-
- <mime-type type="text/x-viml">
- <_comment>VIM extension language</_comment>
- <glob pattern="*.vim" />
- <glob pattern=".vimrc" />
- <glob pattern="vimrc" />
- <glob pattern=".gvimrc" />
- <glob pattern="gvimrc" />
-
- <sub-class-of type="text/plain"/>
- </mime-type>
-
-</mime-info>
\ No newline at end of file