| | |
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.link.ExternalLink;
|
| | | import org.apache.wicket.markup.html.panel.FeedbackPanel;
|
| | | import org.apache.wicket.markup.html.resources.JavascriptResourceReference;
|
| | | import org.apache.wicket.markup.repeater.RepeatingView;
|
| | | import org.apache.wicket.protocol.http.RequestUtils;
|
| | | import org.apache.wicket.protocol.http.WebResponse;
|
| | | import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
|
| | |
| | | return canonicalUrl;
|
| | | }
|
| | |
|
| | | protected void manualRedirect(Class<? extends BasePage> pageClass) {
|
| | | redirect(pageClass, null);
|
| | | protected void redirectTo(Class<? extends BasePage> pageClass) {
|
| | | redirectTo(pageClass, null);
|
| | | }
|
| | |
|
| | | protected void redirect(Class<? extends BasePage> pageClass, PageParameters parameters) {
|
| | | protected void redirectTo(Class<? extends BasePage> pageClass, PageParameters parameters) {
|
| | | String absoluteUrl = getCanonicalUrl(pageClass, parameters);
|
| | | getRequestCycle().setRequestTarget(new RedirectRequestTarget(absoluteUrl));
|
| | | }
|
| | |
| | |
|
| | | protected void setupPage(String repositoryName, String pageName) {
|
| | | add(new Label("title", getPageTitle(repositoryName)));
|
| | |
|
| | | getBottomScriptContainer();
|
| | | String rootLinkUrl = app().settings().getString(Keys.web.rootLink, urlFor(GitBlitWebApp.get().getHomePage(), null).toString());
|
| | | ExternalLink rootLink = new ExternalLink("rootLink", rootLinkUrl);
|
| | | WicketUtils.setHtmlTooltip(rootLink, app().settings().getString(Keys.web.siteName, Constants.NAME));
|
| | |
| | | return sb.toString();
|
| | | }
|
| | |
|
| | | private RepeatingView getBottomScriptContainer() {
|
| | | RepeatingView bottomScriptContainer = (RepeatingView) get("bottomScripts");
|
| | | if (bottomScriptContainer == null) {
|
| | | bottomScriptContainer = new RepeatingView("bottomScripts");
|
| | | bottomScriptContainer.setRenderBodyOnly(true);
|
| | | add(bottomScriptContainer);
|
| | | }
|
| | | return bottomScriptContainer;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Adds a HTML script element loading the javascript designated by the given path.
|
| | | *
|
| | | * @param scriptPath
|
| | | * page-relative path to the Javascript resource; normally starts with "scripts/"
|
| | | */
|
| | | protected void addBottomScript(String scriptPath) {
|
| | | RepeatingView bottomScripts = getBottomScriptContainer();
|
| | | Label script = new Label(bottomScripts.newChildId(), "<script type='text/javascript' src='"
|
| | | + urlFor(new JavascriptResourceReference(this.getClass(), scriptPath)) + "'></script>\n");
|
| | | bottomScripts.add(script.setEscapeModelStrings(false).setRenderBodyOnly(true));
|
| | | }
|
| | |
|
| | | /**
|
| | | * Adds a HTML script element containing the given code.
|
| | | *
|
| | | * @param code
|
| | | * inline script code
|
| | | */
|
| | | protected void addBottomScriptInline(String code) {
|
| | | RepeatingView bottomScripts = getBottomScriptContainer();
|
| | | Label script = new Label(bottomScripts.newChildId(),
|
| | | "<script type='text/javascript'>/*<![CDATA[*/\n" + code + "\n//]]>\n</script>\n");
|
| | | bottomScripts.add(script.setEscapeModelStrings(false).setRenderBodyOnly(true));
|
| | | }
|
| | |
|
| | | }
|