Browse files

Disable create version for non-active project: https://bugzilla.redha…

  • Loading branch information...
1 parent 0cae6df commit 36d92f067db6c92f9bb815a5b94ed5cda453e279 @aeng aeng committed Jun 5, 2012
View
6 zanata-war/src/main/java/org/zanata/action/ProjectHome.java
@@ -26,7 +26,6 @@
import javax.faces.event.ValueChangeEvent;
import javax.persistence.EntityNotFoundException;
-import javax.persistence.NoResultException;
import org.hibernate.Session;
import org.hibernate.criterion.NaturalIdentifier;
@@ -216,6 +215,11 @@ else if (customizedItems != null)
}
}
+ public boolean isProjectActive()
+ {
+ return getInstance().getStatus() == EntityStatus.ACTIVE;
+ }
+
public boolean isReadOnly(HProjectIteration iteration)
{
if (getInstance().getStatus() == EntityStatus.READONLY || (iteration != null && iteration.getStatus() == EntityStatus.READONLY))
View
5 zanata-war/src/main/java/org/zanata/action/ProjectIterationHome.java
@@ -34,6 +34,7 @@
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
+import org.zanata.common.EntityStatus;
import org.zanata.dao.ProjectDAO;
import org.zanata.model.HIterationProject;
import org.zanata.model.HLocale;
@@ -176,6 +177,10 @@ public String update()
return state;
}
+ public boolean isProjectActive()
+ {
+ return getInstance().getProject().getStatus() == EntityStatus.ACTIVE;
+ }
private void updateOverrideLocales()
{
View
10 zanata-war/src/main/webapp/project/add_iteration.xhtml
@@ -19,8 +19,14 @@
</h1>
- <ui:include src="../WEB-INF/layout/iteration_edit_form.xhtml" />
-
+ <s:fragment rendered="#{projectIterationHome.isProjectActive()}">
+ <ui:include src="../WEB-INF/layout/iteration_edit_form.xhtml"/>
+ </s:fragment>
+
+ <s:fragment rendered="#{!projectIterationHome.isProjectActive()}">
+ <rich:spacer height="20px"/>
+ <span class="errors">#{projectIterationHome.instance.project.name} is not active.</span>
+ </s:fragment>
</ui:define>
</ui:composition>
View
2 zanata-war/src/main/webapp/project/project.xhtml
@@ -128,7 +128,7 @@
<s:link styleClass="action_link" rendered="#{s:hasRole('admin')}" value="#{messages['jsf.project.EditHomePage.label']}" view="/project/homepage_edit.xhtml" title="#{messages['jsf.project.EditHomePage.tooltip']}" propagation="none">
<f:param name="slug" value="#{projectHome.instance.slug}"/>
</s:link>
- <s:link styleClass="action_link" rendered="#{s:hasPermission(projectHome.instance, 'add-iteration')}" view="/project/add_iteration.xhtml" value="#{messages['jsf.CreateVersion']}" propagation="none">
+ <s:link styleClass="action_link" rendered="#{s:hasPermission(projectHome.instance, 'add-iteration') and projectHome.isProjectActive()}" 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="#{s:hasPermission(projectHome.instance, 'update')}" view="/project/assign_maintainer.xhtml" value="#{messages['jsf.ManageMaintainers']}" propagation="none">

0 comments on commit 36d92f0

Please sign in to comment.