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

Commit

Permalink
Browse files Browse the repository at this point in the history
rhbz870876 use offlinepo when appropriate in gwt doclist download links
  • Loading branch information
davidmason committed Mar 25, 2013
1 parent 417e908 commit f20dc1f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Expand Up @@ -191,10 +191,10 @@ public String getValue(DocumentNode object)
downloadColumn = new StaticWidgetColumn<DocumentNode, HorizontalPanel>()
{
@Override
public HorizontalPanel getValue(DocumentNode object)
public HorizontalPanel getValue(DocumentNode node)
{
HorizontalPanel downloadPanel = new HorizontalPanel();
for (Map.Entry<String, String> entry : object.getDocInfo().getDownloadExtensions().entrySet())
for (Map.Entry<String, String> entry : node.getDocInfo().getDownloadExtensions().entrySet())
{
Anchor anchor = new Anchor(entry.getKey());
anchor.setStyleName("downloadFileLink");
Expand Down
Expand Up @@ -14,6 +14,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.zanata.common.LocaleId;
import org.zanata.common.ProjectType;
import org.zanata.common.TranslationStats;
import org.zanata.dao.DocumentDAO;
import org.zanata.model.HDocument;
Expand All @@ -39,7 +40,7 @@ public class GetDocumentListHandler extends AbstractActionHandler<GetDocumentLis

@In
private DocumentDAO documentDAO;

@In
private TranslationStateCache translationStateCacheImpl;

Expand All @@ -54,7 +55,7 @@ public GetDocumentListResult execute(GetDocumentList action, ExecutionContext co
LocaleId localeId = action.getWorkspaceId().getLocaleId();
ProjectIterationId iterationId = action.getWorkspaceId().getProjectIterationId();
ArrayList<DocumentInfo> docs = new ArrayList<DocumentInfo>();

Collection<HDocument> hDocs = documentDAO.getAllByProjectIteration(iterationId.getProjectSlug(), iterationId.getIterationSlug());
for (HDocument hDoc : hDocs)
{
Expand All @@ -63,7 +64,7 @@ public GetDocumentListResult execute(GetDocumentList action, ExecutionContext co
DocumentId docId = new DocumentId(hDoc.getId(), hDoc.getDocId());
TranslationStats stats = documentDAO.getStatistics(hDoc.getId(), localeId);
HTextFlowTarget result = translationStateCacheImpl.getDocLastModifiedTextFlowTarget(hDoc.getId(), localeId);

Date lastTranslatedDate = null;
String lastTranslatedBy = "";

Expand All @@ -84,7 +85,17 @@ public GetDocumentListResult execute(GetDocumentList action, ExecutionContext co
}

Map<String, String> downloadExtensions = new HashMap<String, String>();
downloadExtensions.put(".po", "po?docId=" + hDoc.getDocId());

ProjectType type = hDoc.getProjectIteration().getProjectType();
if (type == ProjectType.Gettext || type == ProjectType.Podir)
{
downloadExtensions.put(".po", "po?docId=" + hDoc.getDocId());
}
else
{
downloadExtensions.put("offline .po", "offlinepo?docId=" + hDoc.getDocId());
}

if (translationFileServiceImpl.hasPersistedDocument(iterationId.getProjectSlug(), iterationId.getIterationSlug(), hDoc.getPath(), hDoc.getName()))
{
String extension = "." + translationFileServiceImpl.getFileExtension(iterationId.getProjectSlug(), iterationId.getIterationSlug(), hDoc.getPath(), hDoc.getName());
Expand Down

0 comments on commit f20dc1f

Please sign in to comment.