Skip to content

Commit

Permalink
Moved dataset version message text to bundle. [ref #1953]
Browse files Browse the repository at this point in the history
  • Loading branch information
mheppler committed Jun 14, 2017
1 parent e903302 commit 89bf11b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,10 @@ file.viewDiffDialog.description=Description
file.viewDiffDialog.fileReplaced=File Replaced
file.viewDiffDialog.filesReplaced=File(s) Replaced
file.viewDiffDialog.files.header=Files
file.viewDiffDialog.msg.draftFound= This is the "DRAFT" version.
file.viewDiffDialog.msg.draftNotFound=The "DRAFT" version was not found.
file.viewDiffDialog.msg.versionFound= This is version "{0}".
file.viewDiffDialog.msg.versionNotFound=Version "{0}" was not found.
file.metadataTip=Metadata Tip: After adding the dataset, click the Edit Dataset button to add more metadata.
file.addBtn=Save Dataset
file.dataset.allFiles=All Files from this Dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
import edu.harvard.iq.dataverse.search.SolrSearchResult;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import edu.harvard.iq.dataverse.util.BundleUtil;
import edu.harvard.iq.dataverse.util.SystemConfig;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -91,27 +92,26 @@ public RetrieveDatasetVersionResponse(DatasetVersion datasetVersion, String requ
this.checkVersion();
}


public String getDifferentVersionMessage(){

if (this.wasSpecificVersionRequested && !this.didSpecificVersionMatch){
String userMsg;
if (DatasetVersionServiceBean.this.isVersionAskingForDraft(this.requestedVersion)){
userMsg = "The \"DRAFT\" version was not found.";
userMsg = BundleUtil.getStringFromBundle("file.viewDiffDialog.msg.draftNotFound");
}else{
userMsg = "Version \"" + this.requestedVersion + "\" was not found.";
userMsg = BundleUtil.getStringFromBundle("file.viewDiffDialog.msg.versionNotFound", Arrays.asList(this.requestedVersion));
}

if (DatasetVersionServiceBean.this.isVersionAskingForDraft(this.actualVersion)){
userMsg += " This is the \"DRAFT\" version.";
userMsg += BundleUtil.getStringFromBundle("file.viewDiffDialog.msg.draftFound");
}else{
userMsg += " This is version \"" + this.actualVersion + "\".";
userMsg += BundleUtil.getStringFromBundle("file.viewDiffDialog.msg.versionFound", Arrays.asList(this.actualVersion));
}

return userMsg;
}
return null;
}
}

private void checkVersion(){
if (actualVersion==null){ // this shouldn't happen
Expand Down

0 comments on commit 89bf11b

Please sign in to comment.