Subversion

xoocode

Compare Path:  Rev
With Path: Rev

This comparison shows the changes necessary to convert path /org.xoocode.xoosent/trunk/xoosent (Rev 352) TO /org.xoocode.xoosent/trunk/xoosent (Rev 353)

Reverse comparison

src/main/java/org/xoocode/xoosent/web/XooSentApplication.java

@@ -22,6 +22,7 @@
import org.xoocode.xoosent.service.DataMigrationService;
import org.xoocode.xoosent.service.notification.NotificationService;
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.list.ListProjects;
 
import wicket.Application;
import wicket.Component;

@@ -62,7 +63,7 @@
}
@Override
public Class getHomePage() {
return ListIssues.class;
return ListProjects.class;
}
 
@Override

@@ -93,7 +94,8 @@
if (user == null) {
return false;
} else {
return user.hasAnyRole(new Roles(getDeveloperRole(project)));
return user.hasAnyRole(new Roles(
new String[] {getDeveloperRole(project), "ADMIN"}));
}
}
 


src/main/java/org/xoocode/xoosent/web/Main.java

@@ -10,7 +10,7 @@
public class Main {
final static Logger logger = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) throws Exception {
int port = 8080;
int port = 8083;
String webappRoot = "src/main/webapp";
String contextPath = "/";
if (args.length > 0) {


src/main/java/org/xoocode/xoosent/web/project/edit/EditProject.html

@@ -12,7 +12,7 @@
<table>
<tr>
<td><label for="sid">SID</label></td>
<td><span wicket:id="sid" id="sid">DEMO</span></td>
<td><input wicket:id="sid" id="sid" type="text" value="DEMO" /></td>
</tr>
<tr>
<td><label for="name">Name</label></td>


src/main/java/org/xoocode/xoosent/web/project/edit/EditProject.java

@@ -9,11 +9,11 @@
import org.xoocode.xoosent.model.Project;
import org.xoocode.xoosent.web.XooSentApplication;
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.list.ListProjects;
 
import wicket.PageParameters;
import wicket.authorization.strategies.role.Roles;
import wicket.authorization.strategies.role.annotations.AuthorizeInstantiation;
import wicket.markup.html.basic.Label;
import wicket.markup.html.form.Button;
import wicket.markup.html.form.TextField;
import wicket.model.BoundCompoundPropertyModel;

@@ -49,10 +49,16 @@
super(id, project);
add (new Button("return") {
protected void onSubmit() {
setResponsePage(new ListIssues(new PageParameters()));
PageParameters params = new PageParameters();
params.put("project", ((Project)EditForm.this.getModelObject()).getSid());
setResponsePage(ListIssues.class, params);
}
});
add(new Label("sid"));
TextField sidField = new TextField("sid");
add(sidField);
if (((Project)project.getObject(this)).getSid() != null) {
sidField.setEnabled(false);
}
add(new TextField("name"));
add(new TextField("symbolicName"));
add(new TextField("eMail"));

@@ -61,6 +67,7 @@
deletePersistentObject();
DataRequestCycle.getHibernateSession().getTransaction().commit();
clearPersistentObject();
setResponsePage(ListProjects.class);
}
}.setDefaultFormProcessing(false));
}


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.properties
New file

@@ -0,0 +1,6 @@
#this query would get slow with very many issues; lucene would be better
 
# the ':*IsNull = 1' are a workaround for a derby embedded issue
# that could be rewritten as ':* is null'
query=select distinct p from Project p \
order by p.sid

\ No newline at end of file


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.java
New file

@@ -0,0 +1,87 @@
package org.xoocode.xoosent.web.project.list;
 
import net.databinder.components.StyleLink;
import net.databinder.models.HibernateListModel;
import net.databinder.models.HibernateObjectModel;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xoocode.xoosent.model.Issue;
import org.xoocode.xoosent.model.Project;
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.edit.EditProjectPage;
import org.xoocode.xoosent.web.template.TemplateDataPage;
 
import wicket.Component;
import wicket.Page;
import wicket.PageParameters;
import wicket.markup.ComponentTag;
import wicket.markup.html.WebMarkupContainer;
import wicket.markup.html.basic.Label;
import wicket.markup.html.link.BookmarkablePageLink;
import wicket.markup.html.link.IPageLink;
import wicket.markup.html.link.Link;
import wicket.markup.html.link.PageLink;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.PropertyListView;
 
public class ListProjects extends TemplateDataPage {
final Logger logger = LoggerFactory.getLogger(ListProjects.class);
 
/** The dispay or edit panel. */
private Component content;
 
public ListProjects() {
init();
}
 
/** Add page components. */
protected void init() {
// custom styles for this page
add(new StyleLink("stylesheet", ListProjects.class));
 
 
add(new PropertyListView("projects",
new HibernateListModel(getString("query"))) {
protected void populateItem(final ListItem item) {
WebMarkupContainer tr = new WebMarkupContainer("projectBanner") {
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
Project project = (Project) item.getModelObject();
// if (issue.getStatus() != null) {
// tag.put("style", "background-color: "+issue.getStatus().getColor()+";");
// }
}
};
item.add(tr);
// use bookmarkable links so search engines can peruse
PageParameters params = new PageParameters();
params.put("project", ((Project) item.getModelObject()).getSid());
Link link = new BookmarkablePageLink("sidLink", ListIssues.class, params);
tr.add(link);
link.add(new Label("sid"));
tr.add(new Label("symbolicName"));
tr.add(new Label("name"));
}
});
 
// link to
add(new PageLink("newProject", new IPageLink() {
/** Link to a new, blank issue. */
public Page getPage() {
HibernateObjectModel projectModel = new HibernateObjectModel(Project.class);
return new EditProjectPage(projectModel);
}
/** @return null since the self-referential identity would disable the link */
public Class getPageIdentity() {
return null;
}
}));
}
 
@Override
protected String getName() {
return "XooSent :: Projects";
}
}


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.html
New file

@@ -0,0 +1,32 @@
<html>
<head>
<wicket:head>
<link wicket:id="stylesheet" href="ListProjects.css" type="text/css" rel="stylesheet" />
</wicket:head>
<title>XooSent :: Projects</title>
</head>
<body>
<!-- nothing outside of this extend renders in Wicket -->
<wicket:extend>
 
<table cellspacing="0" width="100%">
<div wicket:id="projects">
<tr wicket:id="projectBanner">
<td>
<a wicket:id="sidLink" href="#"><span wicket:id="sid">XSENT</span></a>
</td>
<td>
<span wicket:id="symbolicName">org.xoocode.xoosent</span>
</td>
<td>
<span wicket:id="name">XooSent</span>
</td>
</tr>
</div>
</table>
<p><a wicket:id="newProject" href="#">Enter new project</a></p>
 
</wicket:extend>
 
</body>
</html>

\ No newline at end of file


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.css
New file

@@ -0,0 +1,81 @@
img {
border: none;
}
 
div.issuesColumn {
float: left;
width: 50em;
}
 
.filters {
float: right;
margin-top: 1px;
}
 
.filters option {
padding:0px 0pt 0px 20px;
background-repeat: no-repeat;
background-position:1px 2px;
vertical-align:middle;
}
div.issuesColumn div#search {
margin-bottom: 1em;
}
 
input.searchField {
width: 20em;
}
 
div.contentBlock {
margin-left: 1em;
float: left;
width: 50em;
}
 
p.moreInfo {
clear: both;
text-align: right;
}
 
h1.issueTitle {
margin-bottom: 0;
}
 
table {
border-collapse: collapse;
}
 
td {
text-align: left;
}
 
.issueDetail td {
border: 1px dotted #bbbbbb;
}
 
div.details {
float: right;
background-color: #ddddff;
border: 1px dotted #4444ff;
padding: 4px;
margin: 4px;
}
 
.details td {
border: 0px;
padding: 0 2px 0 2px;
}
 
.label {
font-weight: 700;
color: #4444ff;
text-align: right;
}
 
div.footer {
clear: both;
text-align: center;
padding: 0px 3px 0px 3px;
margin-left: 15%;
margin-right: 15%;
}

\ No newline at end of file


src/main/java/org/xoocode/xoosent/web/issues/edit/EditIssue.java

@@ -118,7 +118,7 @@
add(status);
HibernateListModel usersListModel =
// select only users who are developers of the current project
new HibernateListModel("select u.username from DataUser u where :role = some elements(u.roles) order by u.username",
new HibernateListModel("select u.username from DataUser u where :role = some elements(u.roles) or 'ADMIN' = some elements(u.roles) order by u.username",
new IQueryBinder() {
public void bind(Query query) {
String developerRole = XooSentApplication.getDeveloperRole(project);


src/main/java/org/xoocode/xoosent/web/issues/list/ListIssues.java

@@ -1,7 +1,6 @@
package org.xoocode.xoosent.web.issues.list;
 
import net.databinder.auth.AuthDataSession;
import net.databinder.auth.components.DataUserStatusPanel;
import net.databinder.auth.data.DataUser;
import net.databinder.components.SearchPanel;
import net.databinder.components.StyleLink;

@@ -80,7 +79,7 @@
}
 
/** Bookmarkable constructor, shows display panel. */
public ListIssues(PageParameters params) {
public ListIssues(final PageParameters params) {
super();
try {
// using indexed param url coding; key should be in the first parameter

@@ -91,8 +90,26 @@
}
add(content);
init();
if (params.getString("project") != null) {
try {
projectSelector.setSelectedProject((Project) new HibernateObjectModel(
"from Project p where p.sid = :sid",new IQueryBinder() {
public void bind(Query query) {
query.setString("sid", params.getString("project"));
}
}).getObject(this));
} catch (Exception e) {
// if project parameter is not valid, ignore
}
}
}
 
public ListIssues(Project project) {
content = new WelcomePanel("content");
init();
projectSelector.setSelectedProject(project);
}
 
/** Model contructor, shows edit panel. */
public ListIssues(HibernateObjectModel issue) {
this(issue, true);

@@ -125,8 +142,8 @@
@Override
protected void onUpdate(AjaxRequestTarget target) {
super.onUpdate(target);
target.addComponent(issuesWrap);
target.addComponent(projectSelector);
target.appendJavascript(
"window.location = '/app/show/project/"+getSelectedProject().getSid()+"'");
}
};
projectSelector.setOutputMarkupId(true);


src/main/java/org/xoocode/xoosent/web/template/HomeLink.java

@@ -1,6 +1,6 @@
package org.xoocode.xoosent.web.template;
 
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.list.ListProjects;
 
import wicket.AttributeModifier;
import wicket.markup.html.link.BookmarkablePageLink;

@@ -12,7 +12,7 @@
public HomeLink(String id) {
super(id);
add(new AttributeModifier("id", true, new Model("homeLink")));
add(new BookmarkablePageLink("homeLink", ListIssues.class));
add(new BookmarkablePageLink("homeLink", ListProjects.class));
}
 
}


src/main/java/org/xoocode/xoosent/web/XooSentApplication.java

@@ -22,6 +22,7 @@
import org.xoocode.xoosent.service.DataMigrationService;
import org.xoocode.xoosent.service.notification.NotificationService;
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.list.ListProjects;
 
import wicket.Application;
import wicket.Component;

@@ -62,7 +63,7 @@
}
@Override
public Class getHomePage() {
return ListIssues.class;
return ListProjects.class;
}
 
@Override

@@ -93,7 +94,8 @@
if (user == null) {
return false;
} else {
return user.hasAnyRole(new Roles(getDeveloperRole(project)));
return user.hasAnyRole(new Roles(
new String[] {getDeveloperRole(project), "ADMIN"}));
}
}
 


src/main/java/org/xoocode/xoosent/web/Main.java

@@ -10,7 +10,7 @@
public class Main {
final static Logger logger = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) throws Exception {
int port = 8080;
int port = 8083;
String webappRoot = "src/main/webapp";
String contextPath = "/";
if (args.length > 0) {


src/main/java/org/xoocode/xoosent/web/project/edit/EditProject.html

@@ -12,7 +12,7 @@
<table>
<tr>
<td><label for="sid">SID</label></td>
<td><span wicket:id="sid" id="sid">DEMO</span></td>
<td><input wicket:id="sid" id="sid" type="text" value="DEMO" /></td>
</tr>
<tr>
<td><label for="name">Name</label></td>


src/main/java/org/xoocode/xoosent/web/project/edit/EditProject.java

@@ -9,11 +9,11 @@
import org.xoocode.xoosent.model.Project;
import org.xoocode.xoosent.web.XooSentApplication;
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.list.ListProjects;
 
import wicket.PageParameters;
import wicket.authorization.strategies.role.Roles;
import wicket.authorization.strategies.role.annotations.AuthorizeInstantiation;
import wicket.markup.html.basic.Label;
import wicket.markup.html.form.Button;
import wicket.markup.html.form.TextField;
import wicket.model.BoundCompoundPropertyModel;

@@ -49,10 +49,16 @@
super(id, project);
add (new Button("return") {
protected void onSubmit() {
setResponsePage(new ListIssues(new PageParameters()));
PageParameters params = new PageParameters();
params.put("project", ((Project)EditForm.this.getModelObject()).getSid());
setResponsePage(ListIssues.class, params);
}
});
add(new Label("sid"));
TextField sidField = new TextField("sid");
add(sidField);
if (((Project)project.getObject(this)).getSid() != null) {
sidField.setEnabled(false);
}
add(new TextField("name"));
add(new TextField("symbolicName"));
add(new TextField("eMail"));

@@ -61,6 +67,7 @@
deletePersistentObject();
DataRequestCycle.getHibernateSession().getTransaction().commit();
clearPersistentObject();
setResponsePage(ListProjects.class);
}
}.setDefaultFormProcessing(false));
}


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.properties
New file

@@ -0,0 +1,6 @@
#this query would get slow with very many issues; lucene would be better
 
# the ':*IsNull = 1' are a workaround for a derby embedded issue
# that could be rewritten as ':* is null'
query=select distinct p from Project p \
order by p.sid

\ No newline at end of file


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.java
New file

@@ -0,0 +1,87 @@
package org.xoocode.xoosent.web.project.list;
 
import net.databinder.components.StyleLink;
import net.databinder.models.HibernateListModel;
import net.databinder.models.HibernateObjectModel;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xoocode.xoosent.model.Issue;
import org.xoocode.xoosent.model.Project;
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.edit.EditProjectPage;
import org.xoocode.xoosent.web.template.TemplateDataPage;
 
import wicket.Component;
import wicket.Page;
import wicket.PageParameters;
import wicket.markup.ComponentTag;
import wicket.markup.html.WebMarkupContainer;
import wicket.markup.html.basic.Label;
import wicket.markup.html.link.BookmarkablePageLink;
import wicket.markup.html.link.IPageLink;
import wicket.markup.html.link.Link;
import wicket.markup.html.link.PageLink;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.PropertyListView;
 
public class ListProjects extends TemplateDataPage {
final Logger logger = LoggerFactory.getLogger(ListProjects.class);
 
/** The dispay or edit panel. */
private Component content;
 
public ListProjects() {
init();
}
 
/** Add page components. */
protected void init() {
// custom styles for this page
add(new StyleLink("stylesheet", ListProjects.class));
 
 
add(new PropertyListView("projects",
new HibernateListModel(getString("query"))) {
protected void populateItem(final ListItem item) {
WebMarkupContainer tr = new WebMarkupContainer("projectBanner") {
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
Project project = (Project) item.getModelObject();
// if (issue.getStatus() != null) {
// tag.put("style", "background-color: "+issue.getStatus().getColor()+";");
// }
}
};
item.add(tr);
// use bookmarkable links so search engines can peruse
PageParameters params = new PageParameters();
params.put("project", ((Project) item.getModelObject()).getSid());
Link link = new BookmarkablePageLink("sidLink", ListIssues.class, params);
tr.add(link);
link.add(new Label("sid"));
tr.add(new Label("symbolicName"));
tr.add(new Label("name"));
}
});
 
// link to
add(new PageLink("newProject", new IPageLink() {
/** Link to a new, blank issue. */
public Page getPage() {
HibernateObjectModel projectModel = new HibernateObjectModel(Project.class);
return new EditProjectPage(projectModel);
}
/** @return null since the self-referential identity would disable the link */
public Class getPageIdentity() {
return null;
}
}));
}
 
@Override
protected String getName() {
return "XooSent :: Projects";
}
}


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.html
New file

@@ -0,0 +1,32 @@
<html>
<head>
<wicket:head>
<link wicket:id="stylesheet" href="ListProjects.css" type="text/css" rel="stylesheet" />
</wicket:head>
<title>XooSent :: Projects</title>
</head>
<body>
<!-- nothing outside of this extend renders in Wicket -->
<wicket:extend>
 
<table cellspacing="0" width="100%">
<div wicket:id="projects">
<tr wicket:id="projectBanner">
<td>
<a wicket:id="sidLink" href="#"><span wicket:id="sid">XSENT</span></a>
</td>
<td>
<span wicket:id="symbolicName">org.xoocode.xoosent</span>
</td>
<td>
<span wicket:id="name">XooSent</span>
</td>
</tr>
</div>
</table>
<p><a wicket:id="newProject" href="#">Enter new project</a></p>
 
</wicket:extend>
 
</body>
</html>

\ No newline at end of file


src/main/java/org/xoocode/xoosent/web/project/list/ListProjects.css
New file

@@ -0,0 +1,81 @@
img {
border: none;
}
 
div.issuesColumn {
float: left;
width: 50em;
}
 
.filters {
float: right;
margin-top: 1px;
}
 
.filters option {
padding:0px 0pt 0px 20px;
background-repeat: no-repeat;
background-position:1px 2px;
vertical-align:middle;
}
div.issuesColumn div#search {
margin-bottom: 1em;
}
 
input.searchField {
width: 20em;
}
 
div.contentBlock {
margin-left: 1em;
float: left;
width: 50em;
}
 
p.moreInfo {
clear: both;
text-align: right;
}
 
h1.issueTitle {
margin-bottom: 0;
}
 
table {
border-collapse: collapse;
}
 
td {
text-align: left;
}
 
.issueDetail td {
border: 1px dotted #bbbbbb;
}
 
div.details {
float: right;
background-color: #ddddff;
border: 1px dotted #4444ff;
padding: 4px;
margin: 4px;
}
 
.details td {
border: 0px;
padding: 0 2px 0 2px;
}
 
.label {
font-weight: 700;
color: #4444ff;
text-align: right;
}
 
div.footer {
clear: both;
text-align: center;
padding: 0px 3px 0px 3px;
margin-left: 15%;
margin-right: 15%;
}

\ No newline at end of file


src/main/java/org/xoocode/xoosent/web/issues/edit/EditIssue.java

@@ -118,7 +118,7 @@
add(status);
HibernateListModel usersListModel =
// select only users who are developers of the current project
new HibernateListModel("select u.username from DataUser u where :role = some elements(u.roles) order by u.username",
new HibernateListModel("select u.username from DataUser u where :role = some elements(u.roles) or 'ADMIN' = some elements(u.roles) order by u.username",
new IQueryBinder() {
public void bind(Query query) {
String developerRole = XooSentApplication.getDeveloperRole(project);


src/main/java/org/xoocode/xoosent/web/issues/list/ListIssues.java

@@ -1,7 +1,6 @@
package org.xoocode.xoosent.web.issues.list;
 
import net.databinder.auth.AuthDataSession;
import net.databinder.auth.components.DataUserStatusPanel;
import net.databinder.auth.data.DataUser;
import net.databinder.components.SearchPanel;
import net.databinder.components.StyleLink;

@@ -80,7 +79,7 @@
}
 
/** Bookmarkable constructor, shows display panel. */
public ListIssues(PageParameters params) {
public ListIssues(final PageParameters params) {
super();
try {
// using indexed param url coding; key should be in the first parameter

@@ -91,8 +90,26 @@
}
add(content);
init();
if (params.getString("project") != null) {
try {
projectSelector.setSelectedProject((Project) new HibernateObjectModel(
"from Project p where p.sid = :sid",new IQueryBinder() {
public void bind(Query query) {
query.setString("sid", params.getString("project"));
}
}).getObject(this));
} catch (Exception e) {
// if project parameter is not valid, ignore
}
}
}
 
public ListIssues(Project project) {
content = new WelcomePanel("content");
init();
projectSelector.setSelectedProject(project);
}
 
/** Model contructor, shows edit panel. */
public ListIssues(HibernateObjectModel issue) {
this(issue, true);

@@ -125,8 +142,8 @@
@Override
protected void onUpdate(AjaxRequestTarget target) {
super.onUpdate(target);
target.addComponent(issuesWrap);
target.addComponent(projectSelector);
target.appendJavascript(
"window.location = '/app/show/project/"+getSelectedProject().getSid()+"'");
}
};
projectSelector.setOutputMarkupId(true);


src/main/java/org/xoocode/xoosent/web/template/HomeLink.java

@@ -1,6 +1,6 @@
package org.xoocode.xoosent.web.template;
 
import org.xoocode.xoosent.web.issues.list.ListIssues;
import org.xoocode.xoosent.web.project.list.ListProjects;
 
import wicket.AttributeModifier;
import wicket.markup.html.link.BookmarkablePageLink;

@@ -12,7 +12,7 @@
public HomeLink(String id) {
super(id);
add(new AttributeModifier("id", true, new Model("homeLink")));
add(new BookmarkablePageLink("homeLink", ListIssues.class));
add(new BookmarkablePageLink("homeLink", ListProjects.class));
}
 
}


Powered by WebSVN v1.61