]> source.dussan.org Git - gitblit.git/commitdiff
Clarified page hierarchy. Fixed TicGit pages.
authorJames Moger <james.moger@gitblit.com>
Fri, 30 Sep 2011 23:49:03 +0000 (19:49 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 30 Sep 2011 23:49:03 +0000 (19:49 -0400)
20 files changed:
src/com/gitblit/wicket/WicketUtils.java
src/com/gitblit/wicket/pages/ChangePasswordPage.java
src/com/gitblit/wicket/pages/EditRepositoryPage.java
src/com/gitblit/wicket/pages/EditUserPage.java
src/com/gitblit/wicket/pages/FederationPage.html
src/com/gitblit/wicket/pages/FederationPage.java
src/com/gitblit/wicket/pages/FederationRegistrationPage.java
src/com/gitblit/wicket/pages/RepositoriesPage.java
src/com/gitblit/wicket/pages/ReviewProposalPage.html
src/com/gitblit/wicket/pages/ReviewProposalPage.java
src/com/gitblit/wicket/pages/RootPage.java
src/com/gitblit/wicket/pages/RootSubPage.html [new file with mode: 0644]
src/com/gitblit/wicket/pages/RootSubPage.java [new file with mode: 0644]
src/com/gitblit/wicket/pages/SendProposalPage.html
src/com/gitblit/wicket/pages/SendProposalPage.java
src/com/gitblit/wicket/pages/StandardPage.html [deleted file]
src/com/gitblit/wicket/pages/StandardPage.java [deleted file]
src/com/gitblit/wicket/pages/TicketPage.html
src/com/gitblit/wicket/pages/TicketPage.java
src/com/gitblit/wicket/pages/UsersPage.java

index 3ffd6cd75dfc13c3a99caca26d8f10d4bc8a19b6..e5b7f697bfc1a8231c9fe1971fe2668af9403815 100644 (file)
@@ -88,13 +88,13 @@ public class WicketUtils {
        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
index 660a813101b9c725122f5c154eb19ef14bbf4ef2..fec24144177b5add0e44b77d84b6c3779569dcd8 100644 (file)
@@ -32,7 +32,7 @@ import com.gitblit.models.UserModel;
 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
index ae7966d0adf3060a24227f94b3ac49f9e63e04e0..2afe014c1cd520b884a1d052b7871fd86e15413e 100644 (file)
@@ -47,7 +47,7 @@ import com.gitblit.utils.StringUtils;
 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
index 8dbb0d907e8a69490c3eff3f2048e2af1f1ffe91..446ab898a335ef02a1b8b43c2e477f781a28978d 100644 (file)
@@ -44,7 +44,7 @@ import com.gitblit.wicket.RequiresAdminRole;
 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
@@ -157,8 +157,8 @@ public class EditUserPage extends StandardPage {
                                                        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
index ab8a94178524b9a1569b03c8103ec2827c5f8921..bb39d345e39e199642bca4e074fc65dab4562672 100644 (file)
@@ -6,12 +6,12 @@
 <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
index b993f718f2a9533f7e4daab6e3505757faa3076a..1f98c1727d2950808686c387b7e99814def00331 100644 (file)
@@ -25,6 +25,7 @@ public class FederationPage extends RootPage {
 \r
        public FederationPage() {\r
                super();\r
+               setupPage("", "");\r
 \r
                boolean showFederation = showAdmin && GitBlit.canFederate();\r
                add(new FederationTokensPanel("federationTokensPanel", showFederation)\r
index aed94a41f08a1501697236f19dd985e84f115dfc..e480eb76881383954fffb1e432a9f1c340a1a45d 100644 (file)
@@ -25,24 +25,15 @@ import org.apache.wicket.markup.repeater.data.DataView;
 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
index 5339760e83a09ec05c4abb5c2c576e9e2a225de0..289006fa5d2e2f296b4a2a04b9e388db69d22baa 100644 (file)
@@ -35,6 +35,7 @@ public class RepositoriesPage extends RootPage {
 \r
        public RepositoriesPage() {\r
                super();\r
+               setupPage("", "");\r
 \r
                // Load the markdown welcome message\r
                String messageSource = GitBlit.getString(Keys.web.repositoriesMessage, "gitblit");\r
index 7f26f281276971a13803348ac954082bd8e964b6..6487a0ac98935ea76092cb64d8359dee24a1f0f5 100644 (file)
@@ -16,7 +16,7 @@
                <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
index 2f2d6f3951725913d0900b557c779be35ecdee68..1d9092a59a38e072dca738d30da51242941a415b 100644 (file)
@@ -33,7 +33,7 @@ import com.gitblit.wicket.WicketUtils;
 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
@@ -91,7 +91,7 @@ public class ReviewProposalPage extends StandardPage {
 \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
index dd64de661aa82dff0d8e70ae3ab638dbfe160c23..37f6ad1b0da1b5be7ebc09f0a4d84838f4b8afb3 100644 (file)
@@ -17,15 +17,13 @@ package com.gitblit.wicket.pages;
 \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
@@ -35,23 +33,30 @@ import com.gitblit.models.UserModel;
 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
@@ -122,19 +127,8 @@ public abstract class RootPage extends BasePage {
                                                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
diff --git a/src/com/gitblit/wicket/pages/RootSubPage.html b/src/com/gitblit/wicket/pages/RootSubPage.html
new file mode 100644 (file)
index 0000000..554da11
--- /dev/null
@@ -0,0 +1,18 @@
+<!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
diff --git a/src/com/gitblit/wicket/pages/RootSubPage.java b/src/com/gitblit/wicket/pages/RootSubPage.java
new file mode 100644 (file)
index 0000000..f7572b1
--- /dev/null
@@ -0,0 +1,48 @@
+/*\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
index 794cb702e44a8a9d5902c4104f865eeb3ec62bad..8a289068aa79583c9c11331b4789da0347628f07 100644 (file)
@@ -18,7 +18,7 @@
        </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
index 11f97a08147e5c31563285193d63ee6f8f3838dd..ed2004996a3468a1ed2df14cdc377fe964175226 100644 (file)
@@ -37,7 +37,7 @@ import com.gitblit.wicket.WicketUtils;
 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
@@ -139,7 +139,7 @@ public class SendProposalPage extends StandardPage {
 \r
                        @Override\r
                        public void onSubmit() {\r
-                               setResponsePage(RepositoriesPage.class);\r
+                               setResponsePage(FederationPage.class);\r
                        }\r
                };\r
                cancel.setDefaultFormProcessing(false);\r
@@ -148,7 +148,7 @@ public class SendProposalPage extends StandardPage {
 \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
diff --git a/src/com/gitblit/wicket/pages/StandardPage.html b/src/com/gitblit/wicket/pages/StandardPage.html
deleted file mode 100644 (file)
index 14ec15c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<!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
diff --git a/src/com/gitblit/wicket/pages/StandardPage.java b/src/com/gitblit/wicket/pages/StandardPage.java
deleted file mode 100644 (file)
index 4598931..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\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
index 160bc0cf17e5c7fc23ab6c231893eebd8c26a97a..ed3eb22935ebdaf586d6c7e415f6f8659dfe061e 100644 (file)
@@ -8,7 +8,7 @@
 <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
index 48db1cea2cfb1aeacc49d83dd95c607c0c8c7fa8..d250a452ed1a94f6a99eb439b75de58213ff582e 100644 (file)
@@ -34,7 +34,7 @@ public class TicketPage extends RepositoryPage {
        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
index 9a7f8a585449f4aa3dd96136dc23e9514faad3a5..b54b968d2c056f52654eff50de5951ed5f967bd1 100644 (file)
@@ -23,6 +23,7 @@ public class UsersPage extends RootPage {
 \r
        public UsersPage() {\r
                super();                \r
+               setupPage("", "");\r
 \r
                add(new UsersPanel("usersPanel", showAdmin).setVisible(showAdmin));\r
        }\r