Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Iteration group: work in progress: implementing maintainers
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sl-eng committed Apr 13, 2012
1 parent 64a0297 commit 68fba86
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 14 deletions.
Expand Up @@ -31,8 +31,11 @@
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.security.management.JpaIdentityStore;
import org.zanata.common.EntityStatus;
import org.zanata.model.HAccount;
import org.zanata.model.HIterationGroup;
import org.zanata.service.VersionGroupService;

Expand All @@ -53,6 +56,9 @@ public class VersionGroupHome extends SlugHome<HIterationGroup>
@DataModel
List<HIterationGroup> allVersionGroups;

@In(required = false, value = JpaIdentityStore.AUTHENTICATED_USER)
HAccount authenticatedAccount;

@Override
protected HIterationGroup loadInstance()
{
Expand Down Expand Up @@ -137,6 +143,11 @@ public String persist()
return null;
getInstance().setStatus(status);

if (authenticatedAccount != null)
{
getInstance().addMaintainer(authenticatedAccount.getPerson());
}

return super.persist();
}

Expand Down
1 change: 1 addition & 0 deletions server/zanata-war/src/main/resources/messages.properties
Expand Up @@ -153,6 +153,7 @@ jsf.EditHelpPageContent= Edit Help Page Content
jsf.EditProfile=Edit Profile
jsf.EditProject=Edit Project
jsf.EditVersion=Edit Version
jsf.EditVersionGroup=Edit Version Group
jsf.email.admin.Administrator=Administrator
jsf.email.admin.DearAdmin=Dear #{messages['jsf.email.admin.Administrator']},
jsf.email.admin.SentNotification=Your message has been sent to the administrator
Expand Down
Expand Up @@ -42,11 +42,15 @@

</rich:panel>

<div class="actionButtons"><h:commandButton
value="#{messages['jsf.Save']}"
action="#{versionGroupHome.persist}" /> <s:button
view="/version-group/home.xhtml"
value="#{messages['jsf.Cancel']}" propagation="end" />
<div class="actionButtons">
<h:commandButton value="#{messages['jsf.Save']}"
action="#{versionGroupHome.persist}"
rendered="#{!versionGroupHome.managed}"/>
<h:commandButton id="update"
value="#{messages['jsf.Update']}"
action="#{versionGroupHome.update}"
rendered="#{versionGroupHome.managed}"/>
<s:button view="/version-group/home.xhtml" value="#{messages['jsf.Cancel']}" propagation="end" />
</div>

</a4j:form>
15 changes: 15 additions & 0 deletions server/zanata-war/src/main/webapp/WEB-INF/pages.xml
Expand Up @@ -199,6 +199,21 @@
<param name="slug" value="#{versionGroupHome.slug}" />
<action execute="#{versionGroupHome.validateSuppliedId}" />
</page>

<page view-id="/version-group/edit.xhtml" login-required="true">
<param name="slug" value="#{versionGroupHome.slug}" />
<action execute="#{identity.checkPermission(versionGroupHome.instance, 'update')}" />
<navigation from-action="#{versionGroupHome.update}">
<redirect view-id="/version-group/version_group.xhtml">
<param name="slug" value="#{versionGroupHome.slug}" />
</redirect>
</navigation>
<navigation from-action="#{versionGroupHome.cancel}">
<redirect view-id="/version-group/version_group.xhtml">
<param name="slug" value="#{versionGroupHome.slug}" />
</redirect>
</navigation>
</page>


<!-- Profile -->
Expand Down
19 changes: 18 additions & 1 deletion server/zanata-war/src/main/webapp/WEB-INF/urlrewrite.xml
Expand Up @@ -218,6 +218,16 @@
<from casesensitive="true">^/version-group/view/(.+)$</from>
<to last="true">/version-group/version_group.seam\?slug=$1</to>
</rule>

<rule>
<from casesensitive="true">^/version-group/edit(.+)$</from>
<to last="true">/version-group/edit.seam?$1</to>
</rule>

<rule>
<from casesensitive="true">^/version-group/maintainer/(.+)?$</from>
<to last="true">/version-group/assign_maintainer.seam$1</to>
</rule>

<outbound-rule>
<from>^(/.+)?/admin/(.+).seam$</from>
Expand Down Expand Up @@ -321,11 +331,18 @@
<from>^(/.+)?/version-group/home.seam(.+)?$</from>
<to>$1/version-group/list$2</to>
</outbound-rule>

<outbound-rule>
<from>^(/.+)?/version-group/version_group.seam\?slug=(.+)$</from>
<to>$1/version-group/view/$2</to>
</outbound-rule>
<outbound-rule>
<from>^(/.+)?/version-group/edit.seam(.+)$</from>
<to>$1/version-group/edit/$2</to>
</outbound-rule>
<outbound-rule>
<from>^(/.+)?/version-group/assign_maintainer.seam(.+)?$</from>
<to>$1/version-group/maintainer/$2</to>
</outbound-rule>

<outbound-rule>
<from>^(/.+)?/profile/edit.seam(.+)?$</from>
Expand Down
@@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
template="../WEB-INF/layout/template.xhtml">

<ui:define name="page_title">#{versionGroupHome.instance.name} - Add Maintainer</ui:define>
<ui:define name="left_content">
<rich:panel>
<f:facet name="header">#{messages['jsf.Actions']}</f:facet>
<s:link styleClass="action_link" view="/project/maintainerdetail.xhtml"
value="#{messages['jsf.AddMaintainer']}"
/>
</rich:panel>
</ui:define>

<ui:define name="center_content">

<script type="text/javascript">
function confirmDelete()
{
return confirm("#{messages['jsf.AreYouSureYouWishToDeleteThisPersonThisActionCannotBeUndone']}");
}
</script>
<rich:panel rendered="#{projectMaintainerManageAction.checkPermission('update')}">
<f:facet name="header">#{messages['jsf.ProjectMaintainerManager']}</f:facet>
<h:messages />

<h:form>
<s:token allowMultiplePosts="true" />
<rich:dataTable
id="threads"
value="#{allList}"
var="maintainer">

<rich:column width="auto">
<f:facet name="header">#{messages['jsf.Username']}</f:facet>
#{maintainer.account.username}
</rich:column>
<rich:column width="auto">
<f:facet name="header">#{messages['jsf.Name']}</f:facet>
#{maintainer.name}
</rich:column>
<rich:column width="auto">
<f:facet name="header">#{messages['jsf.Email']}</f:facet>
#{maintainer.email}
</rich:column>
<rich:column width="auto">
<f:facet name="header">#{messages['jsf.Actions']}</f:facet>
<h:commandLink value="#{messages['jsf.Remove']}" action="#{projectMaintainerManageAction.deleteMaintainer(projectMaintainerManageAction.selectedPerson)}"
onclick="return confirmDelete()"/>
</rich:column>
</rich:dataTable>
</h:form>
</rich:panel>
</ui:define>

</ui:composition>
20 changes: 20 additions & 0 deletions server/zanata-war/src/main/webapp/version-group/edit.xhtml
@@ -0,0 +1,20 @@
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
template="../WEB-INF/layout/template.xhtml">

<ui:define name="page_title">#{versionGroupHome.instance.name} - Edit</ui:define>
<ui:define name="center_content">
<rich:jQuery selector="#tab_version_groups" query="addClass('ui-tabs-selected')" />
<h1>#{versionGroupHome.instance.name}</h1>

<ui:include src="../WEB-INF/layout/version_group_edit_form.xhtml" />

</ui:define>

</ui:composition>
Expand Up @@ -14,7 +14,7 @@
<s:decorate id="main_content">
<rich:jQuery selector="#tab_version_groups" query="addClass('ui-tabs-selected')" />

<h1>#{messages['jsf.VersionGroupd']}: #{versionGroupHome.instance.slug}</h1>
<h1>#{messages['jsf.VersionGroupId']}: #{versionGroupHome.instance.slug}</h1>

<h:outputText value="#{versionGroupHome.instance.description}" rendered="#{!empty versionGroupHome.instance.description}"/>

Expand All @@ -27,14 +27,12 @@

<rich:panel id="loggedIn" rendered="#{identity.loggedIn}">
<f:facet name="header">#{messages['jsf.Actions']}</f:facet>
<s:link styleClass="action_link" rendered="#{projectHome.checkPermission('update')}" value="#{messages['jsf.EditProject']}" view="/project/edit.xhtml" propagation="none">
<f:param name="slug" value="#{projectHome.instance.slug}"/>
<s:link styleClass="action_link" rendered="#{versionGroupHome.checkPermission('update')}" value="#{messages['jsf.EditVersionGroup']}" view="/version-group/edit.xhtml" propagation="none">
<f:param name="slug" value="#{versionGroupHome.instance.slug}"/>
</s:link>
<s:link styleClass="action_link" rendered="#{projectHome.checkPermission('add-iteration')}" view="/project/add_iteration.xhtml" value="#{messages['jsf.CreateVersion']}" propagation="none">
<f:param name="projectSlug" value="#{projectHome.instance.slug}"/>
</s:link>
<s:link styleClass="action_link" rendered="#{projectHome.checkPermission('update')}" view="/project/assign_maintainer.xhtml" value="#{messages['jsf.ManageMaintainers']}" propagation="none">
<f:param name="projectSlug" value="#{projectHome.instance.slug}"/>

<s:link styleClass="action_link" rendered="#{versionGroupHome.checkPermission('update')}" view="/version-group/assign_maintainer.xhtml" value="#{messages['jsf.ManageMaintainers']}" propagation="none">
<f:param name="slug" value="#{versionGroupHome.instance.slug}"/>
</s:link>

</rich:panel>
Expand Down

0 comments on commit 68fba86

Please sign in to comment.