Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rhbz870876 allow download of different config file for offline transl…

…ation for non-po projects
  • Loading branch information...
commit 7a3ff69e5df5262d5d5bcbc89c1a2b4670b06bff 1 parent b7cfba3
@davidmason davidmason authored
View
18 zanata-war/src/main/java/org/zanata/action/ConfigurationAction.java
@@ -33,6 +33,8 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
import org.jboss.seam.log.Log;
+import org.zanata.common.ProjectType;
+import org.zanata.dao.ProjectIterationDAO;
import org.zanata.service.ConfigurationService;
@Name("configurationAction")
@@ -45,6 +47,9 @@
@RequestParameter
private String projectSlug;
+ @In
+ private ProjectIterationDAO projectIterationDAO;
+
@Logger
private Log log;
@In
@@ -52,11 +57,13 @@
public void getData()
{
- boolean useOfflinePo = false;
- getData(useOfflinePo);
+ getData(false);
}
- // FIXME need another public method to get offlinepo config file
+ public void getOfflinePoConfigData()
+ {
+ getData(true);
+ }
private void getData(boolean useOfflinePo)
{
@@ -81,4 +88,9 @@ private void getData(boolean useOfflinePo)
}
}
+ public boolean isPoProject()
+ {
+ ProjectType type = projectIterationDAO.getBySlug(projectSlug, iterationSlug).getProjectType();
+ return type == ProjectType.Gettext || type == ProjectType.Podir;
+ }
}
View
3  zanata-war/src/main/resources/messages.properties
@@ -133,6 +133,8 @@ jsf.ChangeYourGravatar=Change your avatar at gravatar.com
jsf.Close=Close
jsf.CopyrightYearInfo=2008-12
jsf.ConfigFile=Config file
+jsf.ConfigFileDefault=Default Config File
+jsf.ConfigFileForOfflineTranslation=Offline Translation Config File
jsf.Configuration=Configuration
jsf.ConfigurationForZanataini=Configuration [zanata.ini]
jsf.config.AdminEmail=Contact Admin Address
@@ -271,6 +273,7 @@ jsf.FirstExternalLoginMessage=Please verify the email address below and click Sa
jsf.ForgotYourPassword=Forgot your password?
jsf.FoundResultsizeProjectsMatchingQuerySearchquery=Found #{projectSearch.resultSize} Projects matching query '#{projectSearch.searchQuery}'
jsf.GenerateProjectConfig=Generate project configuration file (zanata.xml)
+jsf.GenerateProjectConfigForOfflineTranslation=Generate project configuration file (zanata.xml), with special project type 'offlinepo' for use in offline translation of po files.
jsf.Glossary=Glossary
jsf.Glossary.SourceLocale.Title=Source locale (Only apply for PO file format)
jsf.Glossary.TargetLocale.Title=Target locale (Only apply for PO file format)
View
51 zanata-war/src/main/webapp/iteration/view.xhtml
@@ -21,6 +21,18 @@
return false;
}
}
+
+ function openConfigDownloadPanel()
+ {
+ #{rich:component('configDownloadPanel')}.show();
+ return false;
+ }
+
+ function hideConfigDownloadPanel()
+ {
+ #{rich:component('configDownloadPanel')}.hide();
+ return false;
+ }
</script>
</ui:define>
@@ -114,6 +126,43 @@
</rich:dataTable>
</a4j:region>
</a4j:form>
+
+ <rich:modalPanel id="configDownloadPanel"
+ moveable="#{false}"
+ resizeable="#{false}"
+ autosized="#{true}">
+ <f:facet name="header">
+ <h:outputText value="#{messages['jsf.ConfigFile']}"/>
+ </f:facet>
+ <h:panelGrid columns="2" border="0">
+ <s:link styleClass="config_link"
+ title="#{messages['jsf.GenerateProjectConfig']}"
+ action="#{configurationAction.getData()}"
+ onclick="hideConfigDownloadPanel(); return true;">
+ <f:param name="projectSlug" value="#{viewAllStatusAction.projectSlug}" />
+ <f:param name="iterationSlug" value="#{viewAllStatusAction.iterationSlug}" />
+ <div class="config_link_div">
+ #{messages['jsf.ConfigFileDefault']}
+ </div>
+ </s:link>
+ <s:link styleClass="config_link"
+ rendered="#{not configurationAction.poProject}"
+ title="#{messages['jsf.GenerateProjectConfigForOfflineTranslation']}"
+ action="#{configurationAction.getOfflinePoConfigData()}"
+ onclick="hideConfigDownloadPanel(); return true;">
+ <f:param name="projectSlug" value="#{viewAllStatusAction.projectSlug}" />
+ <f:param name="iterationSlug" value="#{viewAllStatusAction.iterationSlug}" />
+ <div class="config_link_div">
+ #{messages['jsf.ConfigFileForOfflineTranslation']}
+ </div>
+ </s:link>
+ </h:panelGrid>
+
+ <div align="right">
+ <h:commandButton value="#{messages['jsf.Close']}"
+ onclick="return hideConfigDownloadPanel();"/>
+ </div>
+ </rich:modalPanel>
</ui:define>
<ui:define name="right_content">
@@ -135,7 +184,7 @@
<s:link styleClass="action_link"
value="#{messages['jsf.ConfigFile']}"
title="#{messages['jsf.GenerateProjectConfig']}"
- action="#{configurationAction.getData()}">
+ onclick="return openConfigDownloadPanel()">
<f:param name="projectSlug" value="#{viewAllStatusAction.projectSlug}" />
<f:param name="iterationSlug" value="#{viewAllStatusAction.iterationSlug}" />
</s:link>
View
36 zanata-war/src/main/webapp/stylesheet/zanata.css
@@ -1141,6 +1141,42 @@ a.table_link span.nativeName, span.nativeName
}
/* ----------------------- End project iteration CSS -------------------------*/
+/* ------------------------ Project Iteration Config File CSS ------------------*/
+a.config_link {
+ display: block;
+ font-size: 1.5em;
+ font-weight: bold;
+ color: #7092C3;
+ text-decoration: none;
+ text-align: center;
+ outline:none;
+ margin: 8px;
+ width: 100px;
+ border:1px solid #7092C3;
+ border-radius: 5px;
+}
+
+.config_link_div {
+ padding:5px;
+ margin-bottom:3px;
+ margin-left:3px;
+ width: 100px;
+ height: 80px;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+a.config_link:hover {
+ color: #990000;
+ border:1px solid #990000;
+}
+
+.config_link_div:hover {
+ background-color: #F3F2F2;
+}
+
+/* ------------------------ End Project Iteration Config File CSS ------------------*/
+
/* ----------------------- Project Iteration Files CSS -----------------------------*/
.translate_restriction_title {
Please sign in to comment.
Something went wrong with that request. Please try again.