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

Commit 6d5d9d6

Browse files
committed
ENH: refs #0377. Add the quota config as a tab on the userpage
1 parent a4064a0 commit 6d5d9d6

File tree

5 files changed

+25
-19
lines changed

5 files changed

+25
-19
lines changed

core/controllers/UserController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ public function userpageAction()
712712
$this->view->information = array();
713713

714714
$this->view->disableFeedImages = true;
715+
$this->view->moduleTabs = Zend_Registry::get('notifier')->callback('CALLBACK_CORE_GET_USER_TABS', array('user' => $userDao));
715716
}
716717

717718
/** Manage files page action*/

core/views/user/userpage.phtml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/common/common.bro
6969
<li><a href="#tabs-5"><?php echo $this->t('Shared to me');?></a></li>
7070
<?php
7171
}
72+
foreach($this->moduleTabs as $module)
73+
{
74+
foreach($module as $name => $url)
75+
{
76+
echo "<li><a href='{$url}'>{$name}</a></li>";
77+
}
78+
}
7279
?>
7380
</ul>
7481
<div id="tabs-1">

modules/sizequota/Notification.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Sizequota_Notification extends MIDAS_Notification
2929
public function init()
3030
{
3131
//$this->addCallBack('CALLBACK_CORE_GET_MANAGE_COMMUNITY_TABS', 'getCommunityTab');
32-
//$this->addCallBack('CALLBACK_CORE_GET_USER_TABS', 'getUserTab');
32+
$this->addCallBack('CALLBACK_CORE_GET_USER_TABS', 'getUserTab');
3333
//$this->addCallBack('CALLBACK_CORE_VALIDATE_UPLOAD', 'validateUpload');
3434
}
3535

@@ -42,7 +42,10 @@ public function getCommunityTab($args)
4242
/** Add a tab to the user's main page for size quota */
4343
public function getUserTab($args)
4444
{
45-
//TODO
45+
$user = $args['user'];
46+
$fc = Zend_Controller_Front::getInstance();
47+
$moduleWebroot = $fc->getBaseUrl().'/'.$this->moduleName;
48+
return array($this->t('Storage Quota') => $moduleWebroot.'/config/folder?folderId='.$user->getFolderId());
4649
}
4750

4851
/** Return whether or not the upload is allowed. If uploading the file
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
$(document).ready(function() {
2-
3-
4-
$('#configForm').ajaxForm( {beforeSubmit: validateConfig, success: successConfig} );
1+
$(document).ready(function() {
2+
$('#configForm').ajaxForm( {beforeSubmit: validateConfig, success: successConfig} );
53
});
64

7-
8-
function validateConfig(formData, jqForm, options) {
5+
function validateConfig(formData, jqForm, options) {
96

107
}
118

@@ -19,15 +16,15 @@ function successConfig(responseText, statusText, xhr, form)
1916
}
2017
if(jsonResponse==null)
2118
{
22-
createNotive('Error',4000);
23-
return;
19+
createNotice('Error',4000);
20+
return;
2421
}
2522
if(jsonResponse[0])
2623
{
27-
createNotive(jsonResponse[1],4000);
24+
createNotice(jsonResponse[1],4000);
2825
}
2926
else
3027
{
31-
createNotive(jsonResponse[1],4000);
28+
createNotice(jsonResponse[1],4000);
3229
}
33-
}
30+
}

modules/sizequota/views/config/folder.phtml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21-
$this->headScript()->appendFile($this->coreWebroot.'/public/js/jquery/jquery.form.js');
22-
$this->headScript()->appendFile($this->moduleWebroot.'/public/js/config/config.folder.js');
21+
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/jquery/jquery.form.js"></script>';
22+
echo '<script type="text/javascript" src="'.$this->moduleWebroot.'/public/js/config/config.folder.js"></script>';
2323
?>
2424
<link type="text/css" rel="stylesheet" href="<?php echo $this->moduleWebroot?>/public/css/config/config.folder.css" />
2525
<link type="text/css" rel="stylesheet" href="<?php echo $this->coreWebroot?>/public/css/common/common.genericPage.css" />
2626

2727
</div>
28-
<form class='genericForm' id='configForm' method='<?php echo $this->configForm['method'] ?>' action='<?php echo $this->configForm['action'] ?>'>
29-
<h3>Size Quota Module Configuration:</h3>
30-
Leave a field blank to indicate an unlimited quota.
31-
<br /><br />
28+
<form class='genericForm' id='configForm' method='<?php echo $this->configForm['method'] ?>' action='<?php echo $this->configForm['action'] ?>'>
29+
<h3><?php echo $this->t('Storage Quota Configuration'); ?></h3>
3230
<div>
3331
<?php
3432
echo $this->configForm['usedefault'];

0 commit comments

Comments
 (0)