public static void setTicketCssClass(Component container, String state) {\r
String css = null;\r
if (state.equals("open")) {\r
- css = "bug_open";\r
+ css = "label important";\r
} else if (state.equals("hold")) {\r
- css = "bug_hold";\r
+ css = "label warning";\r
} else if (state.equals("resolved")) {\r
- css = "bug_resolved";\r
+ css = "label success";\r
} else if (state.equals("invalid")) {\r
- css = "bug_invalid";\r
+ css = "label";\r
}\r
if (css != null) {\r
setCssClass(container, css);\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.GitBlitWebSession;\r
\r
-public class ChangePasswordPage extends StandardPage {\r
+public class ChangePasswordPage extends RootSubPage {\r
\r
IModel<String> password = new Model<String>("");\r
IModel<String> confirmPassword = new Model<String>("");\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
\r
-public class EditRepositoryPage extends StandardPage {\r
+public class EditRepositoryPage extends RootSubPage {\r
\r
private final boolean isCreate;\r
\r
import com.gitblit.wicket.WicketUtils;\r
\r
@RequiresAdminRole\r
-public class EditUserPage extends StandardPage {\r
+public class EditUserPage extends RootSubPage {\r
\r
private final boolean isCreate;\r
\r
userModel.username));\r
setResponsePage(EditUserPage.class);\r
} else {\r
- // back to home\r
- setResponsePage(RepositoriesPage.class);\r
+ // back to users page\r
+ setResponsePage(UsersPage.class);\r
}\r
}\r
};\r
<body>\r
<wicket:extend>\r
\r
- <div wicket:id="federationProposalsPanel">[federation proposals panel]</div>\r
+ <div wicket:id="federationTokensPanel">[federation tokens panel]</div>\r
+ \r
+ <div style="padding-top: 10px;" wicket:id="federationProposalsPanel">[federation proposals panel]</div>\r
\r
<div style="padding-top: 10px;" wicket:id="federationRegistrationsPanel">[federation registrations panel]</div>\r
\r
- <div wicket:id="federationTokensPanel">[federation tokens panel]</div>\r
- \r
</wicket:extend>\r
</body>\r
</html>
\ No newline at end of file
\r
public FederationPage() {\r
super();\r
+ setupPage("", "");\r
\r
boolean showFederation = showAdmin && GitBlit.canFederate();\r
add(new FederationTokensPanel("federationTokensPanel", showFederation)\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.FederationModel;\r
import com.gitblit.models.FederationModel.RepositoryStatus;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
\r
-public class FederationRegistrationPage extends StandardPage {\r
+public class FederationRegistrationPage extends RootSubPage {\r
\r
public FederationRegistrationPage(PageParameters params) {\r
super(params);\r
-\r
- final boolean showAdmin;\r
- if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {\r
- boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);\r
- showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();\r
- } else {\r
- showAdmin = false;\r
- }\r
+ \r
setStatelessHint(true);\r
\r
String url = WicketUtils.getUrlParameter(params);\r
\r
public RepositoriesPage() {\r
super();\r
+ setupPage("", "");\r
\r
// Load the markdown welcome message\r
String messageSource = GitBlit.getString(Keys.web.repositoriesMessage, "gitblit");\r
<tr><th valign="top"><wicket:message key="gb.proposal">proposal</wicket:message></th><td><span class="sha1" wicket:id="definition">[definition]</span></td></tr>\r
</table>\r
\r
- <div wicket:id="repositories"></div>\r
+ <div wicket:id="repositoriesPanel"></div>\r
\r
</wicket:extend> \r
</body>\r
import com.gitblit.wicket.panels.RepositoriesPanel;\r
\r
@RequiresAdminRole\r
-public class ReviewProposalPage extends StandardPage {\r
+public class ReviewProposalPage extends RootSubPage {\r
\r
private final String PROPS_PATTERN = "{0} = {1}\n";\r
\r
\r
List<RepositoryModel> repositories = new ArrayList<RepositoryModel>(\r
proposal.repositories.values());\r
- RepositoriesPanel repositoriesPanel = new RepositoriesPanel("repositories", false,\r
+ RepositoriesPanel repositoriesPanel = new RepositoriesPanel("repositoriesPanel", false,\r
repositories, getAccessRestrictions());\r
add(repositoriesPanel);\r
}\r
\r
import java.text.MessageFormat;\r
\r
-import javax.servlet.http.Cookie;\r
-\r
+import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.form.PasswordTextField;\r
import org.apache.wicket.markup.html.form.StatelessForm;\r
import org.apache.wicket.markup.html.form.TextField;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
import org.apache.wicket.model.IModel;\r
import org.apache.wicket.model.Model;\r
-import org.apache.wicket.protocol.http.WebRequest;\r
import org.apache.wicket.protocol.http.WebResponse;\r
\r
import com.gitblit.Constants;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.GitBlitWebSession;\r
\r
+/**\r
+ * Root page is a topbar, navigable page like Repositories, Users, or\r
+ * Federation.\r
+ * \r
+ * @author James Moger\r
+ * \r
+ */\r
public abstract class RootPage extends BasePage {\r
\r
- final boolean showAdmin;\r
+ boolean showAdmin;\r
\r
IModel<String> username = new Model<String>("");\r
IModel<String> password = new Model<String>("");\r
\r
public RootPage() {\r
super();\r
- setupPage("", "");\r
+ }\r
\r
- // try to automatically login from cookie\r
- if (!GitBlitWebSession.get().isLoggedIn()\r
- && GitBlit.getBoolean(Keys.web.allowCookieAuthentication, false)) {\r
- loginByCookie();\r
- }\r
+ public RootPage(PageParameters params) {\r
+ super(params);\r
+ }\r
\r
+ @Override\r
+ protected void setupPage(String repositoryName, String pageName) {\r
if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {\r
boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);\r
showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();\r
pendingProposals));\r
}\r
}\r
- }\r
-\r
- private void loginByCookie() {\r
- UserModel user = null;\r
-\r
- // Grab cookie from Browser Session\r
- Cookie[] cookies = ((WebRequest) getRequestCycle().getRequest()).getCookies();\r
- if (cookies != null && cookies.length > 0) {\r
- user = GitBlit.self().authenticate(cookies);\r
- }\r
\r
- // Login the user\r
- loginUser(user);\r
+ super.setupPage(repositoryName, pageName);\r
}\r
\r
private void loginUser(UserModel user) {\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:extend>\r
+ <!-- page header -->\r
+ <div class="page-header">\r
+ <h2><span wicket:id="pageName">[page name]</span> <small><span wicket:id="pageSubName">[sub name]</span></small></h2>\r
+ </div>\r
+ \r
+ <!-- Subclass Content -->\r
+ <wicket:child/>\r
+</wicket:extend>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+/*\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.pages;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+\r
+import com.gitblit.utils.StringUtils;\r
+\r
+/**\r
+ * RootSubPage is a non-topbar navigable RootPage. It also has a page header.\r
+ * \r
+ * @author James Moger\r
+ * \r
+ */\r
+public abstract class RootSubPage extends RootPage {\r
+\r
+ public RootSubPage() {\r
+ super();\r
+ }\r
+\r
+ public RootSubPage(PageParameters params) {\r
+ super(params);\r
+ }\r
+\r
+ @Override\r
+ protected void setupPage(String pageName, String subName) {\r
+ add(new Label("pageName", pageName));\r
+ if (!StringUtils.isEmpty(subName)) {\r
+ subName = "/ " + subName;\r
+ }\r
+ add(new Label("pageSubName", subName));\r
+ super.setupPage("", pageName);\r
+ }\r
+}\r
</table>\r
</form>\r
\r
- <div style="padding-top:10px;" wicket:id="repositories"></div>\r
+ <div style="padding-top:10px;" wicket:id="repositoriesPanel"></div>\r
</body>\r
</wicket:extend> \r
</html>
\ No newline at end of file
import com.gitblit.wicket.panels.RepositoriesPanel;\r
\r
@RequiresAdminRole\r
-public class SendProposalPage extends StandardPage {\r
+public class SendProposalPage extends RootSubPage {\r
\r
public String myUrl;\r
\r
\r
@Override\r
public void onSubmit() {\r
- setResponsePage(RepositoriesPage.class);\r
+ setResponsePage(FederationPage.class);\r
}\r
};\r
cancel.setDefaultFormProcessing(false);\r
\r
List<RepositoryModel> repositories = new ArrayList<RepositoryModel>(\r
proposal.repositories.values());\r
- RepositoriesPanel repositoriesPanel = new RepositoriesPanel("repositories", false,\r
+ RepositoriesPanel repositoriesPanel = new RepositoriesPanel("repositoriesPanel", false,\r
repositories, getAccessRestrictions());\r
add(repositoriesPanel);\r
}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<body>\r
-<wicket:extend>\r
- <!-- topbar header -->\r
- <div class="topbar">\r
- <div class="fill">\r
- <div class="container">\r
- <a class="brand" wicket:id="rootLink">\r
- <img src="gitblt_25_white.png" width="79" height="25" alt="gitblit" class="logo"/>\r
- </a>\r
- </div>\r
- </div>\r
- </div>\r
- \r
- <!-- feedback panel -->\r
- <div style="text-align:center;padding-top:5px;" wicket:id="feedback">[Feedback Panel]</div>\r
- \r
- <!-- page header -->\r
- <div class="page-header">\r
- <h2><span wicket:id="pageName">[page name]</span> <small><span wicket:id="pageSubName">[sub name]</span></small></h2>\r
- </div>\r
- \r
- <!-- Subclass Content -->\r
- <wicket:child/>\r
-</wicket:extend>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-/*\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.pages;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-\r
-import com.gitblit.utils.StringUtils;\r
-\r
-public abstract class StandardPage extends BasePage {\r
- \r
- public StandardPage() {\r
- // create constructor\r
- super();\r
- setStatelessHint(true);\r
- }\r
-\r
- public StandardPage(PageParameters params) {\r
- // edit constructor\r
- super(params);\r
- setStatelessHint(true);\r
- }\r
-\r
- protected void setupPage(String pageName, String subName) { \r
- add(new Label("pageName", pageName));\r
- if (!StringUtils.isEmpty(subName)) {\r
- subName = "/ " + subName;\r
- }\r
- add(new Label("pageSubName", subName));\r
- super.setupPage("", pageName);\r
- }\r
-}\r
<wicket:extend>\r
\r
<!-- ticket title -->\r
- <div style="font-size:150%;padding-top:5px;" wicket:id="ticketTitle">[ticket title]</div>\r
+ <div style="font-size:150%;padding-top:5px;padding-bottom:5px;" wicket:id="ticketTitle">[ticket title]</div>\r
\r
<!-- ticket info -->\r
<table class="plain">\r
public TicketPage(PageParameters params) {\r
super(params);\r
\r
- final String ticketFolder = WicketUtils.getPath(params);\r
+ final String ticketFolder = WicketUtils.getObject(params);\r
\r
Repository r = getRepository();\r
TicketModel t = TicgitUtils.getTicket(r, ticketFolder);\r
\r
public UsersPage() {\r
super(); \r
+ setupPage("", "");\r
\r
add(new UsersPanel("usersPanel", showAdmin).setVisible(showAdmin));\r
}\r