@@ -13,6 +13,10 @@ define([
13
13
, "main/clientOnly!dijit/form/Button"
14
14
, "dojo/_base/lang"
15
15
, "main/clientOnly!sol/wgt/Turn"
16
+ , "main/clientOnly!dijit/Menu"
17
+ , "main/clientOnly!dijit/MenuItem"
18
+ , "main/clientOnly!dijit/form/ComboButton"
19
+ , "dojo/topic"
16
20
] , function (
17
21
declare
18
22
, Base
@@ -28,6 +32,10 @@ define([
28
32
, Button
29
33
, lang
30
34
, Turn
35
+ , Menu
36
+ , MenuItem
37
+ , ComboButton
38
+ , topic
31
39
) {
32
40
33
41
@@ -39,6 +47,7 @@ define([
39
47
, downloadButton : true
40
48
, "class" : "directory"
41
49
, viewMode : "list"
50
+ , openDirButton : false
42
51
43
52
// the model decides if it is competent to handle that type
44
53
/* par: {
@@ -151,8 +160,18 @@ define([
151
160
, buildRendering : function ( ) {
152
161
var ret = this . inherited ( arguments ) ;
153
162
163
+ this . upDirButton = this . ownObj ( new Button ( {
164
+ label : "up"
165
+ , showLabel : true
166
+ , onClick : lang . hitch ( this , "goUp" )
167
+ , region : "left"
168
+ , disabled : ( this . par . id && this . par . id . length ) ? false : true
169
+ } ) ) ;
170
+ this . menu . addChild ( this . upDirButton , 0 ) ;
171
+
172
+
154
173
this . newDirButton = this . ownObj ( new Button ( {
155
- label : "new Directory "
174
+ label : "new Folder "
156
175
, showLabel : true
157
176
, onClick : lang . hitch ( this , "createNew" , true )
158
177
, region : "left"
@@ -167,43 +186,42 @@ define([
167
186
} ) ) ;
168
187
this . menu . addChild ( this . newButton ) ;
169
188
189
+
170
190
this . searchButton = this . ownObj ( new Button ( {
191
+ "class" : "searchButton" ,
171
192
label : "search"
172
193
, showLabel : true
173
194
, onClick : lang . hitch ( this , "search" )
174
195
, region : "left"
175
196
} ) ) ;
176
197
this . menu . addChild ( this . searchButton ) ;
177
198
199
+
178
200
var self = this ;
179
- require ( [ "dijit/Menu" , "dijit/MenuItem" , "dijit/form/ComboButton" , "dojo/domReady!" ] ,
180
- function ( Menu , MenuItem , ComboButton ) {
181
- var menu = new Menu ( { style : "display: none;" } ) ;
182
- var menuItem1 = new MenuItem ( {
183
- label : "Details" ,
184
- onClick : function ( ) { self . set ( "viewMode" , "details" ) ; }
185
- } ) ;
186
- menu . addChild ( menuItem1 ) ;
187
-
188
- var menuItem2 = new MenuItem ( {
189
- label : "List" ,
190
- onClick : function ( ) { self . set ( "viewMode" , "list" ) ; }
191
- } ) ;
192
- menu . addChild ( menuItem2 ) ;
193
-
194
- self . viewButton = new ComboButton ( {
195
- label : "Details" ,
196
- dropDown : menu ,
197
- viewMode : "details" ,
198
- onClick : function ( ) {
199
- self . set ( "viewMode" , this . viewMode ) ;
200
- }
201
- } ) ;
202
- self . menu . addChild ( self . viewButton ) ;
203
-
204
-
201
+ var menu = new Menu ( { style : "display: none;" } ) ;
202
+ var menuItem1 = new MenuItem ( {
203
+ label : "Details" ,
204
+ onClick : function ( ) { self . set ( "viewMode" , "details" ) ; }
205
205
} ) ;
206
+ menu . addChild ( menuItem1 ) ;
206
207
208
+ var menuItem2 = new MenuItem ( {
209
+ label : "List" ,
210
+ onClick : function ( ) { self . set ( "viewMode" , "list" ) ; }
211
+ } ) ;
212
+ menu . addChild ( menuItem2 ) ;
213
+
214
+ self . viewButton = new ComboButton ( {
215
+ "class" : "viewButton" ,
216
+ label : "Details" ,
217
+ dropDown : menu ,
218
+ viewMode : "details" ,
219
+ onClick : function ( ) {
220
+ self . set ( "viewMode" , this . viewMode ) ;
221
+ }
222
+ } ) ;
223
+ self . menu . addChild ( self . viewButton ) ;
224
+
207
225
208
226
this . grid = this . ownObj ( new Grid ( {
209
227
content : this . content
@@ -221,6 +239,27 @@ define([
221
239
return ret ;
222
240
}
223
241
242
+ , goUp : function ( ) {
243
+
244
+ var idStr = "" ;
245
+ var s = this . par . id . split ( "/" ) ;
246
+ for ( i = 0 ; i < s . length - 1 ; ++ i ) {
247
+ if ( i ) {
248
+ idStr += "/" ;
249
+ } ;
250
+ idStr += s [ i ] ;
251
+ } ;
252
+
253
+ topic . publish ( "client/openid" , {
254
+ item : {
255
+ id : idStr
256
+ , type : "file"
257
+ }
258
+ , insteadOf : this
259
+ } ) ;
260
+
261
+ }
262
+
224
263
, _setViewModeAttr : function ( viewMode ) {
225
264
if ( this . viewMode == viewMode ) {
226
265
return ;
0 commit comments