]> source.dussan.org Git - gitblit.git/commitdiff
Initial changes for ticket-57
authorEddy Young <jeyoung@priscimon.com>
Mon, 18 May 2015 20:11:27 +0000 (21:11 +0100)
committerEddy Young <jeyoung@priscimon.com>
Mon, 18 May 2015 20:11:27 +0000 (21:11 +0100)
Added tags to .gitignore

.classpath
.gitignore
gitblit.iml
src/main/distrib/data/gitblit.properties
src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html
src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java

index 2644d446cbe819cf053dd56a5f0e60df431e07b9..4bbe61369e97f7c126570556e04741bcd6731b2d 100644 (file)
@@ -15,7 +15,7 @@
        <classpathentry kind="lib" path="ext/slf4j-log4j12-1.7.5.jar" sourcepath="ext/src/slf4j-log4j12-1.7.5.jar" />
        <classpathentry kind="lib" path="ext/javax.mail-1.5.1.jar" sourcepath="ext/src/javax.mail-1.5.1.jar" />
        <classpathentry kind="lib" path="ext/javax.servlet-api-3.1.0.jar" sourcepath="ext/src/javax.servlet-api-3.1.0.jar" />
-       <classpathentry kind="lib" path="ext/jetty-all-9.2.3.v20140905.jar" sourcepath="ext/src/jetty-all-9.2.3.v20140905.jar" />
+       <classpathentry kind="lib" path="ext/jetty-all-9.2.9.v20150224.jar" sourcepath="ext/src/jetty-all-9.2.9.v20150224.jar" />
        <classpathentry kind="lib" path="ext/wicket-1.4.21.jar" sourcepath="ext/src/wicket-1.4.21.jar" />
        <classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.21.jar" sourcepath="ext/src/wicket-auth-roles-1.4.21.jar" />
        <classpathentry kind="lib" path="ext/wicket-extensions-1.4.21.jar" sourcepath="ext/src/wicket-extensions-1.4.21.jar" />
index 6c262bb255569441eac7a09ddf0502eb7fce3a5c..4cb411648460efc92ae649fa6874ef43ddc87149 100644 (file)
@@ -1,3 +1,4 @@
+tags
 /temp
 /lib
 /ext
index d6f84df7bfdf76ca2f65f15f8d28d45fb5e8fce2..c2cb93f7e17461803be95119bf3ae1fa0eb1ddad 100644 (file)
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-all-9.2.3.v20140905.jar">
+      <library name="jetty-all-9.2.9.v20150224.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-all-9.2.3.v20140905.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-all-9.2.9.v20150224.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-all-9.2.3.v20140905.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-all-9.2.9.v20150224.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
index f53cc11215283134aec57c4655df8f177f145514..7e7e1f4e2aa30b2198325dae03d8e6b9b1f1a277 100644 (file)
@@ -497,7 +497,8 @@ git.maxPackSizeLimit = -1
 #
 # SINCE 1.4.0
 # RESTART REQUIRED
-tickets.service = 
+tickets.service = com.gitblit.tickets.FileTicketService
+#
 
 # Globally enable or disable creation of new bug, enhancement, task, etc tickets
 # for all repositories.
index b0bc19493e98e7c1538b2cb37ae6520ead4325fd..d4dd3bc031eecf8e50ccbd67fb9dce35283e803e 100644 (file)
                                                                </ul>
                                                        </div>
                                                        
+                            // TODO implement repositories list
+                                                       <div class="btn-group">
+                                                               <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <wicket:message key="gb.repository"></wicket:message>: <span style="font-weight:bold;" wicket:id="currentRepository"></span> <span class="caret"></span></a>
+                                                               <ul class="dropdown-menu">
+                                                                       <li wicket:id="repository"><span wicket:id="repositoryLink"></span></li>
+                                                               </ul>
+                                                       </div>
+                                                       
                                                        <div class="btn-group pull-right">
                                                                <div class="pagination pagination-right pagination-small">
                                                                        <ul>
@@ -81,4 +89,4 @@
                                
 </wicket:extend>
 </body>
-</html>
\ No newline at end of file
+</html>
index c207d561a2a299738b870faeedbcf0154009d020..6adf394cc6972234d4614e8b14697548d192d477 100644 (file)
@@ -27,6 +27,7 @@ import org.apache.wicket.markup.repeater.data.DataView;
 import org.apache.wicket.markup.repeater.data.ListDataProvider;
 
 import com.gitblit.Keys;
+import com.gitblit.models.RepositoryModel;
 import com.gitblit.models.TicketModel;
 import com.gitblit.models.TicketModel.Status;
 import com.gitblit.models.UserModel;
@@ -74,6 +75,7 @@ public class MyTicketsPage extends RootPage {
                final String queryParam = (params == null || StringUtils.isEmpty(params.getString("q", null))) ? "watchedby:" + username : params.getString("q", null);
                final String searchParam = (params == null) ? "" : params.getString("s", null);
                final String sortBy = (params == null) ? "" : Lucene.fromString(params.getString("sort", Lucene.created.name())).name();
+               final String repository = (params == null) ? "" : Lucene.fromString(params.getString("repository", Lucene.repository.name())).name();
                final boolean desc = (params == null) ? true : !"asc".equals(params.getString("direction", "desc"));
 
                // add the user title panel
@@ -91,6 +93,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
 
                add(new BookmarkablePageLink<Void>("bugsQuery", MyTicketsPage.class,
@@ -101,6 +104,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
 
                add(new BookmarkablePageLink<Void>("enhancementsQuery", MyTicketsPage.class,
@@ -111,6 +115,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
 
                add(new BookmarkablePageLink<Void>("tasksQuery", MyTicketsPage.class,
@@ -121,6 +126,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
 
                add(new BookmarkablePageLink<Void>("questionsQuery", MyTicketsPage.class,
@@ -131,6 +137,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
 
                add(new BookmarkablePageLink<Void>("resetQuery", MyTicketsPage.class,
@@ -141,6 +148,7 @@ public class MyTicketsPage extends RootPage {
                                                null,
                                                null,
                                                true,
+                        null,
                                                1)));
 
                add(new Label("userDivider"));
@@ -152,6 +160,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
 
                add(new BookmarkablePageLink<Void>("watchedQuery", MyTicketsPage.class,
@@ -162,6 +171,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
                add(new BookmarkablePageLink<Void>("mentionsQuery", MyTicketsPage.class,
                                queryParameters(
@@ -171,6 +181,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
                add(new BookmarkablePageLink<Void>("responsibleQuery", MyTicketsPage.class,
                                queryParameters(
@@ -180,6 +191,7 @@ public class MyTicketsPage extends RootPage {
                                                assignedToParam,
                                                sortBy,
                                                desc,
+                        repository,
                                                1)));
 
                // states
@@ -188,9 +200,9 @@ public class MyTicketsPage extends RootPage {
                } else {
                        add(new Label("selectedStatii", StringUtils.flattenStrings(Arrays.asList(statiiParam), ",")));
                }
-               add(new BookmarkablePageLink<Void>("openTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.openStatii, assignedToParam, sortBy, desc, 1)));
-               add(new BookmarkablePageLink<Void>("closedTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.closedStatii, assignedToParam, sortBy, desc, 1)));
-               add(new BookmarkablePageLink<Void>("allTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, null, assignedToParam, sortBy, desc, 1)));
+               add(new BookmarkablePageLink<Void>("openTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.openStatii, assignedToParam, sortBy, desc, repository, 1)));
+               add(new BookmarkablePageLink<Void>("closedTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.closedStatii, assignedToParam, sortBy, desc, repository, 1)));
+               add(new BookmarkablePageLink<Void>("allTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, null, assignedToParam, sortBy, desc, repository, 1)));
 
                // by status
                List<Status> statii = new ArrayList<Status>(Arrays.asList(Status.values()));
@@ -202,13 +214,14 @@ public class MyTicketsPage extends RootPage {
                        @Override
                        public void populateItem(final Item<Status> item) {
                                final Status status = item.getModelObject();
-                               PageParameters p = queryParameters(queryParam, milestoneParam, new String [] { status.name().toLowerCase() }, assignedToParam, sortBy, desc, 1);
+                               PageParameters p = queryParameters(queryParam, milestoneParam, new String [] { status.name().toLowerCase() }, assignedToParam, sortBy, desc, repository, 1);
                                String css = TicketsUI.getStatusClass(status);
                                item.add(new LinkPanel("statusLink", css, status.toString(), MyTicketsPage.class, p).setRenderBodyOnly(true));
                        }
                };
                add(statiiLinks);
 
+        // by sort
                List<TicketSort> sortChoices = new ArrayList<TicketSort>();
                sortChoices.add(new TicketSort(getString("gb.sortNewest"), Lucene.created.name(), true));
                sortChoices.add(new TicketSort(getString("gb.sortOldest"), Lucene.created.name(), false));
@@ -237,12 +250,39 @@ public class MyTicketsPage extends RootPage {
                        @Override
                        public void populateItem(final Item<TicketSort> item) {
                                final TicketSort ts = item.getModelObject();
-                               PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, ts.sortBy, ts.desc, 1);
+                               PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, ts.sortBy, ts.desc, repository, 1);
                                item.add(new LinkPanel("sortLink", null, ts.name, MyTicketsPage.class, params).setRenderBodyOnly(true));
                        }
                };
                add(sortMenu);
 
+        // by repository
+               List<RepositoryModel> repositoryChoices = new ArrayList<RepositoryModel>();
+        // todo add repository choices here
+
+               RepositoryModel currentRepository = repositoryChoices.size() > 0 ? repositoryChoices.get(0) : null;
+               for (RepositoryModel r : repositoryChoices) {
+                       if (r.name.equals(repository)) {
+                               currentRepository = r;
+                               break;
+                       }
+               }
+               add(new Label("currentRepository", currentRepository == null ? "none" : currentRepository.name));
+
+               ListDataProvider<RepositoryModel> repositoryChoicesDp = new ListDataProvider<RepositoryModel>(repositoryChoices);
+               DataView<RepositoryModel> repositoryMenu = new DataView<RepositoryModel>("repository", repositoryChoicesDp) {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       public void populateItem(final Item<RepositoryModel> item) {
+                               final RepositoryModel r = item.getModelObject();
+                // todo add repository parameter
+                               PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, r.name, 1);
+                               item.add(new LinkPanel("repositoryLink", null, r.name, MyTicketsPage.class, params).setRenderBodyOnly(true));
+                       }
+               };
+               add(repositoryMenu);
+
                // Build Query here
                QueryBuilder qb = new QueryBuilder(queryParam);
                if (!qb.containsField(Lucene.status.name()) && !ArrayUtils.isEmpty(statiiParam)) {
@@ -292,12 +332,13 @@ public class MyTicketsPage extends RootPage {
                }
 
                int totalResults = results.size() == 0 ? 0 : results.get(0).totalResults;
-               buildPager(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, page, pageSize, results.size(), totalResults);
+               buildPager(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, repository, page, pageSize, results.size(), totalResults);
 
                final boolean showSwatch = app().settings().getBoolean(Keys.web.repositoryListSwatches, true);
                add(new TicketListPanel("ticketList", results, showSwatch, true));
        }
 
+    // todo add repository name here
        protected PageParameters queryParameters(
                        String query,
                        String milestone,
@@ -305,6 +346,7 @@ public class MyTicketsPage extends RootPage {
                        String assignedTo,
                        String sort,
                        boolean descending,
+                       String repository,
                        int page) {
 
                PageParameters params = WicketUtils.newRepositoryParameter("");
@@ -328,6 +370,9 @@ public class MyTicketsPage extends RootPage {
                if (!descending) {
                        params.add("direction", "asc");
                }
+               if (!StringUtils.isEmpty(repository)) {
+                       params.add("repository", repository);
+               }
                if (page > 1) {
                        params.add("pg", "" + page);
                }
@@ -341,6 +386,7 @@ public class MyTicketsPage extends RootPage {
                        final String assignedTo,
                        final String sort,
                        final boolean desc,
+                       final String repository,
                        final int page,
                        int pageSize,
                        int count,
@@ -349,8 +395,8 @@ public class MyTicketsPage extends RootPage {
                boolean showNav = total > (2 * pageSize);
                boolean allowPrev = page > 1;
                boolean allowNext = (pageSize * (page - 1) + count) < total;
-               add(new BookmarkablePageLink<Void>("prevLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, page - 1)).setEnabled(allowPrev).setVisible(showNav));
-               add(new BookmarkablePageLink<Void>("nextLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, page + 1)).setEnabled(allowNext).setVisible(showNav));
+               add(new BookmarkablePageLink<Void>("prevLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repository, page - 1)).setEnabled(allowPrev).setVisible(showNav));
+               add(new BookmarkablePageLink<Void>("nextLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repository, page + 1)).setEnabled(allowNext).setVisible(showNav));
 
                if (total <= pageSize) {
                        add(new Label("pageLink").setVisible(false));
@@ -379,7 +425,7 @@ public class MyTicketsPage extends RootPage {
                        @Override
                        public void populateItem(final Item<Integer> item) {
                                final Integer i = item.getModelObject();
-                               LinkPanel link = new LinkPanel("page", null, "" + i, MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, i));
+                               LinkPanel link = new LinkPanel("page", null, "" + i, MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repository, i));
                                link.setRenderBodyOnly(true);
                                if (i == page) {
                                        WicketUtils.setCssClass(item, "active");