@@ -7,7 +7,7 @@ class BrowseController extends AppController
7
7
{
8
8
public $ _models =array ('Folder ' ,'User ' ,'Community ' ,'Folder ' ,'Item ' );
9
9
public $ _daos =array ('Folder ' ,'User ' ,'Community ' ,'Folder ' ,'Item ' );
10
- public $ _components =array ('Date ' ,'Utility ' );
10
+ public $ _components =array ('Date ' ,'Utility ' , ' Sortdao ' );
11
11
12
12
/** Init Controller */
13
13
function init ()
@@ -18,17 +18,27 @@ function init()
18
18
/** Index Action*/
19
19
public function indexAction ()
20
20
{
21
+
21
22
$ communities =array ();
22
23
$ items =array ();
23
24
$ header ="" ;
24
25
25
26
$ communities =$ this ->User ->getUserCommunities ($ this ->userSession ->Dao );
26
- $ header .="> Data " ;
27
+ $ communities =array_merge ($ communities , $ this ->Community ->getPubicCommunities ());
28
+
29
+ $ header .="<ul class='pathBrowser'> " ;
30
+ $ header .=" <li class='pathData'><a href=' {$ this ->view ->webroot }/browse'>Data</a></li> " ;
31
+ $ header .="</ul> " ;
27
32
28
33
$ this ->view ->Date =$ this ->Component ->Date ;
29
34
35
+ $ this ->Component ->Sortdao ->field ='name ' ;
36
+ $ this ->Component ->Sortdao ->order ='asc ' ;
37
+ usort ($ communities , array ($ this ->Component ->Sortdao ,'sortByName ' ));
38
+ $ communities =$ this ->Component ->Sortdao ->arrayUniqueDao ($ communities );
39
+
30
40
$ this ->view ->communities =$ communities ;
31
- $ this ->view ->header =substr ( $ header, 2 ) ;
41
+ $ this ->view ->header =$ header ;
32
42
33
43
$ javascriptText =array ();
34
44
$ javascriptText ['view ' ]=$ this ->t ('View ' );
@@ -48,10 +58,11 @@ public function indexAction()
48
58
/** get getfolders content (ajax function for the treetable) */
49
59
public function getfolderscontentAction ()
50
60
{
51
- if (!$ this ->getRequest ()->isXmlHttpRequest ())
61
+ /* if(!$this->getRequest()->isXmlHttpRequest())
52
62
{
53
63
throw new Zend_Exception("Why are you here ? Should be ajax.");
54
- }
64
+ }*/
65
+
55
66
$ this ->_helper ->layout ->disableLayout ();
56
67
$ this ->_helper ->viewRenderer ->setNoRender ();
57
68
$ folderIds =$ this ->_getParam ('folders ' );
@@ -65,6 +76,7 @@ public function getfolderscontentAction()
65
76
{
66
77
throw new Zend_Exception ("Folder doesn't exist " );
67
78
}
79
+
68
80
$ folders =$ this ->Folder ->getChildrenFoldersFiltered ($ parents ,$ this ->userSession ->Dao ,MIDAS_POLICY_READ );
69
81
$ items =$ this ->Folder ->getItemsFiltered ($ parents ,$ this ->userSession ->Dao ,MIDAS_POLICY_READ );
70
82
$ jsonContent =array ();
@@ -84,8 +96,7 @@ public function getfolderscontentAction()
84
96
$ tmp ['item_id ' ]=$ item ->getItemId ();
85
97
$ tmp ['name ' ]=$ item ->getName ();
86
98
$ tmp ['parent_id ' ]=$ item ->parent_id ;
87
- $ itemRevision =$ this ->Item ->getLastRevision ($ item );
88
- $ tmp ['creation ' ]=$ this ->Component ->Date ->ago ($ itemRevision ->getDate (),true );
99
+ $ tmp ['creation ' ]=$ this ->Component ->Date ->ago ($ item ->getDate (),true );
89
100
$ tmp ['size ' ]=$ this ->Component ->Utility ->formatSize ($ item ->getSizebytes ());
90
101
$ tmp ['policy ' ]=$ item ->policy ;
91
102
$ jsonContent [$ item ->parent_id ]['items ' ][]=$ tmp ;
@@ -100,14 +111,15 @@ public function getfolderssizeAction()
100
111
if (!$ this ->getRequest ()->isXmlHttpRequest ())
101
112
{
102
113
throw new Zend_Exception ("Why are you here ? Should be ajax. " );
103
- }
114
+ }
104
115
105
116
$ this ->_helper ->layout ->disableLayout ();
106
117
$ this ->_helper ->viewRenderer ->setNoRender ();
107
118
$ folderIds =$ this ->_getParam ('folders ' );
108
119
if (!isset ($ folderIds ))
109
120
{
110
- throw new Zend_Exception ("Please set the folder Id " );
121
+ echo "[] " ;
122
+ return ;
111
123
}
112
124
$ folderIds =explode ('- ' ,$ folderIds );
113
125
$ folders = $ this ->Folder ->load ($ folderIds );
@@ -145,7 +157,14 @@ public function getelementinfoAction()
145
157
case 'folder ' :
146
158
$ folder =$ this ->Folder ->load ($ id );
147
159
$ jsonContent =array_merge ($ jsonContent ,$ folder ->_toArray ());
148
- $ jsonContent ['creation ' ]=$ jsonContent ['date ' ];
160
+ if (isset ($ jsonContent ['date ' ]))
161
+ {
162
+ $ jsonContent ['creation ' ]=$ jsonContent ['date ' ];
163
+ }
164
+ else
165
+ {
166
+ $ jsonContent ['creation ' ]=date ('c ' );
167
+ }
149
168
break ;
150
169
case 'item ' :
151
170
$ item =$ this ->Item ->load ($ id );
0 commit comments