Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ehr/api-src/org/labkey/api/ehr/EHRService.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,7 @@ public EHRQCState getQCState(@NotNull Container c)

/** Extracts the study definition from a module resource to the pipeline root and queues a study import job */
abstract public void importStudyDefinition(Container container, User user, Module m, Path studyFolderPath) throws IOException;

/** Used to register EHR modules that require the edit url on the grid (with rows having task id values) to navigate to the data entry form **/
abstract public void addModulePreferringTaskFormEditUI(Module m);
}
15 changes: 12 additions & 3 deletions ehr/src/org/labkey/ehr/EHRController.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public ModelAndView getView(EHRQueryForm form, BindException errors)
{
String detailsStr;
String importStr;
if (EHRServiceImpl.get().isUseLegagyExt3EditUI(getContainer()) && !isExt4Form(form.getSchemaName(), form.getQueryName()) && !isReactForm(form.getSchemaName(), form.getQueryName()))
if (EHRServiceImpl.get().isUseLegacyExt3EditUI(getContainer()) && !isExt4Form(form.getSchemaName(), form.getQueryName()) && !isReactForm(form.getSchemaName(), form.getQueryName()))
{
// Because the Ext3-based UI can rely on loading JS-based metadata that is keyed
// off table name, and because when this was originally written LK preferentially used label over title for
Expand Down Expand Up @@ -397,7 +397,8 @@ else if (isReactForm(form.getSchemaName(), form.getQueryName()))
url.addParameter("importURL", importUrl.toString());
}
}
else {
else
{
detailsStr = "/ehr/dataEntryFormForQuery.view?schemaName=" + schemaName + "&queryName=" + queryName;
importStr = "";
for (String pkCol : ti.getPkColumnNames())
Expand All @@ -415,7 +416,15 @@ else if (isReactForm(form.getSchemaName(), form.getQueryName()))
}
}

DetailsURL updateUrl = DetailsURL.fromString(detailsStr);
DetailsURL updateUrl;
if (EHRServiceImpl.get().isUseFormEditUI(getContainer()) && null != ti.getColumn("taskid"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@labkey-jeckels I think this will be useless when there is no value for task ids.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed. Checking for the presence of that column is a good idea.

{
updateUrl = DetailsURL.fromString("/ehr/dataEntryForm.view?taskid=${taskid}&formType=${taskid/formType}");
}
else
{
updateUrl = DetailsURL.fromString(detailsStr);
}
updateUrl.setContainerContext(getContainer());

String deleteQueryName = ti.getName();
Expand Down
21 changes: 19 additions & 2 deletions ehr/src/org/labkey/ehr/EHRServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public class EHRServiceImpl extends EHRService
private Map<String, Map<String, List<ButtonConfigFactory>>> _moreActionsButtons = new CaseInsensitiveHashMap<>();
private Map<String, Map<String, List<ButtonConfigFactory>>> _tbarButtons = new CaseInsensitiveHashMap<>();
private Set<Module> _modulesRequiringLegacyExt3UI = new HashSet<>();
private Set<Module> _modulesRequiringFormEditUI = new HashSet<>();
private ProjectValidator _projectValidator = null;

private static final Logger _log = LogManager.getLogger(EHRServiceImpl.class);
Expand Down Expand Up @@ -853,6 +854,12 @@ public void addModuleRequiringLegacyExt3EditUI(Module m)
_modulesRequiringLegacyExt3UI.add(m);
}

@Override
public void addModulePreferringTaskFormEditUI(Module m)
{
_modulesRequiringFormEditUI.add(m);
}

@Override
public void importStudyDefinition(Container container, User user, Module m, Path sourceStudyDirPath) throws IOException
{
Expand Down Expand Up @@ -898,10 +905,20 @@ private void copyResourceToPath(Resource resource, java.nio.file.Path target) th
}
}

public boolean isUseLegagyExt3EditUI(Container c)
public boolean isUseLegacyExt3EditUI(Container c)
{
return isRegisteredUI(_modulesRequiringLegacyExt3UI, c);
}

public boolean isUseFormEditUI(Container c)
{
return isRegisteredUI(_modulesRequiringFormEditUI, c);
}

private boolean isRegisteredUI(Set<Module> modules, Container c)
{
Set<Module> am = c.getActiveModules();
for (Module m : _modulesRequiringLegacyExt3UI)
for (Module m : modules)
{
if (am.contains(m))
{
Expand Down