|
52 | 52 | CopyExperimentForm form = bean.getForm(); |
53 | 53 | ExperimentAnnotations expAnnot = form.lookupExperiment(); |
54 | 54 | Journal journal = form.lookupJournal(); |
| 55 | + Container folderTreeRoot = journal.getProject(); |
55 | 56 | JournalSubmission js = bean.getJournalSubmission(); |
56 | 57 | Submission currentSubmission = js.getLatestSubmission(); |
57 | 58 | ExperimentAnnotations previousCopy = ExperimentAnnotationsManager.getLatestCopyForSubmission(js); |
|
93 | 94 | var folderTreeStore = Ext4.create('Ext.data.TreeStore', { |
94 | 95 | proxy: { |
95 | 96 | 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 | + } |
98 | 102 | }, |
99 | 103 | root: { |
100 | | - expanded: false |
| 104 | + id : <%=folderTreeRoot.getRowId()%>, |
| 105 | + expanded : true, |
| 106 | + expandable : false, |
| 107 | + text : <%=q(folderTreeRoot.getName())%> |
101 | 108 | }, |
102 | 109 | folderSort: false, |
103 | | - autoLoad: true, |
104 | | - defaultRootId: <%=ContainerManager.getRoot().getRowId()%> |
| 110 | + autoLoad: true |
105 | 111 | }); |
106 | 112 |
|
107 | 113 | var form = Ext4.create('Ext.form.Panel', { |
|
158 | 164 | xtype: 'treepanel', |
159 | 165 | fieldLabel: 'Destination', |
160 | 166 | store: folderTreeStore, |
161 | | - rootVisible: false, |
| 167 | + rootVisible: true, |
162 | 168 | enableDrag: false, |
163 | | - useArrows : false, |
| 169 | + useArrows : true, |
164 | 170 | autoScroll: true, |
165 | 171 | title : '', |
166 | 172 | border: true, |
167 | 173 | width: 650, |
168 | 174 | height:150, |
169 | 175 | listeners: { |
170 | 176 | 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 | + } |
177 | 181 |
|
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 | + } |
180 | 194 | } |
181 | 195 | } |
182 | 196 | }, |
|
0 commit comments