--- /dev/null
+/*
+ * 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.
+ */
+package com.gitblit.utils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.gitblit.IStoredSettings;
+import com.gitblit.Keys;
+import com.gitblit.models.RepositoryModel;
+
+public class MessageProcessor {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private final IStoredSettings settings;
+
+ public MessageProcessor(IStoredSettings settings) {
+ this.settings = settings;
+ }
+
+ /**
+ * Returns an html version of the commit message with any global or
+ * repository-specific regular expression substitution applied.
+ *
+ * This method uses the preferred renderer to transform the commit message.
+ *
+ * @param repository
+ * @param text
+ * @return html version of the commit message
+ */
+ public String processCommitMessage(RepositoryModel repository, String text) {
+ switch (repository.commitMessageRenderer) {
+ case MARKDOWN:
+ try {
+ String prepared = processCommitMessageRegex(repository.name, text);
+ return MarkdownUtils.transformMarkdown(prepared);
+ } catch (Exception e) {
+ logger.error("Failed to render commit message as markdown", e);
+ }
+ break;
+ default:
+ // noop
+ break;
+ }
+
+ return processPlainCommitMessage(repository.name, text);
+ }
+
+ /**
+ * Returns an html version of the commit message with any global or
+ * repository-specific regular expression substitution applied.
+ *
+ * This method assumes the commit message is plain text.
+ *
+ * @param repositoryName
+ * @param text
+ * @return html version of the commit message
+ */
+ public String processPlainCommitMessage(String repositoryName, String text) {
+ String html = StringUtils.escapeForHtml(text, false);
+ html = processCommitMessageRegex(repositoryName, html);
+ return StringUtils.breakLinesForHtml(html);
+
+ }
+
+ /**
+ * Apply globally or per-repository specified regex substitutions to the
+ * commit message.
+ *
+ * @param repositoryName
+ * @param text
+ * @return the processed commit message
+ */
+ protected String processCommitMessageRegex(String repositoryName, String text) {
+ Map<String, String> map = new HashMap<String, String>();
+ // global regex keys
+ if (settings.getBoolean(Keys.regex.global, false)) {
+ for (String key : settings.getAllKeys(Keys.regex.global)) {
+ if (!key.equals(Keys.regex.global)) {
+ String subKey = key.substring(key.lastIndexOf('.') + 1);
+ map.put(subKey, settings.getString(key, ""));
+ }
+ }
+ }
+
+ // repository-specific regex keys
+ List<String> keys = settings.getAllKeys(Keys.regex._ROOT + "."
+ + repositoryName.toLowerCase());
+ for (String key : keys) {
+ String subKey = key.substring(key.lastIndexOf('.') + 1);
+ map.put(subKey, settings.getString(key, ""));
+ }
+
+ for (Entry<String, String> entry : map.entrySet()) {
+ String definition = entry.getValue().trim();
+ String[] chunks = definition.split("!!!");
+ if (chunks.length == 2) {
+ text = text.replaceAll(chunks[0], chunks[1]);
+ } else {
+ logger.warn(entry.getKey()
+ + " improperly formatted. Use !!! to separate match from replacement: "
+ + definition);
+ }
+ }
+ return text;
+ }
+}
import org.apache.wicket.authorization.strategies.page.AbstractPageAuthorizationStrategy;\r
import org.apache.wicket.markup.html.WebPage;\r
\r
-import com.gitblit.GitBlit;\r
+import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.wicket.pages.BasePage;\r
public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements\r
IUnauthorizedComponentInstantiationListener {\r
\r
+ IStoredSettings settings;\r
Class<? extends WebPage> homepageClass;\r
\r
- public AuthorizationStrategy(Class<? extends WebPage> homepageClass) {\r
+ public AuthorizationStrategy(IStoredSettings settings, Class<? extends WebPage> homepageClass) {\r
+ this.settings = settings;\r
this.homepageClass = homepageClass;\r
}\r
\r
}\r
\r
if (BasePage.class.isAssignableFrom(pageClass)) {\r
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);\r
- boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);\r
- boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);\r
+ boolean authenticateView = settings.getBoolean(Keys.web.authenticateViewPages, true);\r
+ boolean authenticateAdmin = settings.getBoolean(Keys.web.authenticateAdminPages, true);\r
+ boolean allowAdmin = settings.getBoolean(Keys.web.allowAdministration, true);\r
\r
GitBlitWebSession session = GitBlitWebSession.get();\r
if (authenticateView && !session.isLoggedIn()) {\r
-/*\r
- * Copyright 2011 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.wicket;\r
-\r
-import java.util.HashMap;\r
-import java.util.Locale;\r
-import java.util.Map;\r
-\r
-import org.apache.wicket.Application;\r
-import org.apache.wicket.Request;\r
-import org.apache.wicket.Response;\r
-import org.apache.wicket.Session;\r
-import org.apache.wicket.markup.html.WebPage;\r
-import org.apache.wicket.protocol.http.WebApplication;\r
-\r
-import com.gitblit.GitBlit;\r
-import com.gitblit.Keys;\r
-import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.pages.ActivityPage;\r
-import com.gitblit.wicket.pages.BlamePage;\r
-import com.gitblit.wicket.pages.BlobDiffPage;\r
-import com.gitblit.wicket.pages.BlobPage;\r
-import com.gitblit.wicket.pages.BranchesPage;\r
-import com.gitblit.wicket.pages.CommitDiffPage;\r
-import com.gitblit.wicket.pages.CommitPage;\r
-import com.gitblit.wicket.pages.ComparePage;\r
-import com.gitblit.wicket.pages.DocPage;\r
-import com.gitblit.wicket.pages.DocsPage;\r
-import com.gitblit.wicket.pages.FederationRegistrationPage;\r
-import com.gitblit.wicket.pages.ForkPage;\r
-import com.gitblit.wicket.pages.ForksPage;\r
-import com.gitblit.wicket.pages.GitSearchPage;\r
-import com.gitblit.wicket.pages.GravatarProfilePage;\r
-import com.gitblit.wicket.pages.HistoryPage;\r
-import com.gitblit.wicket.pages.LogPage;\r
-import com.gitblit.wicket.pages.LogoutPage;\r
-import com.gitblit.wicket.pages.LuceneSearchPage;\r
-import com.gitblit.wicket.pages.MetricsPage;\r
-import com.gitblit.wicket.pages.MyDashboardPage;\r
-import com.gitblit.wicket.pages.OverviewPage;\r
-import com.gitblit.wicket.pages.PatchPage;\r
-import com.gitblit.wicket.pages.ProjectPage;\r
-import com.gitblit.wicket.pages.ProjectsPage;\r
-import com.gitblit.wicket.pages.RawPage;\r
-import com.gitblit.wicket.pages.ReflogPage;\r
-import com.gitblit.wicket.pages.RepositoriesPage;\r
-import com.gitblit.wicket.pages.ReviewProposalPage;\r
-import com.gitblit.wicket.pages.SummaryPage;\r
-import com.gitblit.wicket.pages.TagPage;\r
-import com.gitblit.wicket.pages.TagsPage;\r
-import com.gitblit.wicket.pages.TreePage;\r
-import com.gitblit.wicket.pages.UserPage;\r
-import com.gitblit.wicket.pages.UsersPage;\r
-\r
-public class GitBlitWebApp extends WebApplication {\r
-\r
- private final Class<? extends WebPage> homePageClass = MyDashboardPage.class;\r
-\r
- private final Map<String, CacheControl> cacheablePages = new HashMap<String, CacheControl>();\r
-\r
- @Override\r
- public void init() {\r
- super.init();\r
-\r
- // Setup page authorization mechanism\r
- boolean useAuthentication = GitBlit.getBoolean(Keys.web.authenticateViewPages, false)\r
- || GitBlit.getBoolean(Keys.web.authenticateAdminPages, false);\r
- if (useAuthentication) {\r
- AuthorizationStrategy authStrategy = new AuthorizationStrategy(homePageClass);\r
- getSecuritySettings().setAuthorizationStrategy(authStrategy);\r
- getSecuritySettings().setUnauthorizedComponentInstantiationListener(authStrategy);\r
- }\r
-\r
- // Grab Browser info (like timezone, etc)\r
- if (GitBlit.getBoolean(Keys.web.useClientTimezone, false)) {\r
- getRequestCycleSettings().setGatherExtendedBrowserInfo(true);\r
- }\r
-\r
- // configure the resource cache duration to 90 days for deployment\r
- if (!GitBlit.isDebugMode()) {\r
- getResourceSettings().setDefaultCacheDuration(90 * 86400);\r
- }\r
-\r
- // setup the standard gitweb-ish urls\r
- mount("/repositories", RepositoriesPage.class);\r
- mount("/overview", OverviewPage.class, "r", "h");\r
- mount("/summary", SummaryPage.class, "r");\r
- mount("/reflog", ReflogPage.class, "r", "h");\r
- mount("/commits", LogPage.class, "r", "h");\r
- mount("/log", LogPage.class, "r", "h");\r
- mount("/tags", TagsPage.class, "r");\r
- mount("/branches", BranchesPage.class, "r");\r
- mount("/commit", CommitPage.class, "r", "h");\r
- mount("/tag", TagPage.class, "r", "h");\r
- mount("/tree", TreePage.class, "r", "h", "f");\r
- mount("/blob", BlobPage.class, "r", "h", "f");\r
- mount("/raw", RawPage.class, "r", "h", "f");\r
- mount("/blobdiff", BlobDiffPage.class, "r", "h", "f");\r
- mount("/commitdiff", CommitDiffPage.class, "r", "h");\r
- mount("/compare", ComparePage.class, "r", "h");\r
- mount("/patch", PatchPage.class, "r", "h", "f");\r
- mount("/history", HistoryPage.class, "r", "h", "f");\r
- mount("/search", GitSearchPage.class);\r
- mount("/metrics", MetricsPage.class, "r");\r
- mount("/blame", BlamePage.class, "r", "h", "f");\r
- mount("/users", UsersPage.class);\r
- mount("/logout", LogoutPage.class);\r
-\r
- // setup the markup document urls\r
- mount("/docs", DocsPage.class, "r");\r
- mount("/doc", DocPage.class, "r", "h", "f");\r
-\r
- // federation urls\r
- mount("/proposal", ReviewProposalPage.class, "t");\r
- mount("/registration", FederationRegistrationPage.class, "u", "n");\r
-\r
- mount("/activity", ActivityPage.class, "r", "h");\r
- mount("/gravatar", GravatarProfilePage.class, "h");\r
- mount("/lucene", LuceneSearchPage.class);\r
- mount("/project", ProjectPage.class, "p");\r
- mount("/projects", ProjectsPage.class);\r
- mount("/user", UserPage.class, "user");\r
- mount("/forks", ForksPage.class, "r");\r
- mount("/fork", ForkPage.class, "r");\r
- \r
- getMarkupSettings().setDefaultMarkupEncoding("UTF-8");\r
- }\r
-\r
- private void mount(String location, Class<? extends WebPage> clazz, String... parameters) {\r
- if (parameters == null) {\r
- parameters = new String[] {};\r
- }\r
- if (!GitBlit.getBoolean(Keys.web.mountParameters, true)) {\r
- parameters = new String[] {};\r
- }\r
- mount(new GitblitParamUrlCodingStrategy(location, clazz, parameters));\r
-\r
- // map the mount point to the cache control definition\r
- if (clazz.isAnnotationPresent(CacheControl.class)) {\r
- CacheControl cacheControl = clazz.getAnnotation(CacheControl.class);\r
- cacheablePages.put(location.substring(1), cacheControl);\r
- }\r
- }\r
-\r
- @Override\r
- public Class<? extends WebPage> getHomePage() {\r
- return homePageClass;\r
- }\r
-\r
- public boolean isCacheablePage(String mountPoint) {\r
- return cacheablePages.containsKey(mountPoint);\r
- }\r
-\r
- public CacheControl getCacheControl(String mountPoint) {\r
- return cacheablePages.get(mountPoint);\r
- }\r
-\r
- @Override\r
- public final Session newSession(Request request, Response response) {\r
- GitBlitWebSession gitBlitWebSession = new GitBlitWebSession(request);\r
-\r
- String forcedLocale = GitBlit.getString(Keys.web.forceDefaultLocale, null);\r
- if (!StringUtils.isEmpty(forcedLocale)) {\r
- gitBlitWebSession.setLocale(new Locale(forcedLocale));\r
- }\r
- return gitBlitWebSession;\r
- }\r
-\r
- @Override\r
- public final String getConfigurationType() {\r
- if (GitBlit.isDebugMode()) {\r
- return Application.DEVELOPMENT;\r
- }\r
- return Application.DEPLOYMENT;\r
- }\r
-\r
- public static GitBlitWebApp get() {\r
- return (GitBlitWebApp) WebApplication.get();\r
- }\r
-}\r
+/*
+ * Copyright 2011 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.
+ */
+package com.gitblit.wicket;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Request;
+import org.apache.wicket.Response;
+import org.apache.wicket.Session;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.protocol.http.WebApplication;
+
+import com.gitblit.GitBlit;
+import com.gitblit.IStoredSettings;
+import com.gitblit.Keys;
+import com.gitblit.utils.StringUtils;
+import com.gitblit.wicket.pages.ActivityPage;
+import com.gitblit.wicket.pages.BlamePage;
+import com.gitblit.wicket.pages.BlobDiffPage;
+import com.gitblit.wicket.pages.BlobPage;
+import com.gitblit.wicket.pages.BranchesPage;
+import com.gitblit.wicket.pages.CommitDiffPage;
+import com.gitblit.wicket.pages.CommitPage;
+import com.gitblit.wicket.pages.ComparePage;
+import com.gitblit.wicket.pages.DocPage;
+import com.gitblit.wicket.pages.DocsPage;
+import com.gitblit.wicket.pages.FederationRegistrationPage;
+import com.gitblit.wicket.pages.ForkPage;
+import com.gitblit.wicket.pages.ForksPage;
+import com.gitblit.wicket.pages.GitSearchPage;
+import com.gitblit.wicket.pages.GravatarProfilePage;
+import com.gitblit.wicket.pages.HistoryPage;
+import com.gitblit.wicket.pages.LogPage;
+import com.gitblit.wicket.pages.LogoutPage;
+import com.gitblit.wicket.pages.LuceneSearchPage;
+import com.gitblit.wicket.pages.MetricsPage;
+import com.gitblit.wicket.pages.MyDashboardPage;
+import com.gitblit.wicket.pages.OverviewPage;
+import com.gitblit.wicket.pages.PatchPage;
+import com.gitblit.wicket.pages.ProjectPage;
+import com.gitblit.wicket.pages.ProjectsPage;
+import com.gitblit.wicket.pages.RawPage;
+import com.gitblit.wicket.pages.ReflogPage;
+import com.gitblit.wicket.pages.RepositoriesPage;
+import com.gitblit.wicket.pages.ReviewProposalPage;
+import com.gitblit.wicket.pages.SummaryPage;
+import com.gitblit.wicket.pages.TagPage;
+import com.gitblit.wicket.pages.TagsPage;
+import com.gitblit.wicket.pages.TreePage;
+import com.gitblit.wicket.pages.UserPage;
+import com.gitblit.wicket.pages.UsersPage;
+
+public class GitBlitWebApp extends WebApplication {
+
+ private final Class<? extends WebPage> homePageClass = MyDashboardPage.class;
+
+ private final Map<String, CacheControl> cacheablePages = new HashMap<String, CacheControl>();
+
+ private IStoredSettings settings;
+
+ @Override
+ public void init() {
+ super.init();
+
+ settings = GitBlit.getSettings();
+
+ // Setup page authorization mechanism
+ boolean useAuthentication = settings.getBoolean(Keys.web.authenticateViewPages, false)
+ || settings.getBoolean(Keys.web.authenticateAdminPages, false);
+ if (useAuthentication) {
+ AuthorizationStrategy authStrategy = new AuthorizationStrategy(settings, homePageClass);
+ getSecuritySettings().setAuthorizationStrategy(authStrategy);
+ getSecuritySettings().setUnauthorizedComponentInstantiationListener(authStrategy);
+ }
+
+ // Grab Browser info (like timezone, etc)
+ if (settings.getBoolean(Keys.web.useClientTimezone, false)) {
+ getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
+ }
+
+ // configure the resource cache duration to 90 days for deployment
+ if (!isDebugMode()) {
+ getResourceSettings().setDefaultCacheDuration(90 * 86400);
+ }
+
+ // setup the standard gitweb-ish urls
+ mount("/repositories", RepositoriesPage.class);
+ mount("/overview", OverviewPage.class, "r", "h");
+ mount("/summary", SummaryPage.class, "r");
+ mount("/reflog", ReflogPage.class, "r", "h");
+ mount("/commits", LogPage.class, "r", "h");
+ mount("/log", LogPage.class, "r", "h");
+ mount("/tags", TagsPage.class, "r");
+ mount("/branches", BranchesPage.class, "r");
+ mount("/commit", CommitPage.class, "r", "h");
+ mount("/tag", TagPage.class, "r", "h");
+ mount("/tree", TreePage.class, "r", "h", "f");
+ mount("/blob", BlobPage.class, "r", "h", "f");
+ mount("/raw", RawPage.class, "r", "h", "f");
+ mount("/blobdiff", BlobDiffPage.class, "r", "h", "f");
+ mount("/commitdiff", CommitDiffPage.class, "r", "h");
+ mount("/compare", ComparePage.class, "r", "h");
+ mount("/patch", PatchPage.class, "r", "h", "f");
+ mount("/history", HistoryPage.class, "r", "h", "f");
+ mount("/search", GitSearchPage.class);
+ mount("/metrics", MetricsPage.class, "r");
+ mount("/blame", BlamePage.class, "r", "h", "f");
+ mount("/users", UsersPage.class);
+ mount("/logout", LogoutPage.class);
+
+ // setup the markup document urls
+ mount("/docs", DocsPage.class, "r");
+ mount("/doc", DocPage.class, "r", "h", "f");
+
+ // federation urls
+ mount("/proposal", ReviewProposalPage.class, "t");
+ mount("/registration", FederationRegistrationPage.class, "u", "n");
+
+ mount("/activity", ActivityPage.class, "r", "h");
+ mount("/gravatar", GravatarProfilePage.class, "h");
+ mount("/lucene", LuceneSearchPage.class);
+ mount("/project", ProjectPage.class, "p");
+ mount("/projects", ProjectsPage.class);
+ mount("/user", UserPage.class, "user");
+ mount("/forks", ForksPage.class, "r");
+ mount("/fork", ForkPage.class, "r");
+
+ getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
+ super.init();
+ }
+
+ private void mount(String location, Class<? extends WebPage> clazz, String... parameters) {
+ if (parameters == null) {
+ parameters = new String[] {};
+ }
+ if (!settings.getBoolean(Keys.web.mountParameters, true)) {
+ parameters = new String[] {};
+ }
+ mount(new GitblitParamUrlCodingStrategy(settings, location, clazz, parameters));
+
+ // map the mount point to the cache control definition
+ if (clazz.isAnnotationPresent(CacheControl.class)) {
+ CacheControl cacheControl = clazz.getAnnotation(CacheControl.class);
+ cacheablePages.put(location.substring(1), cacheControl);
+ }
+ }
+
+ @Override
+ public Class<? extends WebPage> getHomePage() {
+ return homePageClass;
+ }
+
+ public boolean isCacheablePage(String mountPoint) {
+ return cacheablePages.containsKey(mountPoint);
+ }
+
+ public CacheControl getCacheControl(String mountPoint) {
+ return cacheablePages.get(mountPoint);
+ }
+
+ @Override
+ public final Session newSession(Request request, Response response) {
+ GitBlitWebSession gitBlitWebSession = new GitBlitWebSession(request);
+
+ String forcedLocale = settings.getString(Keys.web.forceDefaultLocale, null);
+ if (!StringUtils.isEmpty(forcedLocale)) {
+ gitBlitWebSession.setLocale(new Locale(forcedLocale));
+ }
+ return gitBlitWebSession;
+ }
+
+ public IStoredSettings settings() {
+ return settings;
+ }
+
+ /**
+ * Is Gitblit running in debug mode?
+ *
+ * @return true if Gitblit is running in debug mode
+ */
+ public boolean isDebugMode() {
+ return GitBlit.isDebugMode();
+ }
+
+ /*
+ * These methods look strange... and they are... but they are the first
+ * step towards modularization across multiple commits.
+ */
+ public Date getBootDate() {
+ return GitBlit.getBootDate();
+ }
+
+ public Date getLastActivityDate() {
+ return GitBlit.getLastActivityDate();
+ }
+
+ public GitBlit runtime() {
+ return GitBlit.self();
+ }
+
+ public GitBlit mail() {
+ return GitBlit.self();
+ }
+
+ public GitBlit users() {
+ return GitBlit.self();
+ }
+
+ public GitBlit session() {
+ return GitBlit.self();
+ }
+
+ public GitBlit repositories() {
+ return GitBlit.self();
+ }
+
+ public GitBlit projects() {
+ return GitBlit.self();
+ }
+
+ public GitBlit federation() {
+ return GitBlit.self();
+ }
+
+ public GitBlit gitblit() {
+ return GitBlit.self();
+ }
+
+ public TimeZone getTimezone() {
+ return GitBlit.getTimezone();
+ }
+
+ @Override
+ public final String getConfigurationType() {
+ if (isDebugMode()) {
+ return Application.DEVELOPMENT;
+ }
+ return Application.DEPLOYMENT;
+ }
+
+ public static GitBlitWebApp get() {
+ return (GitBlitWebApp) WebApplication.get();
+ }
+}
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
-import com.gitblit.GitBlit;\r
+import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
\r
/**\r
\r
private Logger logger = LoggerFactory.getLogger(GitblitParamUrlCodingStrategy.class);\r
\r
+ private IStoredSettings settings;\r
+\r
/**\r
* Construct.\r
*\r
* @param parameterNames\r
* the parameter names (not null)\r
*/\r
- public <C extends Page> GitblitParamUrlCodingStrategy(String mountPath,\r
+ public <C extends Page> GitblitParamUrlCodingStrategy(\r
+ IStoredSettings settings,\r
+ String mountPath,\r
Class<C> bookmarkablePageClass, String[] parameterNames) {\r
+\r
super(mountPath, bookmarkablePageClass, parameterNames);\r
+ this.settings = settings;\r
}\r
\r
/**\r
*/\r
@Override\r
protected String urlEncodePathComponent(String string) {\r
- char altChar = GitBlit.getChar(Keys.web.forwardSlashCharacter, '/');\r
+ char altChar = settings.getChar(Keys.web.forwardSlashCharacter, '/');\r
if (altChar != '/') {\r
string = string.replace('/', altChar);\r
}\r
*/\r
@Override\r
protected String urlDecodePathComponent(String value) {\r
- char altChar = GitBlit.getChar(Keys.web.forwardSlashCharacter, '/');\r
+ char altChar = settings.getChar(Keys.web.forwardSlashCharacter, '/');\r
if (altChar != '/') {\r
value = value.replace(altChar, '/');\r
}\r
import com.gitblit.Constants;\r
import com.gitblit.Constants.AccessPermission;\r
import com.gitblit.Constants.FederationPullStatus;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.FederationModel;\r
import com.gitblit.models.Metric;\r
return newImage(wicketId, "file_settings_16x16.png");\r
}\r
\r
- MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());\r
+ MarkupProcessor processor = new MarkupProcessor(GitBlitWebApp.get().settings());\r
String ext = StringUtils.getFileExtension(filename).toLowerCase();\r
if (processor.getMarkupExtensions().contains(ext)) {\r
return newImage(wicketId, "file_world_16x16.png");\r
}\r
\r
public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils, boolean setCss) {\r
- String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy");\r
+ String format = GitBlitWebApp.get().settings().getString(Keys.web.datestampShortFormat, "MM/dd/yy");\r
DateFormat df = new SimpleDateFormat(format);\r
if (timeZone == null) {\r
- timeZone = GitBlit.getTimezone();\r
+ timeZone = GitBlitWebApp.get().getTimezone();\r
}\r
df.setTimeZone(timeZone);\r
String dateString;\r
}\r
\r
public static Label createTimeLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {\r
- String format = GitBlit.getString(Keys.web.timeFormat, "HH:mm");\r
+ String format = GitBlitWebApp.get().settings().getString(Keys.web.timeFormat, "HH:mm");\r
DateFormat df = new SimpleDateFormat(format);\r
if (timeZone == null) {\r
- timeZone = GitBlit.getTimezone();\r
+ timeZone = GitBlitWebApp.get().getTimezone();\r
}\r
df.setTimeZone(timeZone);\r
String timeString;\r
}\r
\r
public static Label createDatestampLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {\r
- String format = GitBlit.getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");\r
+ String format = GitBlitWebApp.get().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");\r
DateFormat df = new SimpleDateFormat(format);\r
if (timeZone == null) {\r
- timeZone = GitBlit.getTimezone();\r
+ timeZone = GitBlitWebApp.get().getTimezone();\r
}\r
df.setTimeZone(timeZone);\r
String dateString;\r
}\r
\r
public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {\r
- String format = GitBlit.getString(Keys.web.datetimestampLongFormat,\r
+ String format = GitBlitWebApp.get().settings().getString(Keys.web.datetimestampLongFormat,\r
"EEEE, MMMM d, yyyy HH:mm Z");\r
DateFormat df = new SimpleDateFormat(format);\r
if (timeZone == null) {\r
- timeZone = GitBlit.getTimezone();\r
+ timeZone = GitBlitWebApp.get().getTimezone();\r
}\r
df.setTimeZone(timeZone);\r
String dateString;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.panel.Fragment;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.Activity;\r
import com.gitblit.models.Metric;\r
// parameters\r
int daysBack = WicketUtils.getDaysBack(params);\r
if (daysBack < 1) {\r
- daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
+ daysBack = app().settings().getInteger(Keys.web.activityDuration, 7);\r
}\r
String objectId = WicketUtils.getObject(params);\r
\r
daysBack, totalCommits, totalAuthors)));\r
\r
// create the activity charts\r
- if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
+ if (app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {\r
GoogleCharts charts = createCharts(recentActivity);\r
add(new HeaderContributor(charts));\r
add(new Fragment("chartsPanel", "chartsFragment", this));\r
ActivityPage.class);\r
\r
PageParameters currentParameters = getPageParameters();\r
- int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
+ int daysBack = app().settings().getInteger(Keys.web.activityDuration, 7);\r
if (currentParameters != null && !currentParameters.containsKey("db")) {\r
currentParameters.put("db", daysBack);\r
}\r
import com.gitblit.Constants.AccessRestrictionType;\r
import com.gitblit.Constants.AuthorizationControl;\r
import com.gitblit.Constants.FederationStrategy;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.ProjectModel;\r
import com.gitblit.models.TeamModel;\r
}\r
\r
private void customizeHeader() {\r
- if (GitBlit.getBoolean(Keys.web.useResponsiveLayout, true)) {\r
+ if (app().settings().getBoolean(Keys.web.useResponsiveLayout, true)) {\r
add(CSSPackageResource.getHeaderContribution("bootstrap/css/bootstrap-responsive.css"));\r
}\r
}\r
\r
@Override\r
protected void onBeforeRender() {\r
- if (GitBlit.isDebugMode()) {\r
+ if (app().isDebugMode()) {\r
// strip Wicket tags in debug mode for jQuery DOM traversal\r
Application.get().getMarkupSettings().setStripWicketTags(true);\r
}\r
\r
@Override\r
protected void onAfterRender() {\r
- if (GitBlit.isDebugMode()) {\r
+ if (app().isDebugMode()) {\r
// restore Wicket debug tags\r
Application.get().getMarkupSettings().setStripWicketTags(false);\r
}\r
protected void setHeaders(WebResponse response) {\r
// set canonical link as http header for SEO (issue-304)\r
// https://support.google.com/webmasters/answer/139394?hl=en\r
- response.setHeader("Link" ,MessageFormat.format("<{0}>; rel=\"canonical\"", getCanonicalUrl()));\r
- int expires = GitBlit.getInteger(Keys.web.pageCacheExpires, 0);\r
+ response.setHeader("Link", MessageFormat.format("<{0}>; rel=\"canonical\"", getCanonicalUrl()));\r
+ int expires = app().settings().getInteger(Keys.web.pageCacheExpires, 0);\r
if (expires > 0) {\r
// pages are personalized for the authenticated user so they must be\r
// marked private to prohibit proxy servers from caching them\r
CacheControl cacheControl = getClass().getAnnotation(CacheControl.class);\r
switch (cacheControl.value()) {\r
case ACTIVITY:\r
- setLastModified(GitBlit.getLastActivityDate());\r
+ setLastModified(app().getLastActivityDate());\r
break;\r
case BOOT:\r
- setLastModified(GitBlit.getBootDate());\r
+ setLastModified(app().getBootDate());\r
break;\r
case NONE:\r
break;\r
return;\r
}\r
\r
- if (when.before(GitBlit.getBootDate())) {\r
+ if (when.before(app().getBootDate())) {\r
// last-modified can not be before the Gitblit boot date\r
// this helps ensure that pages are properly refreshed after a\r
// server config change\r
- when = GitBlit.getBootDate();\r
+ when = app().getBootDate();\r
}\r
\r
- int expires = GitBlit.getInteger(Keys.web.pageCacheExpires, 0);\r
+ int expires = app().settings().getInteger(Keys.web.pageCacheExpires, 0);\r
WebResponse response = (WebResponse) getResponse();\r
response.setLastModifiedTime(Time.valueOf(when));\r
response.setDateHeader("Expires", System.currentTimeMillis() + Duration.minutes(expires).getMilliseconds());\r
}\r
\r
protected void setupPage(String repositoryName, String pageName) {\r
- String siteName = GitBlit.getString(Keys.web.siteName, Constants.NAME);\r
+ String siteName = app().settings().getString(Keys.web.siteName, Constants.NAME);\r
if (StringUtils.isEmpty(siteName)) {\r
siteName = Constants.NAME;\r
}\r
add(new Label("title", siteName));\r
}\r
\r
- String rootLinkUrl = GitBlit.getString(Keys.web.rootLink, urlFor(GitBlitWebApp.get().getHomePage(), null).toString());\r
+ String rootLinkUrl = app().settings().getString(Keys.web.rootLink, urlFor(GitBlitWebApp.get().getHomePage(), null).toString());\r
ExternalLink rootLink = new ExternalLink("rootLink", rootLinkUrl);\r
- WicketUtils.setHtmlTooltip(rootLink, GitBlit.getString(Keys.web.siteName, Constants.NAME));\r
+ WicketUtils.setHtmlTooltip(rootLink, app().settings().getString(Keys.web.siteName, Constants.NAME));\r
add(rootLink);\r
\r
// Feedback panel for info, warning, and non-fatal error messages\r
add(new FeedbackPanel("feedback"));\r
\r
add(new Label("gbVersion", "v" + Constants.getVersion()));\r
- if (GitBlit.getBoolean(Keys.web.aggressiveHeapManagement, false)) {\r
+ if (app().settings().getBoolean(Keys.web.aggressiveHeapManagement, false)) {\r
System.gc();\r
}\r
}\r
}\r
\r
protected TimeZone getTimeZone() {\r
- return GitBlit.getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get()\r
- .getTimezone() : GitBlit.getTimezone();\r
+ return app().settings().getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get()\r
+ .getTimezone() : app().getTimezone();\r
}\r
\r
protected String getServerName() {\r
\r
protected List<ProjectModel> getProjectModels() {\r
final UserModel user = GitBlitWebSession.get().getUser();\r
- List<ProjectModel> projects = GitBlit.self().getProjectModels(user, true);\r
+ List<ProjectModel> projects = app().projects().getProjectModels(user, true);\r
return projects;\r
}\r
\r
String regex = WicketUtils.getRegEx(params);\r
String team = WicketUtils.getTeam(params);\r
int daysBack = params.getInt("db", 0);\r
- int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);\r
+ int maxDaysBack = app().settings().getInteger(Keys.web.activityDurationMaximum, 30);\r
\r
List<ProjectModel> availableModels = getProjectModels();\r
Set<ProjectModel> models = new HashSet<ProjectModel>();\r
// need TeamModels first\r
List<TeamModel> teamModels = new ArrayList<TeamModel>();\r
for (String name : teams) {\r
- TeamModel teamModel = GitBlit.self().getTeamModel(name);\r
+ TeamModel teamModel = app().users().getTeamModel(name);\r
if (teamModel != null) {\r
teamModels.add(teamModel);\r
}\r
import org.eclipse.jgit.lib.ObjectId;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.AnnotatedLine;\r
import com.gitblit.models.PathModel;\r
\r
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));\r
\r
- String format = GitBlit.getString(Keys.web.datetimestampLongFormat,\r
+ String format = app().settings().getString(Keys.web.datetimestampLongFormat,\r
"EEEE, MMMM d, yyyy HH:mm Z");\r
final DateFormat df = new SimpleDateFormat(format);\r
df.setTimeZone(getTimeZone());\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
\r
Repository r = getRepository();\r
final String blobPath = WicketUtils.getPath(params);\r
- String [] encodings = GitBlit.getEncodings();\r
+ String [] encodings = getEncodings();\r
\r
if (StringUtils.isEmpty(blobPath)) {\r
// blob by objectid\r
}\r
\r
// see if we should redirect to the doc page\r
- MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());\r
+ MarkupProcessor processor = new MarkupProcessor(app().settings());\r
for (String ext : processor.getMarkupExtensions()) {\r
if (ext.equals(extension)) {\r
setResponsePage(DocPage.class, params);\r
\r
// Map the extensions to types\r
Map<String, Integer> map = new HashMap<String, Integer>();\r
- for (String ext : GitBlit.getStrings(Keys.web.prettyPrintExtensions)) {\r
+ for (String ext : app().settings().getStrings(Keys.web.prettyPrintExtensions)) {\r
map.put(ext.toLowerCase(), 1);\r
}\r
- for (String ext : GitBlit.getStrings(Keys.web.imageExtensions)) {\r
+ for (String ext : app().settings().getStrings(Keys.web.imageExtensions)) {\r
map.put(ext.toLowerCase(), 2);\r
}\r
- for (String ext : GitBlit.getStrings(Keys.web.binaryExtensions)) {\r
+ for (String ext : app().settings().getStrings(Keys.web.binaryExtensions)) {\r
map.put(ext.toLowerCase(), 3);\r
}\r
\r
import org.apache.wicket.model.Model;\r
import org.apache.wicket.protocol.http.WebResponse;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.Keys;\r
import com.gitblit.models.UserModel;\r
throw new RestartResponseException(getApplication().getHomePage());\r
}\r
\r
- if (!GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)\r
- && !GitBlit.getBoolean(Keys.web.authenticateViewPages, false)) {\r
+ if (!app().settings().getBoolean(Keys.web.authenticateAdminPages, true)\r
+ && !app().settings().getBoolean(Keys.web.authenticateViewPages, false)) {\r
// no authentication enabled\r
throw new RestartResponseException(getApplication().getHomePage());\r
}\r
\r
UserModel user = GitBlitWebSession.get().getUser();\r
- if (!GitBlit.self().supportsCredentialChanges(user)) {\r
+ if (!app().users().supportsCredentialChanges(user)) {\r
error(MessageFormat.format(getString("gb.userServiceDoesNotPermitPasswordChanges"),\r
- GitBlit.getString(Keys.realm.userService, "${baseFolder}/users.conf")), true);\r
+ app().settings().getString(Keys.realm.userService, "${baseFolder}/users.conf")), true);\r
}\r
\r
setupPage(getString("gb.changePassword"), user.username);\r
}\r
\r
// ensure password satisfies minimum length requirement\r
- int minLength = GitBlit.getInteger(Keys.realm.minPasswordLength, 5);\r
+ int minLength = app().settings().getInteger(Keys.realm.minPasswordLength, 5);\r
if (minLength < 4) {\r
minLength = 4;\r
}\r
UserModel user = GitBlitWebSession.get().getUser();\r
\r
// convert to MD5 digest, if appropriate\r
- String type = GitBlit.getString(Keys.realm.passwordStorage, "md5");\r
+ String type = app().settings().getString(Keys.realm.passwordStorage, "md5");\r
if (type.equalsIgnoreCase("md5")) {\r
// store MD5 digest of password\r
password = StringUtils.MD5_TYPE + StringUtils.getMD5(password);\r
\r
user.password = password;\r
try {\r
- GitBlit.self().updateUserModel(user.username, user, false);\r
- if (GitBlit.getBoolean(Keys.web.allowCookieAuthentication, false)) {\r
+ app().users().updateUserModel(user.username, user, false);\r
+ if (app().settings().getBoolean(Keys.web.allowCookieAuthentication, false)) {\r
WebResponse response = (WebResponse) getRequestCycle().getResponse();\r
- GitBlit.self().setCookie(response, user);\r
+ app().session().setCookie(response, user);\r
}\r
} catch (GitBlitException e) {\r
error(e.getMessage());\r
import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.Constants;
-import com.gitblit.GitBlit;
import com.gitblit.models.GitNote;
import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.models.SubmoduleModel;
item.add(new GravatarImage("noteAuthorAvatar", entry.notesRef.getAuthorIdent()));
item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef
.getAuthorIdent().getWhen(), getTimeZone(), getTimeUtils()));
- item.add(new Label("noteContent", GitBlit.self().processPlainCommitMessage(repositoryName,
+ item.add(new Label("noteContent", messageProcessor().processPlainCommitMessage(repositoryName,
entry.content)).setEscapeModelStrings(false));
}
};
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.GitNote;\r
import com.gitblit.models.PathModel.PathChangeModel;\r
import com.gitblit.models.SubmoduleModel;\r
item.add(new GravatarImage("noteAuthorAvatar", entry.notesRef.getAuthorIdent()));\r
item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef\r
.getAuthorIdent().getWhen(), getTimeZone(), getTimeUtils()));\r
- item.add(new Label("noteContent", GitBlit.self().processPlainCommitMessage(repositoryName,\r
+ item.add(new Label("noteContent", messageProcessor().processPlainCommitMessage(repositoryName,\r
entry.content)).setEscapeModelStrings(false));\r
}\r
};\r
import org.apache.wicket.markup.html.panel.Fragment;\r
import org.eclipse.jgit.lib.Repository;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.DailyLogEntry;\r
import com.gitblit.models.Metric;\r
continue;\r
}\r
if (model.hasCommits && model.lastChange.after(minimumDate)) {\r
- Repository repository = GitBlit.self().getRepository(model.name);\r
+ Repository repository = app().repositories().getRepository(model.name);\r
List<DailyLogEntry> entries = RefLogUtils.getDailyLogByRef(model.name, repository, minimumDate, timezone);\r
digests.addAll(entries);\r
repository.close();\r
if (!ArrayUtils.isEmpty(digests)) {\r
// aggregate author exclusions\r
Set<String> authorExclusions = new TreeSet<String>();\r
- for (String author : GitBlit.getStrings(Keys.web.metricAuthorExclusions)) {\r
+ for (String author : app().settings().getStrings(Keys.web.metricAuthorExclusions)) {\r
authorExclusions.add(author.toLowerCase());\r
}\r
for (RepositoryModel model : repositories) {\r
frag.add(new Label("feedheader", MessageFormat.format(headerPattern,\r
daysBack, totalCommits, authorMetrics.size())));\r
\r
- if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
+ if (app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {\r
// build google charts\r
GoogleCharts charts = new GoogleCharts();\r
\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.CacheControl;\r
super(params);\r
\r
final String path = WicketUtils.getPath(params).replace("%2f", "/").replace("%2F", "/");\r
- MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());\r
+ MarkupProcessor processor = new MarkupProcessor(app().settings());\r
\r
Repository r = getRepository();\r
RevCommit commit = JGitUtils.getCommit(r, objectId);\r
- String [] encodings = GitBlit.getEncodings();\r
+ String [] encodings = getEncodings();\r
\r
// Read raw markup content and transform it to html\r
String documentPath = path;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.PathModel;\r
import com.gitblit.utils.ByteFormat;\r
import com.gitblit.utils.JGitUtils;\r
public DocsPage(PageParameters params) {\r
super(params);\r
\r
- MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());\r
+ MarkupProcessor processor = new MarkupProcessor(app().settings());\r
\r
Repository r = getRepository();\r
RevCommit head = JGitUtils.getCommit(r, null);\r
import com.gitblit.Constants.CommitMessageRenderer;\r
import com.gitblit.Constants.FederationStrategy;\r
import com.gitblit.Constants.RegistrantType;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RegistrantAccessPermission;\r
super();\r
isCreate = true;\r
RepositoryModel model = new RepositoryModel();\r
- String restriction = GitBlit.getString(Keys.git.defaultAccessRestriction, "PUSH");\r
+ String restriction = app().settings().getString(Keys.git.defaultAccessRestriction, "PUSH");\r
model.accessRestriction = AccessRestrictionType.fromName(restriction);\r
- String authorization = GitBlit.getString(Keys.git.defaultAuthorizationControl, null);\r
+ String authorization = app().settings().getString(Keys.git.defaultAuthorizationControl, null);\r
model.authorizationControl = AuthorizationControl.fromName(authorization);\r
\r
GitBlitWebSession session = GitBlitWebSession.get();\r
super(params);\r
isCreate = false;\r
String name = WicketUtils.getRepositoryName(params);\r
- RepositoryModel model = GitBlit.self().getRepositoryModel(name);\r
+ RepositoryModel model = app().repositories().getRepositoryModel(name);\r
setupPage(model);\r
setStatelessHint(false);\r
setOutputMarkupId(true);\r
}\r
} else {\r
super.setupPage(getString("gb.edit"), repositoryModel.name);\r
- repositoryUsers.addAll(GitBlit.self().getUserAccessPermissions(repositoryModel));\r
- repositoryTeams.addAll(GitBlit.self().getTeamAccessPermissions(repositoryModel));\r
+ repositoryUsers.addAll(app().repositories().getUserAccessPermissions(repositoryModel));\r
+ repositoryTeams.addAll(app().repositories().getTeamAccessPermissions(repositoryModel));\r
Collections.sort(repositoryUsers);\r
Collections.sort(repositoryTeams);\r
\r
final String oldName = repositoryModel.name;\r
\r
final RegistrantPermissionsPanel usersPalette = new RegistrantPermissionsPanel("users",\r
- RegistrantType.USER, GitBlit.self().getAllUsernames(), repositoryUsers, getAccessPermissions());\r
+ RegistrantType.USER, app().users().getAllUsernames(), repositoryUsers, getAccessPermissions());\r
final RegistrantPermissionsPanel teamsPalette = new RegistrantPermissionsPanel("teams",\r
- RegistrantType.TEAM, GitBlit.self().getAllTeamnames(), repositoryTeams, getAccessPermissions());\r
+ RegistrantType.TEAM, app().users().getAllTeamnames(), repositoryTeams, getAccessPermissions());\r
\r
// owners palette\r
List<String> owners = new ArrayList<String>(repositoryModel.owners);\r
- List<String> persons = GitBlit.self().getAllUsernames();\r
+ List<String> persons = app().users().getAllUsernames();\r
final Palette<String> ownersPalette = new Palette<String>("owners", new ListModel<String>(owners), new CollectionModel<String>(\r
persons), new StringChoiceRenderer(), 12, true);\r
\r
List<String> allLocalBranches = new ArrayList<String>();\r
allLocalBranches.add(Constants.DEFAULT_BRANCH);\r
allLocalBranches.addAll(repositoryModel.getLocalBranches());\r
- boolean luceneEnabled = GitBlit.getBoolean(Keys.web.allowLuceneIndexing, true);\r
+ boolean luceneEnabled = app().settings().getBoolean(Keys.web.allowLuceneIndexing, true);\r
final Palette<String> indexedBranchesPalette = new Palette<String>("indexedBranches", new ListModel<String>(\r
indexedBranches), new CollectionModel<String>(allLocalBranches),\r
new StringChoiceRenderer(), 8, false);\r
indexedBranchesPalette.setEnabled(luceneEnabled);\r
\r
// federation sets palette\r
- List<String> sets = GitBlit.getStrings(Keys.federation.sets);\r
+ List<String> sets = app().settings().getStrings(Keys.federation.sets);\r
final Palette<String> federationSetsPalette = new Palette<String>("federationSets",\r
new ListModel<String>(federationSets), new CollectionModel<String>(sets),\r
new StringChoiceRenderer(), 8, false);\r
preReceiveScripts.addAll(repositoryModel.preReceiveScripts);\r
}\r
final Palette<String> preReceivePalette = new Palette<String>("preReceiveScripts",\r
- new ListModel<String>(preReceiveScripts), new CollectionModel<String>(GitBlit\r
- .self().getPreReceiveScriptsUnused(repositoryModel)),\r
+ new ListModel<String>(preReceiveScripts), new CollectionModel<String>(app().repositories()\r
+ .getPreReceiveScriptsUnused(repositoryModel)),\r
new StringChoiceRenderer(), 12, true);\r
\r
// post-receive palette\r
postReceiveScripts.addAll(repositoryModel.postReceiveScripts);\r
}\r
final Palette<String> postReceivePalette = new Palette<String>("postReceiveScripts",\r
- new ListModel<String>(postReceiveScripts), new CollectionModel<String>(GitBlit\r
- .self().getPostReceiveScriptsUnused(repositoryModel)),\r
+ new ListModel<String>(postReceiveScripts), new CollectionModel<String>(app().repositories()\r
+ .getPostReceiveScriptsUnused(repositoryModel)),\r
new StringChoiceRenderer(), 12, true);\r
\r
// custom fields\r
- final Map<String, String> customFieldsMap = GitBlit.getMap(Keys.groovy.customFields);\r
+ final Map<String, String> customFieldsMap = app().settings().getMap(Keys.groovy.customFields);\r
List<String> customKeys = new ArrayList<String>(customFieldsMap.keySet());\r
final ListView<String> customFieldsListView = new ListView<String>("customFieldsListView", customKeys) {\r
\r
}\r
\r
// save the repository\r
- GitBlit.self().updateRepositoryModel(oldName, repositoryModel, isCreate);\r
+ app().repositories().updateRepositoryModel(oldName, repositoryModel, isCreate);\r
\r
// repository access permissions\r
if (repositoryModel.accessRestriction.exceeds(AccessRestrictionType.NONE)) {\r
- GitBlit.self().setUserAccessPermissions(repositoryModel, repositoryUsers);\r
- GitBlit.self().setTeamAccessPermissions(repositoryModel, repositoryTeams);\r
+ app().repositories().setUserAccessPermissions(repositoryModel, repositoryUsers);\r
+ app().repositories().setTeamAccessPermissions(repositoryModel, repositoryTeams);\r
}\r
} catch (GitBlitException e) {\r
error(e.getMessage());\r
form.add(new TextField<String>("name").setEnabled(allowEditName));\r
form.add(new TextField<String>("description"));\r
form.add(ownersPalette);\r
- form.add(new CheckBox("allowForks").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));\r
+ form.add(new CheckBox("allowForks").setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));\r
DropDownChoice<AccessRestrictionType> accessRestriction = new DropDownChoice<AccessRestrictionType>("accessRestriction",\r
- AccessRestrictionType.choices(GitBlit.getBoolean(Keys.git.allowAnonymousPushes, false)), new AccessRestrictionRenderer());\r
+ AccessRestrictionType.choices(app().settings().getBoolean(Keys.git.allowAnonymousPushes, false)), new AccessRestrictionRenderer());\r
form.add(accessRestriction);\r
form.add(new CheckBox("isFrozen"));\r
// TODO enable origin definition\r
}\r
form.add(new DropDownChoice<String>("HEAD", availableRefs).setEnabled(availableRefs.size() > 0));\r
\r
- boolean gcEnabled = GitBlit.getBoolean(Keys.git.enableGarbageCollection, false);\r
+ boolean gcEnabled = app().settings().getBoolean(Keys.git.enableGarbageCollection, false);\r
List<Integer> gcPeriods = Arrays.asList(1, 2, 3, 4, 5, 7, 10, 14 );\r
form.add(new DropDownChoice<Integer>("gcPeriod", gcPeriods, new GCPeriodRenderer()).setEnabled(gcEnabled));\r
form.add(new TextField<String>("gcThreshold").setEnabled(gcEnabled));\r
form.add(teamsPalette);\r
form.add(federationSetsPalette);\r
form.add(preReceivePalette);\r
- form.add(new BulletListPanel("inheritedPreReceive", getString("gb.inherited"), GitBlit.self()\r
+ form.add(new BulletListPanel("inheritedPreReceive", getString("gb.inherited"), app().repositories()\r
.getPreReceiveScriptsInherited(repositoryModel)));\r
form.add(postReceivePalette);\r
- form.add(new BulletListPanel("inheritedPostReceive", getString("gb.inherited"), GitBlit.self()\r
+ form.add(new BulletListPanel("inheritedPostReceive", getString("gb.inherited"), app().repositories()\r
.getPostReceiveScriptsInherited(repositoryModel)));\r
\r
WebMarkupContainer customFieldsSection = new WebMarkupContainer("customFieldsSection");\r
customFieldsSection.add(customFieldsListView);\r
- form.add(customFieldsSection.setVisible(!GitBlit.getString(Keys.groovy.customFields, "").isEmpty()));\r
+ form.add(customFieldsSection.setVisible(!app().settings().getString(Keys.groovy.customFields, "").isEmpty()));\r
\r
// initial enable/disable of permission controls\r
if (repositoryModel.accessRestriction.equals(AccessRestrictionType.NONE)) {\r
* Repository Owners should be able to edit their repository.\r
*/\r
private void checkPermissions(RepositoryModel model) {\r
- boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);\r
- boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);\r
+ boolean authenticateAdmin = app().settings().getBoolean(Keys.web.authenticateAdminPages, true);\r
+ boolean allowAdmin = app().settings().getBoolean(Keys.web.allowAdministration, true);\r
\r
GitBlitWebSession session = GitBlitWebSession.get();\r
UserModel user = session.getUser();\r
import org.apache.wicket.model.util.ListModel;\r
\r
import com.gitblit.Constants.RegistrantType;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RegistrantAccessPermission;\r
super(params);\r
isCreate = false;\r
String name = WicketUtils.getTeamname(params);\r
- TeamModel model = GitBlit.self().getTeamModel(name);\r
+ TeamModel model = app().users().getTeamModel(name);\r
setupPage(model);\r
setStatelessHint(false);\r
setOutputMarkupId(true);\r
\r
// users palette\r
final Palette<String> users = new Palette<String>("users", new ListModel<String>(\r
- new ArrayList<String>(teamUsers)), new CollectionModel<String>(GitBlit.self()\r
+ new ArrayList<String>(teamUsers)), new CollectionModel<String>(app().users()\r
.getAllUsernames()), new StringChoiceRenderer(), 10, false);\r
\r
// pre-receive palette\r
preReceiveScripts.addAll(teamModel.preReceiveScripts);\r
}\r
final Palette<String> preReceivePalette = new Palette<String>("preReceiveScripts",\r
- new ListModel<String>(preReceiveScripts), new CollectionModel<String>(GitBlit\r
- .self().getPreReceiveScriptsUnused(null)), new StringChoiceRenderer(),\r
+ new ListModel<String>(preReceiveScripts), new CollectionModel<String>(app().repositories()\r
+ .getPreReceiveScriptsUnused(null)), new StringChoiceRenderer(),\r
12, true);\r
\r
// post-receive palette\r
postReceiveScripts.addAll(teamModel.postReceiveScripts);\r
}\r
final Palette<String> postReceivePalette = new Palette<String>("postReceiveScripts",\r
- new ListModel<String>(postReceiveScripts), new CollectionModel<String>(GitBlit\r
- .self().getPostReceiveScriptsUnused(null)), new StringChoiceRenderer(),\r
+ new ListModel<String>(postReceiveScripts), new CollectionModel<String>(app().repositories()\r
+ .getPostReceiveScriptsUnused(null)), new StringChoiceRenderer(),\r
12, true);\r
\r
Form<TeamModel> form = new Form<TeamModel>("editForm", model) {\r
return;\r
}\r
if (isCreate) {\r
- TeamModel model = GitBlit.self().getTeamModel(teamname);\r
+ TeamModel model = app().users().getTeamModel(teamname);\r
if (model != null) {\r
error(MessageFormat.format(getString("gb.teamNameUnavailable"), teamname));\r
return;\r
teamModel.postReceiveScripts.addAll(postReceiveScripts);\r
\r
try {\r
- GitBlit.self().updateTeamModel(oldName, teamModel, isCreate);\r
+ app().users().updateTeamModel(oldName, teamModel, isCreate);\r
} catch (GitBlitException e) {\r
error(e.getMessage());\r
return;\r
form.add(new SimpleAttributeModifier("autocomplete", "off"));\r
\r
// not all user services support manipulating team memberships\r
- boolean editMemberships = GitBlit.self().supportsTeamMembershipChanges(null);\r
+ boolean editMemberships = app().users().supportsTeamMembershipChanges(null);\r
\r
// field names reflective match TeamModel fields\r
form.add(new TextField<String>("name"));\r
form.add(new CheckBox("canAdmin"));\r
- form.add(new CheckBox("canFork").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));\r
+ form.add(new CheckBox("canFork").setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));\r
form.add(new CheckBox("canCreate"));\r
form.add(users.setEnabled(editMemberships));\r
mailingLists = new Model<String>(teamModel.mailingLists == null ? ""\r
form.add(new RegistrantPermissionsPanel("repositories", RegistrantType.REPOSITORY,\r
repos, permissions, getAccessPermissions()));\r
form.add(preReceivePalette);\r
- form.add(new BulletListPanel("inheritedPreReceive", "inherited", GitBlit.self()\r
+ form.add(new BulletListPanel("inheritedPreReceive", "inherited", app().repositories()\r
.getPreReceiveScriptsInherited(null)));\r
form.add(postReceivePalette);\r
- form.add(new BulletListPanel("inheritedPostReceive", "inherited", GitBlit.self()\r
+ form.add(new BulletListPanel("inheritedPostReceive", "inherited", app().repositories()\r
.getPostReceiveScriptsInherited(null)));\r
\r
form.add(new Button("save"));\r
import org.apache.wicket.model.util.ListModel;\r
\r
import com.gitblit.Constants.RegistrantType;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RegistrantAccessPermission;\r
public EditUserPage() {\r
// create constructor\r
super();\r
- if (!GitBlit.self().supportsAddUser()) {\r
+ if (!app().users().supportsAddUser()) {\r
error(MessageFormat.format(getString("gb.userServiceDoesNotPermitAddUser"),\r
- GitBlit.getString(Keys.realm.userService, "${baseFolder}/users.conf")), true);\r
+ app().settings().getString(Keys.realm.userService, "${baseFolder}/users.conf")), true);\r
}\r
isCreate = true;\r
setupPage(new UserModel(""));\r
super(params);\r
isCreate = false;\r
String name = WicketUtils.getUsername(params);\r
- UserModel model = GitBlit.self().getUserModel(name);\r
+ UserModel model = app().users().getUserModel(name);\r
setupPage(model);\r
setStatelessHint(false);\r
setOutputMarkupId(true);\r
Collections.sort(userTeams);\r
\r
final String oldName = userModel.username;\r
- final List<RegistrantAccessPermission> permissions = GitBlit.self().getUserAccessPermissions(userModel);\r
+ final List<RegistrantAccessPermission> permissions = app().repositories().getUserAccessPermissions(userModel);\r
\r
final Palette<String> teams = new Palette<String>("teams", new ListModel<String>(\r
- new ArrayList<String>(userTeams)), new CollectionModel<String>(GitBlit.self()\r
+ new ArrayList<String>(userTeams)), new CollectionModel<String>(app().users()\r
.getAllTeamnames()), new StringChoiceRenderer(), 10, false);\r
Form<UserModel> form = new Form<UserModel>("editForm", model) {\r
\r
userModel.username = userModel.username.toLowerCase();\r
String username = userModel.username;\r
if (isCreate) {\r
- UserModel model = GitBlit.self().getUserModel(username);\r
+ UserModel model = app().users().getUserModel(username);\r
if (model != null) {\r
error(MessageFormat.format(getString("gb.usernameUnavailable"), username));\r
return;\r
}\r
boolean rename = !StringUtils.isEmpty(oldName)\r
&& !oldName.equalsIgnoreCase(username);\r
- if (GitBlit.self().supportsCredentialChanges(userModel)) {\r
+ if (app().users().supportsCredentialChanges(userModel)) {\r
if (!userModel.password.equals(confirmPassword.getObject())) {\r
error(getString("gb.passwordsDoNotMatch"));\r
return;\r
&& !password.toUpperCase().startsWith(StringUtils.COMBINED_MD5_TYPE)) {\r
// This is a plain text password.\r
// Check length.\r
- int minLength = GitBlit.getInteger(Keys.realm.minPasswordLength, 5);\r
+ int minLength = app().settings().getInteger(Keys.realm.minPasswordLength, 5);\r
if (minLength < 4) {\r
minLength = 4;\r
}\r
}\r
\r
// Optionally store the password MD5 digest.\r
- String type = GitBlit.getString(Keys.realm.passwordStorage, "md5");\r
+ String type = app().settings().getString(Keys.realm.passwordStorage, "md5");\r
if (type.equalsIgnoreCase("md5")) {\r
// store MD5 digest of password\r
userModel.password = StringUtils.MD5_TYPE\r
Iterator<String> selectedTeams = teams.getSelectedChoices();\r
userModel.teams.clear();\r
while (selectedTeams.hasNext()) {\r
- TeamModel team = GitBlit.self().getTeamModel(selectedTeams.next());\r
+ TeamModel team = app().users().getTeamModel(selectedTeams.next());\r
if (team == null) {\r
continue;\r
}\r
}\r
\r
try {\r
- GitBlit.self().updateUserModel(oldName, userModel, isCreate);\r
+ app().users().updateUserModel(oldName, userModel, isCreate);\r
} catch (GitBlitException e) {\r
error(e.getMessage());\r
return;\r
form.add(new SimpleAttributeModifier("autocomplete", "off"));\r
\r
// not all user services support manipulating username and password\r
- boolean editCredentials = GitBlit.self().supportsCredentialChanges(userModel);\r
+ boolean editCredentials = app().users().supportsCredentialChanges(userModel);\r
\r
// not all user services support manipulating display name\r
- boolean editDisplayName = GitBlit.self().supportsDisplayNameChanges(userModel);\r
+ boolean editDisplayName = app().users().supportsDisplayNameChanges(userModel);\r
\r
// not all user services support manipulating email address\r
- boolean editEmailAddress = GitBlit.self().supportsEmailAddressChanges(userModel);\r
+ boolean editEmailAddress = app().users().supportsEmailAddressChanges(userModel);\r
\r
// not all user services support manipulating team memberships\r
- boolean editTeams = GitBlit.self().supportsTeamMembershipChanges(userModel);\r
+ boolean editTeams = app().users().supportsTeamMembershipChanges(userModel);\r
\r
// field names reflective match UserModel fields\r
form.add(new TextField<String>("username").setEnabled(editCredentials));\r
form.add(new TextField<String>("displayName").setEnabled(editDisplayName));\r
form.add(new TextField<String>("emailAddress").setEnabled(editEmailAddress));\r
form.add(new CheckBox("canAdmin"));\r
- form.add(new CheckBox("canFork").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));\r
+ form.add(new CheckBox("canFork").setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));\r
form.add(new CheckBox("canCreate"));\r
form.add(new CheckBox("excludeFromFederation"));\r
form.add(new RegistrantPermissionsPanel("repositories", RegistrantType.REPOSITORY, repos, permissions, getAccessPermissions()));\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.protocol.http.WebRequest;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.RepositoryUrl;\r
import com.gitblit.models.UserModel;\r
setVersioned(false);\r
\r
String repositoryName = WicketUtils.getRepositoryName(params);\r
- RepositoryModel repository = GitBlit.self().getRepositoryModel(repositoryName);\r
+ RepositoryModel repository = app().repositories().getRepositoryModel(repositoryName);\r
if (repository == null) {\r
error(getString("gb.canNotLoadRepository") + " " + repositoryName, true);\r
}\r
}\r
\r
HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();\r
- List<RepositoryUrl> repositoryUrls = GitBlit.self().getRepositoryUrls(req, user, repository);\r
+ List<RepositoryUrl> repositoryUrls = app().repositories().getRepositoryUrls(req, user, repository);\r
RepositoryUrl primaryUrl = repositoryUrls.size() == 0 ? null : repositoryUrls.get(0);\r
String url = primaryUrl != null ? primaryUrl.url : "";\r
\r
*/\r
package com.gitblit.wicket.pages;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.wicket.panels.FederationProposalsPanel;\r
import com.gitblit.wicket.panels.FederationRegistrationsPanel;\r
super();\r
setupPage("", "");\r
\r
- boolean showFederation = showAdmin && GitBlit.canFederate();\r
+ boolean showFederation = showAdmin && app().federation().canFederate();\r
add(new FederationTokensPanel("federationTokensPanel", showFederation)\r
.setVisible(showFederation));\r
FederationProposalsPanel proposalsPanel = new FederationProposalsPanel(\r
proposalsPanel.setVisible(false);\r
}\r
\r
- boolean showRegistrations = GitBlit.getBoolean(Keys.web.showFederationRegistrations, false);\r
+ boolean showRegistrations = app().settings().getBoolean(Keys.web.showFederationRegistrations, false);\r
FederationRegistrationsPanel registrationsPanel = new FederationRegistrationsPanel(\r
"federationRegistrationsPanel");\r
if (showAdmin || showRegistrations) {\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.FederationModel;\r
import com.gitblit.models.FederationModel.RepositoryStatus;\r
import com.gitblit.wicket.WicketUtils;\r
String url = WicketUtils.getUrlParameter(params);\r
String name = WicketUtils.getNameParameter(params);\r
\r
- FederationModel registration = GitBlit.self().getFederationRegistration(url, name);\r
+ FederationModel registration = app().federation().getFederationRegistration(url, name);\r
if (registration == null) {\r
error(getString("gb.couldNotFindFederationRegistration"), true);\r
}\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.slf4j.LoggerFactory;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
+import com.gitblit.wicket.GitBlitWebApp;\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.GitblitRedirectException;\r
import com.gitblit.wicket.WicketUtils;\r
throw new GitblitRedirectException(SummaryPage.class, WicketUtils.newRepositoryParameter(repository.name));\r
}\r
\r
- String fork = GitBlit.self().getFork(user.username, repository.name);\r
+ String fork = app().repositories().getFork(user.username, repository.name);\r
if (fork != null) {\r
// redirect to user's fork\r
throw new GitblitRedirectException(SummaryPage.class, WicketUtils.newRepositoryParameter(fork));\r
session.isForking(true);\r
\r
// fork it\r
- ForkThread forker = new ForkThread(repository, session);\r
+ ForkThread forker = new ForkThread(app(), repository, session);\r
forker.start();\r
}\r
}\r
*/\r
private static class ForkThread extends Thread {\r
\r
+ private final GitBlitWebApp app;\r
private final RepositoryModel repository;\r
private final GitBlitWebSession session;\r
\r
- public ForkThread(RepositoryModel repository, GitBlitWebSession session) {\r
+ public ForkThread(GitBlitWebApp app, RepositoryModel repository, GitBlitWebSession session) {\r
+ this.app = app;\r
this.repository = repository;\r
this.session = session;\r
}\r
public void run() {\r
UserModel user = session.getUser();\r
try {\r
- GitBlit.self().fork(repository, user);\r
+ app.gitblit().fork(repository, user);\r
} catch (Exception e) {\r
LoggerFactory.getLogger(ForkPage.class).error(MessageFormat.format("Failed to fork {0} for {1}", repository.name, user.username), e);\r
} finally {\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
import org.eclipse.jgit.lib.PersonIdent;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.ForkModel;\r
import com.gitblit.models.RepositoryModel;\r
\r
final RepositoryModel pageRepository = getRepositoryModel();\r
\r
- ForkModel root = GitBlit.self().getForkNetwork(pageRepository.name);\r
+ ForkModel root = app().repositories().getForkNetwork(pageRepository.name);\r
List<FlatFork> network = flatten(root);\r
\r
ListDataProvider<FlatFork> forksDp = new ListDataProvider<FlatFork>(network);\r
RepositoryModel repository = fork.repository;\r
\r
if (repository.isPersonalRepository()) {\r
- UserModel user = GitBlit.self().getUserModel(repository.projectPath.substring(1));\r
+ UserModel user = app().users().getUserModel(repository.projectPath.substring(1));\r
if (user == null) {\r
// user account no longer exists\r
user = new UserModel(repository.projectPath.substring(1));\r
item.add(swatch);\r
String projectName = repository.projectPath;\r
if (StringUtils.isEmpty(projectName)) {\r
- projectName = GitBlit.getString(Keys.web.repositoryRootGroupName, "main");\r
+ projectName = app().settings().getString(Keys.web.repositoryRootGroupName, "main");\r
}\r
if (pageRepository.equals(repository)) {\r
// do not link to self\r
import org.apache.wicket.protocol.http.WebRequest;\r
import org.apache.wicket.protocol.http.WebResponse;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.wicket.GitBlitWebSession;\r
\r
super();\r
GitBlitWebSession session = GitBlitWebSession.get();\r
UserModel user = session.getUser();\r
- GitBlit.self().setCookie((WebResponse) getResponse(), null);\r
- GitBlit.self().logout(user);\r
+ app().session().setCookie((WebResponse) getResponse(), null);\r
+ app().session().logout(user);\r
session.invalidate();\r
\r
/*\r
import org.eclipse.jgit.lib.Constants;\r
\r
import com.gitblit.Constants.SearchType;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.SearchResult;\r
ArrayList<String> repositories = new ArrayList<String>();\r
String query = "";\r
int page = 1;\r
- int pageSize = GitBlit.getInteger(Keys.web.itemsPerPage, 50);\r
+ int pageSize = app().settings().getInteger(Keys.web.itemsPerPage, 50);\r
\r
if (params != null) {\r
String repository = WicketUtils.getRepositoryName(params);\r
// display user-accessible selections\r
UserModel user = GitBlitWebSession.get().getUser();\r
List<String> availableRepositories = new ArrayList<String>();\r
- for (RepositoryModel model : GitBlit.self().getRepositoryModels(user)) {\r
+ for (RepositoryModel model : app().repositories().getRepositoryModels(user)) {\r
if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
availableRepositories.add(model.name);\r
}\r
}\r
- boolean luceneEnabled = GitBlit.getBoolean(Keys.web.allowLuceneIndexing, true);\r
+ boolean luceneEnabled = app().settings().getBoolean(Keys.web.allowLuceneIndexing, true);\r
if (luceneEnabled) {\r
if (availableRepositories.size() == 0) {\r
info(getString("gb.noIndexedRepositoriesWarning"));\r
// execute search\r
final List<SearchResult> results = new ArrayList<SearchResult>();\r
if (!ArrayUtils.isEmpty(searchRepositories) && !StringUtils.isEmpty(query)) {\r
- results.addAll(GitBlit.self().search(query, page, pageSize, searchRepositories));\r
+ results.addAll(app().repositories().search(query, page, pageSize, searchRepositories));\r
}\r
\r
// results header\r
import org.apache.wicket.markup.html.panel.Fragment;\r
import org.eclipse.jgit.lib.Constants;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.ProjectModel;\r
import com.gitblit.models.RepositoryModel;\r
private void setup(PageParameters params) {\r
setupPage("", "");\r
// check to see if we should display a login message\r
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);\r
+ boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true);\r
if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {\r
- String messageSource = GitBlit.getString(Keys.web.loginMessage, "gitblit");\r
+ String messageSource = app().settings().getString(Keys.web.loginMessage, "gitblit");\r
String message = readMarkdown(messageSource, "login.mkd");\r
Component repositoriesMessage = new Label("repositoriesMessage", message);\r
add(repositoriesMessage.setEscapeModelStrings(false));\r
}\r
\r
// Load the markdown welcome message\r
- String messageSource = GitBlit.getString(Keys.web.repositoriesMessage, "gitblit");\r
+ String messageSource = app().settings().getString(Keys.web.repositoriesMessage, "gitblit");\r
String message = readMarkdown(messageSource, "welcome.mkd");\r
Component repositoriesMessage = new Label("repositoriesMessage", message)\r
.setEscapeModelStrings(false).setVisible(message.length() > 0);\r
\r
// parameters\r
int daysBack = params == null ? 0 : WicketUtils.getDaysBack(params);\r
- int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);\r
+ int maxDaysBack = app().settings().getInteger(Keys.web.activityDurationMaximum, 30);\r
if (daysBack < 1) {\r
- daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
+ daysBack = app().settings().getInteger(Keys.web.activityDuration, 7);\r
}\r
if (maxDaysBack > 0 && daysBack > maxDaysBack) {\r
daysBack = maxDaysBack;\r
add(repositoryTabs);\r
\r
// projects list\r
- List<ProjectModel> projects = GitBlit.self().getProjectModels(getRepositoryModels(), false);\r
+ List<ProjectModel> projects = app().projects().getProjectModels(getRepositoryModels(), false);\r
repositoryTabs.add(new FilterableProjectList("projects", projects));\r
\r
// active repository list\r
} else {\r
// Read user-supplied message\r
if (!StringUtils.isEmpty(messageSource)) {\r
- File file = GitBlit.getFileOrFolder(messageSource);\r
+ File file = app().runtime().getFileOrFolder(messageSource);\r
if (file.exists()) {\r
try {\r
FileInputStream fis = new FileInputStream(file);\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
import org.eclipse.jgit.lib.Repository;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.Metric;\r
import com.gitblit.models.RepositoryModel;\r
public OverviewPage(PageParameters params) {\r
super(params);\r
\r
- int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, 5);\r
+ int numberRefs = app().settings().getInteger(Keys.web.summaryRefsCount, 5);\r
\r
Repository r = getRepository();\r
final RepositoryModel model = getRepositoryModel();\r
\r
List<Metric> metrics = null;\r
Metric metricsTotal = null;\r
- if (!model.skipSummaryMetrics && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
- metrics = GitBlit.self().getRepositoryDefaultMetrics(model, r);\r
+ if (!model.skipSummaryMetrics && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {\r
+ metrics = app().repositories().getRepositoryDefaultMetrics(model, r);\r
metricsTotal = metrics.remove(0);\r
}\r
\r
@Override\r
public void populateItem(final Item<String> item) {\r
String ownername = item.getModelObject();\r
- UserModel ownerModel = GitBlit.self().getUserModel(ownername);\r
+ UserModel ownerModel = app().users().getUserModel(ownername);\r
if (ownerModel != null) {\r
item.add(new LinkPanel("owner", null, ownerModel.getDisplayName(), UserPage.class,\r
WicketUtils.newUsernameParameter(ownerModel.username)).setRenderBodyOnly(true));\r
\r
add(new RepositoryUrlPanel("repositoryUrlPanel", false, user, model));\r
\r
- int reflogCount = GitBlit.getInteger(Keys.web.overviewReflogCount, 5);\r
+ int reflogCount = app().settings().getInteger(Keys.web.overviewReflogCount, 5);\r
ReflogPanel reflog = new ReflogPanel("reflogPanel", getRepositoryModel(), r, reflogCount, 0);\r
add(reflog);\r
add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());\r
\r
private void insertActivityGraph(List<Metric> metrics) {\r
if ((metrics != null) && (metrics.size() > 0)\r
- && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
+ && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {\r
\r
// daily line chart\r
GoogleChart chart = new GoogleLineChart("chartDaily", "", "unit",\r
package com.gitblit.wicket.pages;\r
\r
import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.WebPage;\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.utils.DiffUtils;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.WicketUtils;\r
\r
@CacheControl(LastModified.BOOT)\r
-public class PatchPage extends WebPage {\r
+public class PatchPage extends SessionPage {\r
\r
public PatchPage(PageParameters params) {\r
super(params);\r
final String objectId = WicketUtils.getObject(params);\r
final String blobPath = WicketUtils.getPath(params);\r
\r
- Repository r = GitBlit.self().getRepository(repositoryName);\r
+ Repository r = app().repositories().getRepository(repositoryName);\r
if (r == null) {\r
GitBlitWebSession.get().cacheErrorMessage(getString("gb.canNotLoadRepository") + " " + repositoryName);\r
redirectToInterceptPage(new RepositoriesPage());\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.link.ExternalLink;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.SyndicationServlet;\r
import com.gitblit.models.ProjectModel;\r
private void setup(PageParameters params) {\r
setupPage("", "");\r
// check to see if we should display a login message\r
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);\r
+ boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true);\r
if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {\r
authenticationError("Please login");\r
return;\r
}\r
int daysBack = params == null ? 0 : WicketUtils.getDaysBack(params);\r
if (daysBack < 1) {\r
- daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
+ daysBack = app().settings().getInteger(Keys.web.activityDuration, 7);\r
}\r
// reset the daysback parameter so that we have a complete project\r
// repository list. the recent activity will be built up by the\r
protected List<ProjectModel> getProjectModels() {\r
if (projectModels.isEmpty()) {\r
List<RepositoryModel> repositories = getRepositoryModels();\r
- List<ProjectModel> projects = GitBlit.self().getProjectModels(repositories, false);\r
+ List<ProjectModel> projects = app().projects().getProjectModels(repositories, false);\r
projectModels.addAll(projects);\r
}\r
return projectModels;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.ProjectModel;\r
import com.gitblit.wicket.GitBlitWebSession;\r
\r
@Override\r
protected List<ProjectModel> getProjectModels() {\r
- return GitBlit.self().getProjectModels(getRepositoryModels(), false);\r
+ return app().projects().getProjectModels(getRepositoryModels(), false);\r
}\r
\r
private void setup(PageParameters params) {\r
setupPage("", "");\r
// check to see if we should display a login message\r
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);\r
+ boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true);\r
if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {\r
add(new Label("projectsPanel"));\r
return;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
final String repositoryName = WicketUtils.getRepositoryName(params);\r
final String objectId = WicketUtils.getObject(params);\r
final String blobPath = WicketUtils.getPath(params);\r
- String[] encodings = GitBlit.getEncodings();\r
+ String[] encodings = getEncodings();\r
GitBlitWebSession session = GitBlitWebSession.get();\r
UserModel user = session.getUser();\r
\r
- RepositoryModel model = GitBlit.self().getRepositoryModel(user, repositoryName);\r
+ RepositoryModel model = app().repositories().getRepositoryModel(user, repositoryName);\r
if (model == null) {\r
// user does not have permission\r
error(getString("gb.canNotLoadRepository") + " " + repositoryName);\r
return;\r
}\r
\r
- Repository r = GitBlit.self().getRepository(repositoryName);\r
+ Repository r = app().repositories().getRepository(repositoryName);\r
if (r == null) {\r
error(getString("gb.canNotLoadRepository") + " " + repositoryName);\r
redirectToInterceptPage(new RepositoriesPage());\r
\r
// Map the extensions to types\r
Map<String, Integer> map = new HashMap<String, Integer>();\r
- for (String ext : GitBlit.getStrings(Keys.web.imageExtensions)) {\r
+ for (String ext : app().settings().getStrings(Keys.web.imageExtensions)) {\r
map.put(ext.toLowerCase(), 2);\r
}\r
- for (String ext : GitBlit.getStrings(Keys.web.binaryExtensions)) {\r
+ for (String ext : app().settings().getStrings(Keys.web.binaryExtensions)) {\r
map.put(ext.toLowerCase(), 3);\r
}\r
\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.eclipse.jgit.lib.Constants;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.utils.MarkdownUtils;\r
private void setup(PageParameters params) {\r
setupPage("", "");\r
// check to see if we should display a login message\r
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);\r
+ boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true);\r
if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {\r
- String messageSource = GitBlit.getString(Keys.web.loginMessage, "gitblit");\r
+ String messageSource = app().settings().getString(Keys.web.loginMessage, "gitblit");\r
String message = readMarkdown(messageSource, "login.mkd");\r
Component repositoriesMessage = new Label("repositoriesMessage", message);\r
add(repositoriesMessage.setEscapeModelStrings(false));\r
}\r
\r
// Load the markdown welcome message\r
- String messageSource = GitBlit.getString(Keys.web.repositoriesMessage, "gitblit");\r
+ String messageSource = app().settings().getString(Keys.web.repositoriesMessage, "gitblit");\r
String message = readMarkdown(messageSource, "welcome.mkd");\r
Component repositoriesMessage = new Label("repositoriesMessage", message)\r
.setEscapeModelStrings(false).setVisible(message.length() > 0);\r
} else {\r
// Read user-supplied message\r
if (!StringUtils.isEmpty(messageSource)) {\r
- File file = GitBlit.getFileOrFolder(messageSource);\r
+ File file = app().runtime().getFileOrFolder(messageSource);\r
if (file.exists()) {\r
try {\r
FileInputStream fis = new FileInputStream(file);\r
import org.slf4j.LoggerFactory;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.Keys;\r
import com.gitblit.PagesServlet;\r
import com.gitblit.utils.ArrayUtils;\r
import com.gitblit.utils.DeepCopier;\r
import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.utils.MessageProcessor;\r
import com.gitblit.utils.RefLogUtils;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.CacheControl;\r
repositoryName = WicketUtils.getRepositoryName(params);\r
String root =StringUtils.getFirstPathElement(repositoryName);\r
if (StringUtils.isEmpty(root)) {\r
- projectName = GitBlit.getString(Keys.web.repositoryRootGroupName, "main");\r
+ projectName = app().settings().getString(Keys.web.repositoryRootGroupName, "main");\r
} else {\r
projectName = root;\r
}\r
UserRepositoryPreferences prefs = user.getPreferences().getRepositoryPreferences(getRepositoryModel().name);\r
prefs.starred = star;\r
try {\r
- GitBlit.self().updateUserModel(user.username, user, false);\r
+ app().users().updateUserModel(user.username, user, false);\r
} catch (GitBlitException e) {\r
logger.error("Failed to update user " + user.username, e);\r
error(getString("gb.failedToUpdateUser"), false);\r
return getClass();\r
}\r
\r
+ protected MessageProcessor messageProcessor() {\r
+ return new MessageProcessor(app().settings());\r
+ }\r
+\r
private Map<String, PageRegistration> registerPages() {\r
PageParameters params = null;\r
if (!StringUtils.isEmpty(repositoryName)) {\r
pages.put("tree", new PageRegistration("gb.tree", TreePage.class, params));\r
pages.put("docs", new PageRegistration("gb.docs", DocsPage.class, params, true));\r
pages.put("compare", new PageRegistration("gb.compare", ComparePage.class, params, true));\r
- if (GitBlit.getBoolean(Keys.web.allowForking, true)) {\r
+ if (app().settings().getBoolean(Keys.web.allowForking, true)) {\r
pages.put("forks", new PageRegistration("gb.forks", ForksPage.class, params, true));\r
}\r
\r
\r
// Conditionally add edit link\r
showAdmin = false;\r
- if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {\r
- boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);\r
+ if (app().settings().getBoolean(Keys.web.authenticateAdminPages, true)) {\r
+ boolean allowAdmin = app().settings().getBoolean(Keys.web.allowAdministration, false);\r
showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();\r
} else {\r
- showAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);\r
+ showAdmin = app().settings().getBoolean(Keys.web.allowAdministration, false);\r
}\r
isOwner = GitBlitWebSession.get().isLoggedIn()\r
&& (model.isOwner(GitBlitWebSession.get()\r
}\r
\r
protected boolean allowForkControls() {\r
- return GitBlit.getBoolean(Keys.web.allowForking, true);\r
+ return app().settings().getBoolean(Keys.web.allowForking, true);\r
}\r
\r
@Override\r
protected void setupPage(String repositoryName, String pageName) {\r
String projectName = StringUtils.getFirstPathElement(repositoryName);\r
- ProjectModel project = GitBlit.self().getProjectModel(projectName);\r
+ ProjectModel project = app().projects().getProjectModel(projectName);\r
if (project.isUserProject()) {\r
// user-as-project\r
add(new LinkPanel("projectTitle", null, project.getDisplayName(),\r
add(new Label("originRepository").setVisible(false));\r
}\r
} else {\r
- RepositoryModel origin = GitBlit.self().getRepositoryModel(model.originRepository);\r
+ RepositoryModel origin = app().repositories().getRepositoryModel(model.originRepository);\r
if (origin == null) {\r
// no origin repository\r
add(new Label("originRepository").setVisible(false));\r
add(new ExternalLink("forkLink", "").setVisible(false));\r
add(new ExternalLink("myForkLink", "").setVisible(false));\r
} else {\r
- String fork = GitBlit.self().getFork(user.username, model.name);\r
+ String fork = app().repositories().getFork(user.username, model.name);\r
boolean hasFork = fork != null;\r
boolean canFork = user.canFork(model);\r
\r
\r
protected Repository getRepository() {\r
if (r == null) {\r
- Repository r = GitBlit.self().getRepository(repositoryName);\r
+ Repository r = app().repositories().getRepository(repositoryName);\r
if (r == null) {\r
error(getString("gb.canNotLoadRepository") + " " + repositoryName, true);\r
return null;\r
\r
protected RepositoryModel getRepositoryModel() {\r
if (m == null) {\r
- RepositoryModel model = GitBlit.self().getRepositoryModel(\r
+ RepositoryModel model = app().repositories().getRepositoryModel(\r
GitBlitWebSession.get().getUser(), repositoryName);\r
if (model == null) {\r
- if (GitBlit.self().hasRepository(repositoryName, true)) {\r
+ if (app().repositories().hasRepository(repositoryName, true)) {\r
// has repository, but unauthorized\r
authenticationError(getString("gb.unauthorizedAccessForRepository") + " " + repositoryName);\r
} else {\r
return model;\r
} else {\r
// extract the repository name from the clone url\r
- List<String> patterns = GitBlit.getStrings(Keys.git.submoduleUrlPatterns);\r
+ List<String> patterns = app().settings().getStrings(Keys.git.submoduleUrlPatterns);\r
String submoduleName = StringUtils.extractRepositoryPath(model.url, patterns.toArray(new String[0]));\r
\r
// determine the current path for constructing paths relative\r
// create a unique, ordered set of candidate paths\r
Set<String> paths = new LinkedHashSet<String>(candidates);\r
for (String candidate : paths) {\r
- if (GitBlit.self().hasRepository(candidate)) {\r
+ if (app().repositories().hasRepository(candidate)) {\r
model.hasSubmodule = true;\r
model.gitblitPath = candidate;\r
return model;\r
}\r
\r
protected String getShortObjectId(String objectId) {\r
- return objectId.substring(0, GitBlit.getInteger(Keys.web.shortCommitIdLength, 6));\r
+ return objectId.substring(0, app().settings().getInteger(Keys.web.shortCommitIdLength, 6));\r
}\r
\r
protected void addRefs(Repository r, RevCommit c) {\r
\r
protected void addFullText(String wicketId, String text) {\r
RepositoryModel model = getRepositoryModel();\r
- String content = GitBlit.self().processCommitMessage(model, text);\r
+ String content = messageProcessor().processCommitMessage(model, text);\r
String html;\r
switch (model.commitMessageRenderer) {\r
case MARKDOWN:\r
String address = identity == null ? "" : identity.getEmailAddress();\r
name = StringUtils.removeNewlines(name);\r
address = StringUtils.removeNewlines(address);\r
- boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false);\r
+ boolean showEmail = app().settings().getBoolean(Keys.web.showEmailAddresses, false);\r
if (!showEmail || StringUtils.isEmpty(name) || StringUtils.isEmpty(address)) {\r
String value = name;\r
if (StringUtils.isEmpty(value)) {\r
DropDownChoice<Constants.SearchType> searchType = new DropDownChoice<Constants.SearchType>(\r
"searchType", Arrays.asList(Constants.SearchType.values()));\r
searchType.setModel(searchTypeModel);\r
- add(searchType.setVisible(GitBlit.getBoolean(Keys.web.showSearchTypeSelection, false)));\r
+ add(searchType.setVisible(app().settings().getBoolean(Keys.web.showSearchTypeSelection, false)));\r
TextField<String> searchBox = new TextField<String>("searchBox", searchBoxModel);\r
add(searchBox);\r
}\r
}\r
}\r
Class<? extends BasePage> searchPageClass = GitSearchPage.class;\r
- RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);\r
- if (GitBlit.getBoolean(Keys.web.allowLuceneIndexing, true)\r
+ RepositoryModel model = app().repositories().getRepositoryModel(repositoryName);\r
+ if (app().settings().getBoolean(Keys.web.allowLuceneIndexing, true)\r
&& !ArrayUtils.isEmpty(model.indexedBranches)) {\r
// this repository is Lucene-indexed\r
searchPageClass = LuceneSearchPage.class;\r
import org.apache.wicket.markup.html.basic.Label;\r
\r
import com.gitblit.Constants.FederationToken;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.FederationProposal;\r
import com.gitblit.models.RepositoryModel;\r
\r
private final String PROPS_PATTERN = "{0} = {1}\n";\r
\r
- private final String WEBXML_PATTERN = "\n<context-param>\n\t<param-name>{0}</param-name>\n\t<param-value>{1}</param-value>\n</context-param>\n";\r
-\r
public ReviewProposalPage(PageParameters params) {\r
super(params);\r
\r
final String token = WicketUtils.getToken(params);\r
\r
- FederationProposal proposal = GitBlit.self().getPendingFederationProposal(token);\r
+ FederationProposal proposal = app().federation().getPendingFederationProposal(token);\r
if (proposal == null) {\r
error(getString("gb.couldNotFindFederationProposal"), true);\r
}\r
add(new Label("token", proposal.token));\r
add(new Label("tokenType", proposal.tokenType.name()));\r
\r
- String p;\r
- if (GitBlit.isGO()) {\r
- // gitblit.properties definition\r
- p = PROPS_PATTERN;\r
- } else {\r
- // web.xml definition\r
- p = WEBXML_PATTERN;\r
- }\r
+ String p = PROPS_PATTERN;\r
\r
// build proposed definition\r
StringBuilder sb = new StringBuilder();\r
sb.append(asParam(p, proposal.name, "mergeAccounts", "false"));\r
}\r
sb.append(asParam(p, proposal.name, "frequency",\r
- GitBlit.getString(Keys.federation.defaultFrequency, "60 mins")));\r
+ app().settings().getString(Keys.federation.defaultFrequency, "60 mins")));\r
sb.append(asParam(p, proposal.name, "folder", proposal.name));\r
sb.append(asParam(p, proposal.name, "bare", "true"));\r
sb.append(asParam(p, proposal.name, "mirror", "true"));\r
import org.apache.wicket.protocol.http.WebResponse;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.TeamModel;\r
StringBuilder buffer = new StringBuilder();\r
buffer.append("<style type=\"text/css\">\n");\r
buffer.append(".navbar-inner {\n");\r
- final String headerBackground = GitBlit.getString(Keys.web.headerBackgroundColor, null);\r
+ final String headerBackground = app().settings().getString(Keys.web.headerBackgroundColor, null);\r
if (!StringUtils.isEmpty(headerBackground)) {\r
buffer.append(MessageFormat.format("background-color: {0};\n", headerBackground));\r
}\r
- final String headerBorder = GitBlit.getString(Keys.web.headerBorderColor, null);\r
+ final String headerBorder = app().settings().getString(Keys.web.headerBorderColor, null);\r
if (!StringUtils.isEmpty(headerBorder)) {\r
buffer.append(MessageFormat.format("border-bottom: 1px solid {0} !important;\n", headerBorder));\r
}\r
buffer.append("}\n");\r
- final String headerBorderFocus = GitBlit.getString(Keys.web.headerBorderFocusColor, null);\r
+ final String headerBorderFocus = app().settings().getString(Keys.web.headerBorderFocusColor, null);\r
if (!StringUtils.isEmpty(headerBorderFocus)) {\r
buffer.append(".navbar ul li:focus, .navbar .active {\n");\r
buffer.append(MessageFormat.format("border-bottom: 4px solid {0};\n", headerBorderFocus));\r
buffer.append("}\n");\r
}\r
- final String headerForeground = GitBlit.getString(Keys.web.headerForegroundColor, null);\r
+ final String headerForeground = app().settings().getString(Keys.web.headerForegroundColor, null);\r
if (!StringUtils.isEmpty(headerForeground)) {\r
buffer.append(".navbar ul.nav li a {\n");\r
buffer.append(MessageFormat.format("color: {0};\n", headerForeground));\r
buffer.append(MessageFormat.format("color: {0};\n", headerForeground));\r
buffer.append("}\n");\r
}\r
- final String headerHover = GitBlit.getString(Keys.web.headerHoverColor, null);\r
+ final String headerHover = app().settings().getString(Keys.web.headerHoverColor, null);\r
if (!StringUtils.isEmpty(headerHover)) {\r
buffer.append(".navbar ul.nav li a:hover {\n");\r
buffer.append(MessageFormat.format("color: {0} !important;\n", headerHover));\r
}\r
}));\r
\r
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, false);\r
- boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);\r
- boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);\r
+ boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, false);\r
+ boolean authenticateAdmin = app().settings().getBoolean(Keys.web.authenticateAdminPages, true);\r
+ boolean allowAdmin = app().settings().getBoolean(Keys.web.allowAdministration, true);\r
\r
if (authenticateAdmin) {\r
showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();\r
add(new Label("userPanel").setVisible(false));\r
}\r
\r
- boolean showRegistrations = GitBlit.canFederate()\r
- && GitBlit.getBoolean(Keys.web.showFederationRegistrations, false);\r
+ boolean showRegistrations = app().federation().canFederate()\r
+ && app().settings().getBoolean(Keys.web.showFederationRegistrations, false);\r
\r
// navigation links\r
List<PageRegistration> pages = new ArrayList<PageRegistration>();\r
pages.add(new PageRegistration("gb.repositories", RepositoriesPage.class,\r
getRootPageParameters()));\r
pages.add(new PageRegistration("gb.activity", ActivityPage.class, getRootPageParameters()));\r
- if (GitBlit.getBoolean(Keys.web.allowLuceneIndexing, true)) {\r
+ if (app().settings().getBoolean(Keys.web.allowLuceneIndexing, true)) {\r
pages.add(new PageRegistration("gb.search", LuceneSearchPage.class));\r
}\r
if (showAdmin) {\r
if (!StringUtils.isEmpty(cachedMessage)) {\r
error(cachedMessage);\r
} else if (showAdmin) {\r
- int pendingProposals = GitBlit.self().getPendingFederationProposals().size();\r
+ int pendingProposals = app().federation().getPendingFederationProposals().size();\r
if (pendingProposals == 1) {\r
info(getString("gb.OneProposalToReview"));\r
} else if (pendingProposals > 1) {\r
\r
// remove days back parameter if it is the default value\r
if (params.containsKey("db")\r
- && params.getInt("db") == GitBlit.getInteger(Keys.web.activityDuration, 7)) {\r
+ && params.getInt("db") == app().settings().getInteger(Keys.web.activityDuration, 7)) {\r
params.remove("db");\r
}\r
return params;\r
session.setUser(user);\r
\r
// Set Cookie\r
- if (GitBlit.getBoolean(Keys.web.allowCookieAuthentication, false)) {\r
+ if (app().settings().getBoolean(Keys.web.allowCookieAuthentication, false)) {\r
WebResponse response = (WebResponse) getRequestCycle().getResponse();\r
- GitBlit.self().setCookie(response, user);\r
+ app().session().setCookie(response, user);\r
}\r
\r
if (!session.continueRequest()) {\r
protected List<RepositoryModel> getRepositoryModels() {\r
if (repositoryModels.isEmpty()) {\r
final UserModel user = GitBlitWebSession.get().getUser();\r
- List<RepositoryModel> repositories = GitBlit.self().getRepositoryModels(user);\r
+ List<RepositoryModel> repositories = app().repositories().getRepositoryModels(user);\r
repositoryModels.addAll(repositories);\r
Collections.sort(repositoryModels);\r
}\r
}\r
\r
// custom filters\r
- String customFilters = GitBlit.getString(Keys.web.customFilters, null);\r
+ String customFilters = app().settings().getString(Keys.web.customFilters, null);\r
if (!StringUtils.isEmpty(customFilters)) {\r
boolean addedExpression = false;\r
List<String> expressions = StringUtils.getStringsFromValue(customFilters, "!!!");\r
\r
protected List<DropDownMenuItem> getTimeFilterItems(PageParameters params) {\r
// days back choices - additive parameters\r
- int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
- int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);\r
+ int daysBack = app().settings().getInteger(Keys.web.activityDuration, 7);\r
+ int maxDaysBack = app().settings().getInteger(Keys.web.activityDurationMaximum, 30);\r
if (daysBack < 1) {\r
daysBack = 7;\r
}\r
}\r
\r
List<DropDownMenuItem> items = new ArrayList<DropDownMenuItem>();\r
- Set<Integer> choicesSet = new TreeSet<Integer>(GitBlit.getIntegers(Keys.web.activityDurationChoices));\r
+ Set<Integer> choicesSet = new TreeSet<Integer>(app().settings().getIntegers(Keys.web.activityDurationChoices));\r
if (choicesSet.isEmpty()) {\r
choicesSet.addAll(Arrays.asList(1, 3, 7, 14, 21, 28));\r
}\r
String regex = WicketUtils.getRegEx(params);\r
String team = WicketUtils.getTeam(params);\r
int daysBack = params.getInt("db", 0);\r
- int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);\r
+ int maxDaysBack = app().settings().getInteger(Keys.web.activityDurationMaximum, 30);\r
\r
List<RepositoryModel> availableModels = getRepositoryModels();\r
Set<RepositoryModel> models = new HashSet<RepositoryModel>();\r
if (!StringUtils.isEmpty(projectName)) {\r
// try named project\r
hasParameter = true;\r
- if (projectName.equalsIgnoreCase(GitBlit.getString(Keys.web.repositoryRootGroupName, "main"))) {\r
+ if (projectName.equalsIgnoreCase(app().settings().getString(Keys.web.repositoryRootGroupName, "main"))) {\r
// root project/group\r
for (RepositoryModel model : availableModels) {\r
if (model.name.indexOf('/') == -1) {\r
// need TeamModels first\r
List<TeamModel> teamModels = new ArrayList<TeamModel>();\r
for (String name : teams) {\r
- TeamModel teamModel = GitBlit.self().getTeamModel(name);\r
+ TeamModel teamModel = app().users().getTeamModel(name);\r
if (teamModel != null) {\r
teamModels.add(teamModel);\r
}\r
String username = RootPage.this.username.getObject();\r
char[] password = RootPage.this.password.getObject().toCharArray();\r
\r
- UserModel user = GitBlit.self().authenticate(username, password);\r
+ UserModel user = app().session().authenticate(username, password);\r
if (user == null) {\r
error(getString("gb.invalidUsernameOrPassword"));\r
} else if (user.username.equals(Constants.FEDERATION_USER)) {\r
/**\r
* Menu for the authenticated user.\r
*/\r
- static class UserMenu extends Fragment {\r
+ class UserMenu extends Fragment {\r
\r
private static final long serialVersionUID = 1L;\r
\r
\r
GitBlitWebSession session = GitBlitWebSession.get();\r
UserModel user = session.getUser();\r
- boolean editCredentials = GitBlit.self().supportsCredentialChanges(user);\r
+ boolean editCredentials = app().users().supportsCredentialChanges(user);\r
boolean standardLogin = session.authenticationType.isStandard();\r
\r
- if (GitBlit.getBoolean(Keys.web.allowGravatar, true)) {\r
+ if (app().settings().getBoolean(Keys.web.allowGravatar, true)) {\r
add(new GravatarImage("username", user.getDisplayName(),\r
user.emailAddress, "navbarGravatar", 20, false, false));\r
} else {\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
import com.gitblit.Constants.AuthorizationControl;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.ModelUtils;\r
}\r
}\r
\r
- for (String repo : GitBlit.self().getRepositoryList()) {\r
- RepositoryModel repositoryModel = GitBlit.self().getRepositoryModel(repo);\r
+ for (String repo : app().repositories().getRepositoryList()) {\r
+ RepositoryModel repositoryModel = app().repositories().getRepositoryModel(repo);\r
if (repositoryModel.accessRestriction.exceeds(AccessRestrictionType.NONE)\r
&& repositoryModel.authorizationControl.equals(AuthorizationControl.NAMED)) {\r
if (user != null &&\r
import org.apache.wicket.model.CompoundPropertyModel;\r
\r
import com.gitblit.Constants.FederationProposalResult;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.FederationProposal;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.utils.FederationUtils;\r
destinationUrl = "https://";\r
\r
// temporary proposal\r
- FederationProposal proposal = GitBlit.self().createFederationProposal(myUrl, token);\r
+ FederationProposal proposal = app().federation().createFederationProposal(myUrl, token);\r
if (proposal == null) {\r
error(getString("gb.couldNotCreateFederationProposal"), true);\r
}\r
}\r
\r
// build new proposal\r
- FederationProposal proposal = GitBlit.self().createFederationProposal(myUrl, token);\r
+ FederationProposal proposal = app().federation().createFederationProposal(myUrl, token);\r
proposal.url = myUrl;\r
proposal.message = message;\r
try {\r
import org.apache.wicket.protocol.http.WebRequest;\r
import org.apache.wicket.protocol.http.WebResponse;\r
\r
-import com.gitblit.GitBlit;\r
+import com.gitblit.Keys;\r
import com.gitblit.models.UserModel;\r
+import com.gitblit.wicket.GitBlitWebApp;\r
import com.gitblit.wicket.GitBlitWebSession;\r
\r
public abstract class SessionPage extends WebPage {\r
login();\r
}\r
\r
+ protected String [] getEncodings() {\r
+ return app().settings().getStrings(Keys.web.blobEncodings).toArray(new String[0]);\r
+ }\r
+\r
+ protected GitBlitWebApp app() {\r
+ return GitBlitWebApp.get();\r
+ }\r
+\r
private void login() {\r
GitBlitWebSession session = GitBlitWebSession.get();\r
if (session.isLoggedIn() && !session.isSessionInvalidated()) {\r
// already have a session, refresh usermodel to pick up\r
// any changes to permissions or roles (issue-186)\r
- UserModel user = GitBlit.self().getUserModel(session.getUser().username);\r
+ UserModel user = app().users().getUserModel(session.getUser().username);\r
session.setUser(user);\r
return;\r
}\r
// try to authenticate by servlet request\r
HttpServletRequest httpRequest = ((WebRequest) getRequestCycle().getRequest())\r
.getHttpServletRequest();\r
- UserModel user = GitBlit.self().authenticate(httpRequest);\r
+ UserModel user = app().session().authenticate(httpRequest);\r
\r
// Login the user\r
if (user != null) {\r
\r
// Set Cookie\r
WebResponse response = (WebResponse) getRequestCycle().getResponse();\r
- GitBlit.self().setCookie(response, user);\r
+ app().session().setCookie(response, user);\r
\r
session.continueRequest();\r
}\r
import org.wicketstuff.googlecharts.MarkerType;\r
import org.wicketstuff.googlecharts.ShapeMarker;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.Metric;\r
import com.gitblit.models.RepositoryModel;\r
public SummaryPage(PageParameters params) {\r
super(params);\r
\r
- int numberCommits = GitBlit.getInteger(Keys.web.summaryCommitCount, 20);\r
+ int numberCommits = app().settings().getInteger(Keys.web.summaryCommitCount, 20);\r
if (numberCommits <= 0) {\r
numberCommits = 20;\r
}\r
- int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, 5);\r
+ int numberRefs = app().settings().getInteger(Keys.web.summaryRefsCount, 5);\r
\r
Repository r = getRepository();\r
final RepositoryModel model = getRepositoryModel();\r
\r
List<Metric> metrics = null;\r
Metric metricsTotal = null;\r
- if (!model.skipSummaryMetrics && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
- metrics = GitBlit.self().getRepositoryDefaultMetrics(model, r);\r
+ if (!model.skipSummaryMetrics && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {\r
+ metrics = app().repositories().getRepositoryDefaultMetrics(model, r);\r
metricsTotal = metrics.remove(0);\r
}\r
\r
@Override\r
public void populateItem(final Item<String> item) {\r
String ownername = item.getModelObject();\r
- UserModel ownerModel = GitBlit.self().getUserModel(ownername);\r
+ UserModel ownerModel = app().users().getUserModel(ownername);\r
if (ownerModel != null) {\r
item.add(new LinkPanel("owner", null, ownerModel.getDisplayName(), UserPage.class,\r
WicketUtils.newUsernameParameter(ownerModel.username)).setRenderBodyOnly(true));\r
add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());\r
add(new BranchesPanel("branchesPanel", getRepositoryModel(), r, numberRefs, false).hideIfEmpty());\r
\r
- if (GitBlit.getBoolean(Keys.web.summaryShowReadme, false)) {\r
+ if (app().settings().getBoolean(Keys.web.summaryShowReadme, false)) {\r
// show a readme on the summary page\r
RevCommit head = JGitUtils.getCommit(r, null);\r
- MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());\r
+ MarkupProcessor processor = new MarkupProcessor(app().settings());\r
MarkupDocument markupDoc = processor.getReadme(r, repositoryName, getBestCommitId(head));\r
if (markupDoc == null || markupDoc.markup == null) {\r
add(new Label("readme").setVisible(false));\r
\r
private void insertActivityGraph(List<Metric> metrics) {\r
if ((metrics != null) && (metrics.size() > 0)\r
- && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
+ && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {\r
IChartData data = WicketUtils.getChartData(metrics);\r
\r
ChartProvider provider = new ChartProvider(new Dimension(290, 100), ChartType.LINE,\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
import org.eclipse.jgit.lib.PersonIdent;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.ProjectModel;\r
import com.gitblit.models.RepositoryModel;\r
private void setup(PageParameters params) {\r
setupPage("", "");\r
// check to see if we should display a login message\r
- boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);\r
+ boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true);\r
if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {\r
authenticationError("Please login");\r
return;\r
throw new GitblitRedirectException(GitBlitWebApp.get().getHomePage());\r
}\r
\r
- UserModel user = GitBlit.self().getUserModel(userName);\r
+ UserModel user = app().users().getUserModel(userName);\r
if (user == null) {\r
// construct a temporary user model\r
user = new UserModel(userName);\r
\r
String projectName = user.getPersonalPath();\r
\r
- ProjectModel project = GitBlit.self().getProjectModel(projectName);\r
+ ProjectModel project = app().projects().getProjectModel(projectName);\r
if (project == null) {\r
project = new ProjectModel(projectName);\r
}\r
add(new Label("userUsername", user.username));\r
LinkPanel email = new LinkPanel("userEmail", null, user.emailAddress, "mailto:#");\r
email.setRenderBodyOnly(true);\r
- add(email.setVisible(GitBlit.getBoolean(Keys.web.showEmailAddresses, true) && !StringUtils.isEmpty(user.emailAddress)));\r
+ add(email.setVisible(app().settings().getBoolean(Keys.web.showEmailAddresses, true) && !StringUtils.isEmpty(user.emailAddress)));\r
\r
PersonIdent person = new PersonIdent(user.getDisplayName(), user.emailAddress == null ? user.getDisplayName() : user.emailAddress);\r
add(new GravatarImage("gravatar", person, 210));\r
import org.eclipse.jgit.lib.Repository;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.Activity;\r
import com.gitblit.models.RepositoryCommit;\r
\r
Collections.sort(recentActivity);\r
\r
- final int shortHashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6);\r
+ final int shortHashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
DataView<Activity> activityView = new DataView<Activity>("activity",\r
new ListDataProvider<Activity>(recentActivity)) {\r
private static final long serialVersionUID = 1L;\r
import org.apache.wicket.model.Model;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.utils.TimeUtils;\r
+import com.gitblit.wicket.GitBlitWebApp;\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
\r
super(wicketId);\r
}\r
\r
+ protected GitBlitWebApp app() {\r
+ return GitBlitWebApp.get();\r
+ }\r
+\r
protected TimeZone getTimeZone() {\r
- return GitBlit.getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get()\r
- .getTimezone() : GitBlit.getTimezone();\r
+ return app().settings().getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get()\r
+ .getTimezone() : app().getTimezone();\r
}\r
\r
protected TimeUtils getTimeUtils() {\r
import org.eclipse.jgit.lib.Repository;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.SyndicationServlet;\r
import com.gitblit.models.RefModel;\r
import com.gitblit.models.RepositoryModel;\r
\r
@Override\r
public void onClick() {\r
- Repository r = GitBlit.self().getRepository(repositoryModel.name);\r
+ Repository r = app().repositories().getRepository(repositoryModel.name);\r
if (r == null) {\r
- if (GitBlit.self().isCollectingGarbage(repositoryModel.name)) {\r
+ if (app().repositories().isCollectingGarbage(repositoryModel.name)) {\r
error(MessageFormat.format(getString("gb.busyCollectingGarbage"), repositoryModel.name));\r
} else {\r
error(MessageFormat.format("Failed to find repository {0}", repositoryModel.name));\r
import java.util.List;\r
\r
import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.html.panel.Panel;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
import com.gitblit.DownloadZipServlet;\r
import com.gitblit.DownloadZipServlet.Format;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
\r
-public class CompressedDownloadsPanel extends Panel {\r
+public class CompressedDownloadsPanel extends BasePanel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
public CompressedDownloadsPanel(String id, final String baseUrl, final String repositoryName, final String objectId, final String path) {\r
super(id);\r
\r
- List<String> types = GitBlit.getStrings(Keys.web.compressedDownloads);\r
+ List<String> types = app().settings().getStrings(Keys.web.compressedDownloads);\r
if (types.isEmpty()) {\r
types.add(Format.zip.name());\r
types.add(Format.gz.name());\r
};\r
add(refsView);\r
\r
- setVisible(GitBlit.getBoolean(Keys.web.allowZipDownloads, true));\r
+ setVisible(app().settings().getBoolean(Keys.web.allowZipDownloads, true));\r
}\r
}
\ No newline at end of file
import org.eclipse.jgit.lib.PersonIdent;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.DailyLogEntry;\r
import com.gitblit.models.RepositoryCommit;\r
super(wicketId);\r
hasChanges = digests.size() > 0;\r
\r
- final int hashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6);\r
+ final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
\r
- String dateFormat = GitBlit.getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");\r
+ String dateFormat = app().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");\r
final TimeZone timezone = getTimeZone();\r
final DateFormat df = new SimpleDateFormat(dateFormat);\r
df.setTimeZone(timezone);\r
logItem.add(new LinkPanel("compareLink", null, compareLinkText, ComparePage.class, WicketUtils.newRangeParameter(change.repository, startRangeId, endRangeId)));\r
}\r
\r
- final boolean showSwatch = GitBlit.getBoolean(Keys.web.repositoryListSwatches, true);\r
+ final boolean showSwatch = app().settings().getBoolean(Keys.web.repositoryListSwatches, true);\r
\r
ListDataProvider<RepositoryCommit> cdp = new ListDataProvider<RepositoryCommit>(commits);\r
DataView<RepositoryCommit> commitsView = new DataView<RepositoryCommit>("commit", cdp) {\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.FederationProposal;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.ReviewProposalPage;\r
public FederationProposalsPanel(String wicketId) {\r
super(wicketId);\r
\r
- final List<FederationProposal> list = GitBlit.self().getPendingFederationProposals();\r
+ final List<FederationProposal> list = app().federation().getPendingFederationProposals();\r
hasProposals = list.size() > 0;\r
DataView<FederationProposal> dataView = new DataView<FederationProposal>("row",\r
new ListDataProvider<FederationProposal>(list)) {\r
\r
@Override\r
public void onClick() {\r
- if (GitBlit.self().deletePendingFederationProposal(entry)) {\r
+ if (app().federation().deletePendingFederationProposal(entry)) {\r
list.remove(entry);\r
info(MessageFormat.format("Proposal ''{0}'' deleted.", entry.name));\r
} else {\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.FederationModel;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.FederationRegistrationPage;\r
public FederationRegistrationsPanel(String wicketId) {\r
super(wicketId);\r
\r
- final List<FederationModel> list = new ArrayList<FederationModel>(GitBlit.self()\r
+ final List<FederationModel> list = new ArrayList<FederationModel>(app().federation()\r
.getFederationRegistrations());\r
- list.addAll(GitBlit.self().getFederationResultRegistrations());\r
+ list.addAll(app().federation().getFederationResultRegistrations());\r
Collections.sort(list);\r
hasRegistrations = list.size() > 0;\r
DataView<FederationModel> dataView = new DataView<FederationModel>("row",\r
\r
import com.gitblit.Constants.FederationRequest;\r
import com.gitblit.Constants.FederationToken;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.utils.FederationUtils;\r
import com.gitblit.wicket.WicketUtils;\r
super(wicketId);\r
\r
final String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
- add(new ExternalLink("federatedUsers", FederationUtils.asLink(baseUrl, GitBlit.self()\r
+ add(new ExternalLink("federatedUsers", FederationUtils.asLink(baseUrl, app().federation()\r
.getFederationToken(FederationToken.USERS_AND_REPOSITORIES),\r
FederationRequest.PULL_USERS)));\r
\r
- add(new ExternalLink("federatedSettings", FederationUtils.asLink(baseUrl, GitBlit\r
- .self().getFederationToken(FederationToken.ALL), FederationRequest.PULL_SETTINGS)));\r
+ add(new ExternalLink("federatedSettings", FederationUtils.asLink(baseUrl, app().federation()\r
+ .getFederationToken(FederationToken.ALL), FederationRequest.PULL_SETTINGS)));\r
\r
final List<String[]> data = new ArrayList<String[]>();\r
for (FederationToken token : FederationToken.values()) {\r
- data.add(new String[] { token.name(), GitBlit.self().getFederationToken(token), null });\r
+ data.add(new String[] { token.name(), app().federation().getFederationToken(token), null });\r
}\r
- List<String> sets = GitBlit.getStrings(Keys.federation.sets);\r
+ List<String> sets = app().settings().getStrings(Keys.federation.sets);\r
Collections.sort(sets);\r
for (String set : sets) {\r
data.add(new String[] { FederationToken.REPOSITORIES.name(),\r
- GitBlit.self().getFederationToken(set), set });\r
+ app().federation().getFederationToken(set), set });\r
}\r
\r
DataView<String[]> dataView = new DataView<String[]>("row", new ListDataProvider<String[]>(\r
import org.apache.wicket.behavior.HeaderContributor;\r
import org.apache.wicket.markup.html.basic.Label;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.ProjectModel;\r
import com.gitblit.utils.StringUtils;\r
panel.add(icon);\r
}\r
\r
- String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy");\r
+ String format = app().settings().getString(Keys.web.datestampShortFormat, "MM/dd/yy");\r
final DateFormat df = new SimpleDateFormat(format);\r
df.setTimeZone(getTimeZone());\r
Collections.sort(projects, new Comparator<ProjectModel>() {\r
import org.apache.wicket.behavior.HeaderContributor;\r
import org.apache.wicket.markup.html.basic.Label;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.utils.StringUtils;\r
panel.add(new Label(ngList + "Button").setVisible(false));\r
}\r
\r
- String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy");\r
+ String format = app().settings().getString(Keys.web.datestampShortFormat, "MM/dd/yy");\r
final DateFormat df = new SimpleDateFormat(format);\r
df.setTimeZone(getTimeZone());\r
\r
item.p = path;\r
item.r = repo.name;\r
item.i = repo.description;\r
- item.s = GitBlit.self().getStarCount(repo);\r
+ item.s = app().repositories().getStarCount(repo);\r
item.t = getTimeUtils().timeAgo(repo.lastChange);\r
item.d = df.format(repo.lastChange);\r
item.c = StringUtils.getColor(StringUtils.stripDotGit(repo.name));\r
import org.apache.wicket.behavior.SimpleAttributeModifier;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
import org.apache.wicket.markup.html.link.Link;\r
-import org.apache.wicket.markup.html.panel.Panel;\r
import org.eclipse.jgit.lib.PersonIdent;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.utils.ActivityUtils;\r
import com.gitblit.utils.StringUtils;\r
* @author James Moger\r
*\r
*/\r
-public class GravatarImage extends Panel {\r
+public class GravatarImage extends BasePanel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
WicketUtils.setHtmlTooltip(link, username);\r
}\r
add(link.setEnabled(linked));\r
- setVisible(GitBlit.getBoolean(Keys.web.allowGravatar, true));\r
+ setVisible(app().settings().getBoolean(Keys.web.allowGravatar, true));\r
}\r
}
\ No newline at end of file
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.PathModel;\r
import com.gitblit.models.PathModel.PathChangeModel;\r
final String path, Repository r, int limit, int pageOffset, boolean showRemoteRefs) {\r
super(wicketId);\r
boolean pageResults = limit <= 0;\r
- int itemsPerPage = GitBlit.getInteger(Keys.web.itemsPerPage, 50);\r
+ int itemsPerPage = app().settings().getInteger(Keys.web.itemsPerPage, 50);\r
if (itemsPerPage <= 1) {\r
itemsPerPage = 50;\r
}\r
// breadcrumbs\r
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, path, objectId));\r
\r
- final int hashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6);\r
+ final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);\r
DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {\r
private static final long serialVersionUID = 1L;\r
item.add(links);\r
} else if (isSubmodule) {\r
// submodule\r
- Repository repository = GitBlit.self().getRepository(repositoryName);\r
+ Repository repository = app().repositories().getRepository(repositoryName);\r
String submoduleId = JGitUtils.getSubmoduleCommitId(repository, path, entry);\r
repository.close();\r
if (StringUtils.isEmpty(submoduleId)) {\r
return model;\r
} else {\r
// extract the repository name from the clone url\r
- List<String> patterns = GitBlit.getStrings(Keys.git.submoduleUrlPatterns);\r
+ List<String> patterns = app().settings().getStrings(Keys.git.submoduleUrlPatterns);\r
String submoduleName = StringUtils.extractRepositoryPath(model.url, patterns.toArray(new String[0]));\r
\r
// determine the current path for constructing paths relative\r
// create a unique, ordered set of candidate paths\r
Set<String> paths = new LinkedHashSet<String>(candidates);\r
for (String candidate : paths) {\r
- if (GitBlit.self().hasRepository(candidate)) {\r
+ if (app().repositories().hasRepository(candidate)) {\r
model.hasSubmodule = true;\r
model.gitblitPath = candidate;\r
return model;\r
\r
import com.gitblit.BranchGraphServlet;\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RefModel;\r
import com.gitblit.utils.JGitUtils;\r
Repository r, int limit, int pageOffset, boolean showRemoteRefs) {\r
super(wicketId);\r
boolean pageResults = limit <= 0;\r
- int itemsPerPage = GitBlit.getInteger(Keys.web.itemsPerPage, 50);\r
+ int itemsPerPage = app().settings().getInteger(Keys.web.itemsPerPage, 50);\r
if (itemsPerPage <= 1) {\r
itemsPerPage = 50;\r
}\r
hasMore = commits.size() >= itemsPerPage;\r
\r
final String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
- final boolean showGraph = GitBlit.getBoolean(Keys.web.showBranchGraph, true);\r
+ final boolean showGraph = app().settings().getBoolean(Keys.web.showBranchGraph, true);\r
\r
MarkupContainer graph = new WebMarkupContainer("graph");\r
add(graph);\r
WicketUtils.newRepositoryParameter(repositoryName)));\r
}\r
\r
- final int hashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6);\r
+ final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);\r
DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {\r
private static final long serialVersionUID = 1L;\r
import org.apache.wicket.markup.html.panel.Fragment;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.SyndicationServlet;\r
import com.gitblit.models.RepositoryModel;\r
final Map<AccessRestrictionType, String> accessRestrictions) {\r
super(wicketId);\r
\r
- final boolean showSwatch = GitBlit.getBoolean(Keys.web.repositoryListSwatches, true);\r
- final boolean showSize = GitBlit.getBoolean(Keys.web.showRepositorySizes, true);\r
+ final boolean showSwatch = app().settings().getBoolean(Keys.web.repositoryListSwatches, true);\r
+ final boolean showSize = app().settings().getBoolean(Keys.web.showRepositorySizes, true);\r
\r
// repository swatch\r
Component swatch;\r
} else {\r
String owner = "";\r
for (String username : entry.owners) {\r
- UserModel ownerModel = GitBlit.self().getUserModel(username);\r
+ UserModel ownerModel = app().users().getUserModel(username);\r
\r
if (ownerModel != null) {\r
owner = ownerModel.getDisplayName();\r
\r
@Override\r
public void onClick() {\r
- if (GitBlit.self().deleteRepositoryModel(entry)) {\r
+ if (app().repositories().deleteRepositoryModel(entry)) {\r
// redirect to the owning page\r
if (entry.isPersonalRepository()) {\r
setResponsePage(getPage().getClass(), WicketUtils.newUsernameParameter(entry.projectPath.substring(1)));\r
import org.eclipse.jgit.transport.ReceiveCommand.Type;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RefLogEntry;\r
import com.gitblit.models.RepositoryCommit;\r
public ReflogPanel(String wicketId, final RepositoryModel model, Repository r, int limit, int pageOffset) {\r
super(wicketId);\r
boolean pageResults = limit <= 0;\r
- int changesPerPage = GitBlit.getInteger(Keys.web.reflogChangesPerPage, 10);\r
+ int changesPerPage = app().settings().getInteger(Keys.web.reflogChangesPerPage, 10);\r
if (changesPerPage <= 1) {\r
changesPerPage = 10;\r
}\r
}\r
\r
protected void setup(List<RefLogEntry> changes) {\r
- final int hashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6);\r
+ final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
\r
- String dateFormat = GitBlit.getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy HH:mm Z");\r
+ String dateFormat = app().settings().getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy HH:mm Z");\r
final TimeZone timezone = getTimeZone();\r
final DateFormat df = new SimpleDateFormat(dateFormat);\r
df.setTimeZone(timezone);\r
import com.gitblit.Constants.AccessPermission;
import com.gitblit.Constants.PermissionType;
import com.gitblit.Constants.RegistrantType;
-import com.gitblit.GitBlit;
import com.gitblit.models.RegistrantAccessPermission;
import com.gitblit.models.UserModel;
import com.gitblit.utils.DeepCopier;
} else if (RegistrantType.USER.equals(entry.registrantType)) {
// user
PersonIdent ident = new PersonIdent(entry.registrant, "");
- UserModel user = GitBlit.self().getUserModel(entry.registrant);
+ UserModel user = app().users().getUserModel(entry.registrant);
if (user != null) {
ident = new PersonIdent(user.getDisplayName(), user.emailAddress == null ? user.getDisplayName() : user.emailAddress);
}
import org.apache.wicket.model.Model;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.SyndicationServlet;\r
import com.gitblit.models.ProjectModel;\r
super(wicketId);\r
\r
final boolean linksActive = enableLinks;\r
- final boolean showSize = GitBlit.getBoolean(Keys.web.showRepositorySizes, true);\r
+ final boolean showSize = app().settings().getBoolean(Keys.web.showRepositorySizes, true);\r
\r
final UserModel user = GitBlitWebSession.get().getUser();\r
\r
\r
@Override\r
public void onClick() {\r
- GitBlit.self().resetRepositoryListCache();\r
+ app().repositories().resetRepositoryListCache();\r
setResponsePage(RepositoriesPage.class);\r
}\r
- }.setVisible(GitBlit.getBoolean(Keys.git.cacheRepositoryList, true)));\r
+ }.setVisible(app().settings().getBoolean(Keys.git.cacheRepositoryList, true)));\r
managementLinks.add(new BookmarkablePageLink<Void>("newRepository", EditRepositoryPage.class));\r
add(managementLinks);\r
} else if (showManagement && user != null && user.canCreate()) {\r
add (new Label("managementPanel").setVisible(false));\r
}\r
\r
- if (GitBlit.getString(Keys.web.repositoryListType, "flat").equalsIgnoreCase("grouped")) {\r
+ if (app().settings().getString(Keys.web.repositoryListType, "flat").equalsIgnoreCase("grouped")) {\r
List<RepositoryModel> rootRepositories = new ArrayList<RepositoryModel>();\r
Map<String, List<RepositoryModel>> groups = new HashMap<String, List<RepositoryModel>>();\r
for (RepositoryModel model : models) {\r
List<RepositoryModel> groupedModels = new ArrayList<RepositoryModel>();\r
for (String root : roots) {\r
List<RepositoryModel> subModels = groups.get(root);\r
- ProjectModel project = GitBlit.self().getProjectModel(root);\r
+ ProjectModel project = app().projects().getProjectModel(root);\r
GroupRepositoryModel group = new GroupRepositoryModel(project == null ? root : project.name, subModels.size());\r
if (project != null) {\r
group.title = project.title;\r
}\r
\r
final String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
- final boolean showSwatch = GitBlit.getBoolean(Keys.web.repositoryListSwatches, true);\r
+ final boolean showSwatch = app().settings().getBoolean(Keys.web.repositoryListSwatches, true);\r
\r
DataView<RepositoryModel> dataView = new DataView<RepositoryModel>("row", dp) {\r
private static final long serialVersionUID = 1L;\r
if (name.startsWith(ModelUtils.getUserRepoPrefix())) {\r
// user page\r
String username = ModelUtils.getUserNameFromRepoPath(name);\r
- UserModel user = GitBlit.self().getUserModel(username);\r
+ UserModel user = app().users().getUserModel(username);\r
row.add(new LinkPanel("groupName", null, (user == null ? username : user.getDisplayName()) + " (" + groupRow.count + ")", UserPage.class, WicketUtils.newUsernameParameter(username)));\r
row.add(new Label("groupDescription", getString("gb.personalRepositories")));\r
} else {\r
if (!ArrayUtils.isEmpty(entry.owners)) {\r
// display first owner\r
for (String username : entry.owners) {\r
- UserModel ownerModel = GitBlit.self().getUserModel(username);\r
+ UserModel ownerModel = app().users().getUserModel(username);\r
if (ownerModel != null) {\r
owner = ownerModel.getDisplayName();\r
break;\r
\r
@Override\r
public void onClick() {\r
- if (GitBlit.self().deleteRepositoryModel(entry)) {\r
+ if (app().repositories().deleteRepositoryModel(entry)) {\r
if (dp instanceof SortableRepositoriesProvider) {\r
info(MessageFormat.format(getString("gb.repositoryDeleted"), entry));\r
((SortableRepositoriesProvider) dp).remove(entry);\r
\r
import com.gitblit.Constants.AccessPermission;\r
import com.gitblit.Constants.AccessRestrictionType;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.GitClientApplication;\r
import com.gitblit.models.RepositoryModel;\r
\r
HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();\r
\r
- List<RepositoryUrl> repositoryUrls = GitBlit.self().getRepositoryUrls(req, user, repository);\r
+ List<RepositoryUrl> repositoryUrls = app().gitblit().getRepositoryUrls(req, user, repository);\r
// grab primary url from the top of the list\r
primaryUrl = repositoryUrls.size() == 0 ? null : repositoryUrls.get(0);\r
\r
add(createRepositoryIndicators(repository));\r
}\r
\r
- boolean allowAppLinks = GitBlit.getBoolean(Keys.web.allowAppCloneLinks, true);\r
+ boolean allowAppLinks = app().settings().getBoolean(Keys.web.allowAppCloneLinks, true);\r
if (onlyUrls || !canClone || !allowAppLinks) {\r
// only display the url(s)\r
add(new Label("applicationMenusPanel").setVisible(false));\r
}\r
\r
// access restriction icon and tooltip\r
- if (GitBlit.isServingRepositories()) {\r
+ if (app().runtime().isServingRepositories()) {\r
switch (repository.accessRestriction) {\r
case NONE:\r
urlPanel.add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));\r
final String userAgent = ((WebClientInfo) GitBlitWebSession.get().getClientInfo()).getUserAgent();\r
\r
if (user.canClone(repository)) {\r
- for (GitClientApplication app : GitBlit.self().getClientApplications()) {\r
+ for (GitClientApplication app : app().gitblit().getClientApplications()) {\r
if (app.isActive && app.allowsPlatform(userAgent)) {\r
displayedApps.add(app);\r
}\r
}\r
\r
protected Fragment createCopyFragment(String text) {\r
- if (GitBlit.getBoolean(Keys.web.allowFlashCopyToClipboard, true)) {\r
+ if (app().settings().getBoolean(Keys.web.allowFlashCopyToClipboard, true)) {\r
// clippy: flash-based copy & paste\r
Fragment copyFragment = new Fragment("copyFunction", "clippyPanel", this);\r
String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
fragment.add(wc);\r
}\r
\r
- boolean allowForking = GitBlit.getBoolean(Keys.web.allowForking, true);\r
+ boolean allowForking = app().settings().getBoolean(Keys.web.allowForking, true);\r
if (!allowForking || user == null || !user.isAuthenticated) {\r
// must be logged-in to fork, hide all fork controls\r
fragment.add(new Label("forksProhibitedIndicator").setVisible(false));\r
} else {\r
- String fork = GitBlit.self().getFork(user.username, repository.name);\r
+ String fork = app().repositories().getFork(user.username, repository.name);\r
boolean hasFork = fork != null;\r
boolean canFork = user.canFork(repository);\r
\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
import com.gitblit.Constants;\r
-import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.models.RefModel;\r
import com.gitblit.utils.JGitUtils;\r
boolean showRemoteRefs) {\r
super(wicketId);\r
boolean pageResults = limit <= 0;\r
- int itemsPerPage = GitBlit.getInteger(Keys.web.itemsPerPage, 50);\r
+ int itemsPerPage = app().settings().getInteger(Keys.web.itemsPerPage, 50);\r
if (itemsPerPage <= 1) {\r
itemsPerPage = 50;\r
}\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.TeamModel;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.EditTeamPage;\r
\r
Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);\r
adminLinks.add(new BookmarkablePageLink<Void>("newTeam", EditTeamPage.class));\r
- add(adminLinks.setVisible(showAdmin && GitBlit.self().supportsTeamMembershipChanges(null)));\r
+ add(adminLinks.setVisible(showAdmin && app().users().supportsTeamMembershipChanges(null)));\r
\r
- final List<TeamModel> teams = GitBlit.self().getAllTeams();\r
+ final List<TeamModel> teams = app().users().getAllTeams();\r
DataView<TeamModel> teamsView = new DataView<TeamModel>("teamRow",\r
new ListDataProvider<TeamModel>(teams)) {\r
private static final long serialVersionUID = 1L;\r
\r
@Override\r
public void onClick() {\r
- if (GitBlit.self().deleteTeam(entry.name)) {\r
+ if (app().users().deleteTeam(entry.name)) {\r
teams.remove(entry);\r
info(MessageFormat.format("Team ''{0}'' deleted.", entry.name));\r
} else {\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.WicketUtils;\r
\r
Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);\r
adminLinks.add(new BookmarkablePageLink<Void>("newUser", EditUserPage.class)\r
- .setVisible(GitBlit.self().supportsAddUser()));\r
+ .setVisible(app().users().supportsAddUser()));\r
add(adminLinks.setVisible(showAdmin));\r
\r
- final List<UserModel> users = GitBlit.self().getAllUsers();\r
+ final List<UserModel> users = app().users().getAllUsers();\r
DataView<UserModel> usersView = new DataView<UserModel>("userRow",\r
new ListDataProvider<UserModel>(users)) {\r
private static final long serialVersionUID = 1L;\r
\r
@Override\r
public void onClick() {\r
- if (GitBlit.self().deleteUser(entry.username)) {\r
+ if (app().users().deleteUser(entry.username)) {\r
users.remove(entry);\r
info(MessageFormat.format(getString("gb.userDeleted"), entry.username));\r
} else {\r