Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 25062d8

Browse files
author
Charles Marion
committed
ENH: display browser
1 parent 0268752 commit 25062d8

File tree

11 files changed

+92
-14
lines changed

11 files changed

+92
-14
lines changed

application/controllers/BrowseController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function indexAction()
2727
$communities=array_merge($communities, $this->Community->getPubicCommunities());
2828

2929
$header.="<ul class='pathBrowser'>";
30-
$header.=" <li class='pathData'><a href='{$this->view->webroot}/browse'>Data</a></li>";
30+
$header.=" <li class='pathData'><a href='{$this->view->webroot}/browse'>{$this->t('Data')}</a></li>";
3131
$header.="</ul>";
3232

3333
$this->view->Date=$this->Component->Date;
@@ -45,6 +45,10 @@ public function indexAction()
4545
$this->view->nCommunities=$this->Community->getCountAll();
4646
$this->view->nItems=$this->Item->getCountAll();
4747
$this->view->notifications=array();
48+
49+
$this->view->json['community']['createCommunity']=$this->t('Create a community');
50+
$this->view->json['community']['titleCreateLogin']=$this->t('Please log in');
51+
$this->view->json['community']['contentCreateLogin']=$this->t('You need to be logged in to be able to create a community.');
4852
}
4953

5054
/** get getfolders content (ajax function for the treetable) */

application/controllers/FolderController.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,29 @@ public function viewAction()
4444
{
4545
$items[$key]->size=$this->Component->Utility->formatSize($i->getSizebytes());
4646
}
47-
$header.=" <li class='pathFolder'><a href='{$this->view->webroot}/folder/{$folder->getKey()}'>{$folder->getName()}</a></li>";
47+
$header.=" <li class='pathFolder'><img alt='' src='{$this->view->webroot}/public/images/FileTree/folder_open.png' /><span><a href='{$this->view->webroot}/folder/{$folder->getKey()}'>{$folder->getName()}</a></span></li>";
4848
$parent=$folder->getParent();
4949
while($parent!==false)
5050
{
5151
if(strpos($parent->getName(), 'community')!==false&&$this->Folder->getCommunity($parent)!==false)
5252
{
5353
$community=$this->Folder->getCommunity($parent);
54-
$header=" <li class='pathCommunity'><a href='{$this->view->webroot}/community/{$community->getKey()}'>{$community->getName()}</a></li>".$header;
54+
$header=" <li class='pathCommunity'><img alt='' src='{$this->view->webroot}/public/images/icons/community.png' /><span><a href='{$this->view->webroot}/community/{$community->getKey()}'>{$community->getName()}</a></span></li>".$header;
55+
}
56+
elseif(strpos($parent->getName(), 'user')!==false&&$this->Folder->getUser($parent)!==false)
57+
{
58+
$user=$this->Folder->getUser($parent);
59+
$header=" <li class='pathUser'><img alt='' src='{$this->view->webroot}/public/images/icons/unknownUser-small.png' /><span><a href='{$this->view->webroot}/user/{$user->getKey()}'>{$user->getFullName()}</a></span></li>".$header;
60+
5561
}
5662
else
5763
{
58-
$header=" <li class='pathFolder'><a href='{$this->view->webroot}/folder/{$parent->getKey()}'>{$parent->getName()}</a></li>".$header;
64+
$header=" <li class='pathFolder'><img alt='' src='{$this->view->webroot}/public/images/FileTree/directory.png' /><span><a href='{$this->view->webroot}/folder/{$parent->getKey()}'>{$parent->getName()}</a></span></li>".$header;
5965
}
6066
$parent=$parent->getParent();
6167
}
6268
$header="<ul class='pathBrowser'>
63-
<li class='pathData'><a href='{$this->view->webroot}/browse'>Data</a></li>".$header;
69+
<li class='pathData'><a href='{$this->view->webroot}/browse'>{$this->t('Data')}</a></li>".$header;
6470
$header.="</ul>";
6571
}
6672
$this->view->mainFolder=$folder;

application/models/pdo/FolderModel.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,20 @@ function getCommunity($folder)
272272
->where('folder_id = ?', $folder->getFolderId())));
273273
return $dao;
274274
}
275+
276+
/** Get user if the folder is the main folder of one*/
277+
function getUser($folder)
278+
{
279+
if(!$folder instanceof FolderDao)
280+
{
281+
throw new Zend_Exception("Should be a folder.");
282+
}
283+
$dao= $this->initDao('User', $this->fetchRow($this->select()
284+
->setIntegrityCheck(false)
285+
->from('user')
286+
->where('folder_id = ?', $folder->getFolderId())));
287+
return $dao;
288+
}
275289

276290
/** Create a folder */
277291
function createFolder($name,$description,$parent)

application/views/browse/index.phtml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010
<img class="tableLoading" alt="" src="<?php echo $this->webroot?>/public/images/icons/loading.gif"/>
1111
<table id="browseTable" class="midasTree">
1212
<thead>
13+
<?php
14+
if(!empty($this->communities))
15+
{ ?>
1316
<tr>
1417
<th class="thData"><?php echo $this->t('Name');?></th>
1518
<th class="thSize"><?php echo $this->t('Size');?></th>
1619
<th class="thDate"><?php echo $this->t('Modified');?></th>
1720
<th class="thCheckbox"></th>
1821
</tr>
22+
<?php
23+
}
24+
?>
1925
</thead>
2026
<tbody>
2127
<?php
@@ -34,6 +40,13 @@
3440
?>
3541
</tbody>
3642
</table>
43+
44+
<?php
45+
if(empty($this->communities))
46+
{
47+
echo "<h4>{$this->t("No communty available")}.<a class='createCommunity' >{$this->t("Create your own community")}!</a> </h4>";
48+
}
49+
?>
3750
</div>
3851
<div class="viewSideBar">
3952
<div class="sideElementFirst viewAction" >
@@ -57,20 +70,21 @@
5770

5871

5972
<div class="defaultSide" >
60-
BlaBla
61-
<br/>
73+
<div align="justify" class='sideElementFirst feedNotification'>
74+
MIDAS integrates multimedia server technology with Kitware?s open-source data analysis and visualization clients. The server follows open standards for data storage, access and harvesting.
75+
</div>
6276
<?php
6377
if(!empty($this->notifications))
6478
{
65-
echo "<div class='sideElementFirst feedNotification'>
79+
echo "<div class='sideElement feedNotification'>
6680
<h1>Notifications</h1>
6781
</div>";
6882
}
6983
?>
7084
<?php
7185
if(!empty($this->itemThumbnails))
7286
{
73-
echo '<div class="'.(empty($this->notifications)?'sideElementFirst':'sideElement').' feedThumbnail">';
87+
echo '<div class="sideElement feedThumbnail">';
7488
echo '<h1>Thumbnails</h1>';
7589
foreach($this->itemThumbnails as $item)
7690
{

application/views/folder/view.phtml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444

4545
</tbody>
4646
</table>
47+
48+
<?php
49+
if(empty($this->folders)&&empty($this->items))
50+
{
51+
echo "<h4>{$this->t("This folder is empty")}.</h4>";
52+
}
53+
?>
4754
</div>
4855
<div class="viewSideBar">
4956
<div class="sideElementFirst viewAction">
@@ -66,6 +73,7 @@
6673
</div>
6774
</div>
6875

76+
<div class="defaultSideTrigger" type='folder' element='<?php echo $this->mainFolder->getFolderId() ?>'>
77+
</div>
6978

70-
<div class="defaultSideTrigger" type='folder' element='<?php echo $this->mainFolder->getFolderId() ?>'/>
7179

public/css/common/common.browser.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,23 @@ ul.pathBrowser li{
2323
background-repeat: no-repeat;
2424
background-position: right 0px;
2525
display: list-item;
26-
padding: 3px 22px 7px 10px;
26+
padding: 3px 22px 7px 3px;
2727
text-shadow: 0px 1px 0px #EEE;
2828
background-image: url("../../images/icons/path-divider.png");
2929
}
3030

3131

32+
ul.pathBrowser li img{
33+
position:relative;
34+
top:0px;
35+
}
36+
37+
38+
ul.pathBrowser li span{
39+
position:relative;
40+
top:-2px;
41+
}
42+
3243

3344
ul.pathBrowser li a{
3445
font-size: 14px;
@@ -39,4 +50,4 @@ ul.pathBrowser li a{
3950

4051
span.infoTitle{
4152
font-weight: bold;
42-
}
53+
}
803 Bytes
Loading

public/js/browse/browse.index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@
1313
$('div.feedThumbnail img').mouseout(function(){
1414
$(this).fadeTo("fast",0.2);
1515
});
16+
17+
18+
$('a.createCommunity').click(function()
19+
{
20+
if(json.global.logged)
21+
{
22+
loadDialog("createCommunity","/community/create");
23+
showDialog(json.community.createCommunity,false);
24+
}
25+
else
26+
{
27+
createNotive(json.community.contentCreateLogin,4000)
28+
$("div.TopDynamicBar").show('blind');
29+
loadAjaxDynamicBar('login','/user/login');
30+
}
31+
});
1632
});
1733

1834
//dependance: common/browser.js

public/js/folder/folder.view.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
$("img.tableLoading").hide();
55
$("table#browseTable").show();
66
genericCallbackSelect($('div.defaultSideTrigger'));
7+
78
});
89

910
//dependance: common/browser.js

public/js/layout/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ $(function() {
139139
loadAjaxDynamicBar('login','/user/login');
140140
}
141141
});
142+
142143

143144
if(json.global.logged)
144145
{
145-
$('.uploadFile').cluetip({
146+
$('div.HeaderAction li.uploadFile').cluetip({
146147
cluetipClass: 'jtip',
147148
dropShadow: false,
148149
hoverIntent: false,

0 commit comments

Comments
 (0)