Skip to content

Commit 55726fd

Browse files
authored
Display the folder tree rooted at "Panorama Public" (the target journal project) in the copy experiment form. (#582)
- Set the root of the tree store to the journal (Panorama Public) project. - Panorama Public datasets are organized into yearly subfolders. Pre-select the current year's subfolder, if it exists
1 parent 527afb8 commit 55726fd

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

panoramapublic/src/org/labkey/panoramapublic/view/publish/copyExperimentForm.jsp

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
CopyExperimentForm form = bean.getForm();
5353
ExperimentAnnotations expAnnot = form.lookupExperiment();
5454
Journal journal = form.lookupJournal();
55+
Container folderTreeRoot = journal.getProject();
5556
JournalSubmission js = bean.getJournalSubmission();
5657
Submission currentSubmission = js.getLatestSubmission();
5758
ExperimentAnnotations previousCopy = ExperimentAnnotationsManager.getLatestCopyForSubmission(js);
@@ -93,15 +94,20 @@
9394
var folderTreeStore = Ext4.create('Ext.data.TreeStore', {
9495
proxy: {
9596
type: 'ajax',
96-
url: LABKEY.ActionURL.buildURL('core', 'getExtContainerAdminTree.api'),
97-
extraParams: {move: false, requiredPermission: <%=q(RoleManager.getPermission(AdminPermission.class).getUniqueName())%>, showContainerTabs: false}
97+
url: LABKEY.ActionURL.buildURL('core', 'getExtContainerTree.api'),
98+
extraParams: {
99+
annotateLeaf: true,
100+
requiredPermission: <%=q(RoleManager.getPermission(AdminPermission.class).getUniqueName())%>,
101+
}
98102
},
99103
root: {
100-
expanded: false
104+
id : <%=folderTreeRoot.getRowId()%>,
105+
expanded : true,
106+
expandable : false,
107+
text : <%=q(folderTreeRoot.getName())%>
101108
},
102109
folderSort: false,
103-
autoLoad: true,
104-
defaultRootId: <%=ContainerManager.getRoot().getRowId()%>
110+
autoLoad: true
105111
});
106112
107113
var form = Ext4.create('Ext.form.Panel', {
@@ -158,25 +164,33 @@
158164
xtype: 'treepanel',
159165
fieldLabel: 'Destination',
160166
store: folderTreeStore,
161-
rootVisible: false,
167+
rootVisible: true,
162168
enableDrag: false,
163-
useArrows : false,
169+
useArrows : true,
164170
autoScroll: true,
165171
title : '',
166172
border: true,
167173
width: 650,
168174
height:150,
169175
listeners: {
170176
select: function(node, record, index, eOpts){
171-
//console.log("the record is...");
172-
//console.log(record.get('id'));
173-
//console.log(record.get('text'));
174-
175-
var displayField = Ext4.ComponentQuery.query('#destParentContainer_DisplayField')[0];
176-
displayField.setValue(record.get('text'));
177+
const displayField = Ext4.ComponentQuery.query('#destParentContainer_DisplayField')[0];
178+
if (displayField) {
179+
displayField.setValue(record.getPath('text', '/'));
180+
}
177181
178-
var hiddenField = Ext4.ComponentQuery.query('#destParentContainer_Input')[0];
179-
hiddenField.setValue(record.get('id'));
182+
const hiddenField = Ext4.ComponentQuery.query('#destParentContainer_Input')[0];
183+
if (hiddenField) {
184+
hiddenField.setValue(record.get('id'));
185+
}
186+
},
187+
load : function(store, node) {
188+
// Data on Panorama Public is organized by year. Select the subfolder for the current year.
189+
const currentYear = new Date().getFullYear().toString();
190+
const target = store.getRootNode().findChild('text', currentYear, true);
191+
if (target) {
192+
this.getSelectionModel().select(target);
193+
}
180194
}
181195
}
182196
},

0 commit comments

Comments
 (0)