@@ -106,135 +106,138 @@ Ext.override(MODx.tree.Resource, {
106106 e . stopEvent ( ) ;
107107 } ,
108108
109- _getMSMenu : function ( n ) {
109+ _getMSMenu : function ( n ) {
110110 let a = n . attributes ;
111111 let ui = n . getUI ( ) ;
112- console . log ( ui )
113112 let m = [ ] ;
114113 m . push ( {
115- text : '<b>' + a . text + '</b>'
116- , handler : function ( ) { return false ; }
117- , header : true
114+ text : '<b>' + a . text + '</b>' ,
115+ handler : function ( ) { return false ; } ,
116+ header : true
118117 } ) ;
119118 m . push ( '-' ) ;
120119 if ( ui . hasClass ( 'pview' ) ) {
121120 m . push ( {
122- text : _ ( 'resource_overview' )
123- , handler : this . overviewResource
121+ text : _ ( 'resource_overview' ) ,
122+ handler : this . overviewResource
124123 } ) ;
125124 }
126125 if ( ui . hasClass ( 'pedit' ) ) {
127126 m . push ( {
128- text : _ ( 'resource_edit' )
129- , handler : this . editResource
127+ text : _ ( 'resource_edit' ) ,
128+ handler : this . editResource
130129 } ) ;
131130 }
132131 if ( ui . hasClass ( 'pqupdate' ) ) {
133132 m . push ( {
134- text : _ ( 'quick_update_resource' )
135- , classKey : a . classKey
136- , handler : this . quickUpdateResource
133+ text : _ ( 'quick_update_resource' ) ,
134+ classKey : a . classKey ,
135+ handler : this . quickUpdateResource
137136 } ) ;
138137 }
139138 if ( ui . hasClass ( 'pduplicate' ) ) {
140139 m . push ( {
141- text : _ ( 'resource_duplicate' )
142- , handler : this . duplicateResource
140+ text : _ ( 'resource_duplicate' ) ,
141+ handler : this . duplicateResource
143142 } ) ;
144143 }
145144 m . push ( {
146- text : _ ( 'resource_refresh' )
147- , handler : this . refreshResource
148- , scope : this
145+ text : _ ( 'resource_refresh' ) ,
146+ handler : this . refreshResource ,
147+ scope : this
149148 } ) ;
150149
151150 if ( ui . hasClass ( 'pnew' ) ) {
152151 m . push ( '-' ) ;
153- this . _getCreateMenus ( m , null , ui ) ;
152+ this . _getCreateMenus ( m , null , ui ) ;
154153 }
155154
156155 if ( ui . hasClass ( 'psave' ) ) {
157156 m . push ( '-' ) ;
158157 if ( ui . hasClass ( 'ppublish' ) && ui . hasClass ( 'unpublished' ) ) {
159158 m . push ( {
160- text : _ ( 'resource_publish' )
161- , handler : this . publishDocument
159+ text : _ ( 'resource_publish' ) ,
160+ handler : this . publishDocument
162161 } ) ;
163162 } else if ( ui . hasClass ( 'punpublish' ) ) {
164163 m . push ( {
165- text : _ ( 'resource_unpublish' )
166- , handler : this . unpublishDocument
164+ text : _ ( 'resource_unpublish' ) ,
165+ handler : this . unpublishDocument
167166 } ) ;
168167 }
169168 if ( ui . hasClass ( 'pundelete' ) && ui . hasClass ( 'deleted' ) ) {
170169 m . push ( {
171- text : _ ( 'resource_undelete' )
172- , handler : this . undeleteDocument
170+ text : _ ( 'resource_undelete' ) ,
171+ handler : this . undeleteDocument
173172 } ) ;
174173 } else if ( ui . hasClass ( 'pdelete' ) && ! ui . hasClass ( 'deleted' ) ) {
175174 m . push ( {
176- text : _ ( 'resource_delete' )
177- , handler : this . deleteDocument
175+ text : _ ( 'resource_delete' ) ,
176+ handler : this . deleteDocument
178177 } ) ;
179178 }
180179 }
181180
182- if ( ! ui . hasClass ( 'x-tree-node-leaf' ) ) {
181+ if ( ! ui . hasClass ( 'x-tree-node-leaf' ) ) {
183182 m . push ( '-' ) ;
184183 m . push ( this . _getSortMenu ( ) ) ;
185184 }
186185
187186 if ( ui . hasClass ( 'pview' ) && a . preview_url != '' ) {
188187 m . push ( '-' ) ;
189188 m . push ( {
190- text : _ ( 'resource_view' )
191- , handler : this . preview
189+ text : _ ( 'resource_view' ) ,
190+ handler : this . preview
192191 } ) ;
193192 }
194193 return m ;
195- }
194+ } ,
196195
197- , _getCreateMenus : function ( m , pk , ui ) {
196+ _getCreateMenus : function ( m , pk , ui ) {
198197 var types = MODx . config . resource_classes ;
199- var o = this . fireEvent ( 'loadCreateMenus' , types ) ;
198+ var o = this . fireEvent ( 'loadCreateMenus' , types ) ;
200199 if ( Ext . isObject ( o ) ) {
201- Ext . apply ( types , o ) ;
200+ Ext . apply ( types , o ) ;
202201 }
203202 var coreTypes = [ 'MODX\\Revolution\\modDocument' ] ;
204203 var ct = [ ] ;
205204 var qct = [ ] ;
206205 for ( var k in types ) {
206+ var canCreate ;
207207 if ( coreTypes . indexOf ( k ) != - 1 ) {
208- if ( ! ui . hasClass ( 'pnew_' + k ) ) {
209- continue ;
210- }
208+ canCreate = ui . hasClass ( 'pnew_' + k ) || ui . hasClass ( 'pnew' ) ;
209+ } else {
210+ canCreate = true ;
211+ }
212+ if ( ! canCreate ) {
213+ continue ;
211214 }
212215 ct . push ( {
213- text : types [ k ] [ 'text_create_here' ]
214- , classKey : k
215- , usePk : pk ? pk : false
216- , handler : this . createResourceHere
217- , scope : this
216+ text : types [ k ] [ 'text_create_here' ] ,
217+ classKey : k ,
218+ usePk : pk ? pk : false ,
219+ handler : this . createResourceHere ,
220+ scope : this
218221 } ) ;
219222 if ( ui && ui . hasClass ( 'pqcreate' ) ) {
220223 qct . push ( {
221- text : types [ k ] [ 'text_create' ]
222- , classKey : k
223- , handler : this . createResource
224- , scope : this
224+ text : types [ k ] [ 'text_create' ] ,
225+ classKey : k ,
226+ handler : this . createResource ,
227+ scope : this
225228 } ) ;
226229 }
227230 }
228231 m . push ( {
229- text : _ ( 'create' )
230- , handler : function ( ) { return false ; }
231- , menu : { items : ct }
232+ text : _ ( 'create' ) ,
233+ handler : function ( ) { return false ; } ,
234+ menu : { items : ct }
232235 } ) ;
233236 if ( ui && ui . hasClass ( 'pqcreate' ) ) {
234237 m . push ( {
235- text : _ ( 'quick_create' )
236- , handler : function ( ) { return false ; }
237- , menu : { items : qct }
238+ text : _ ( 'quick_create' ) ,
239+ handler : function ( ) { return false ; } ,
240+ menu : { items : qct }
238241 } ) ;
239242 }
240243
0 commit comments