Skip to content

Commit

Permalink
Showing nice usernames
Browse files Browse the repository at this point in the history
fixes #234
  • Loading branch information
hypery2k committed Jul 7, 2014
1 parent 782f274 commit e174064
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 37 deletions.
54 changes: 23 additions & 31 deletions storagecharts2/src/main/php/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,32 @@
OC::$CLASSPATH['OC_DLStCharts'] = OC_App::getAppPath('storagecharts2') . "/lib/db.class.php";
OC::$CLASSPATH['OC_DLStChartsLoader'] = OC_App::getAppPath('storagecharts2') . "/lib/loader.class.php";

if(OC_User::isAdminUser(OCP\User::getUser())){
OCP\App::register(Array(
'order' => 60,
'id' => 'storagecharts2',
'name' => 'Storage Charts'
));

OCP\App::addNavigationEntry(array(
OCP\App::addNavigationEntry(array(
'id' => 'storagecharts2',
'order' => 60,
'href' => OCP\Util::linkTo('storagecharts2', 'charts.php'),
'icon' => OCP\Util::imagePath('storagecharts2', 'chart.png'),
'name' => $l->t('DL Charts')
));

OCP\App::registerPersonal('storagecharts2','settings');

// Get storage value for logged in user
$data_dir = OCP\Config::getSystemValue('datadirectory', '');
if(OCP\User::getUser() && strlen($data_dir) != 0){
$fs = OCP\Files::getStorage('files');

// workaround to detect OC version
// OC 5
if (6 > @reset(OCP\Util::getVersion())) {
OCP\Util::writeLog('storagecharts2', 'Running on OwnCloud 5', OCP\Util::DEBUG);
$used = OC_DLStCharts::getTotalDataSize(OC::$CONFIG_DATADIRECTORY);
// OC 6
} else {
$datadir = OC_Config::getValue('datadirectory');
OCP\Util::writeLog('storagecharts2', 'Running on OwnCloud 6', OCP\Util::DEBUG);
$used = OC_DLStCharts::getTotalDataSize($datadir);
}
$total = OC_DLStCharts::getTotalDataSize($data_dir) + $fs->free_space();
OC_DLStCharts::update($used, $total);
));

OCP\App::registerPersonal('storagecharts2','settings');

// Get storage value for logged in user
$data_dir = OCP\Config::getSystemValue('datadirectory', '');
if(OCP\User::getUser() && strlen($data_dir) != 0){
$fs = OCP\Files::getStorage('files');

// workaround to detect OC version
// OC 5
if (6 > @reset(OCP\Util::getVersion())) {
OCP\Util::writeLog('storagecharts2', 'Running on OwnCloud 5', OCP\Util::DEBUG);
$used = OC_DLStCharts::getTotalDataSize(OC::$CONFIG_DATADIRECTORY);
// OC 6
} else {
$datadir = OC_Config::getValue('datadirectory');
OCP\Util::writeLog('storagecharts2', 'Running on OwnCloud 6', OCP\Util::DEBUG);
$used = OC_DLStCharts::getTotalDataSize($datadir);
}
}
$total = OC_DLStCharts::getTotalDataSize($data_dir) + $fs->free_space();
OC_DLStCharts::update($used, $total);
}
7 changes: 2 additions & 5 deletions storagecharts2/src/main/php/templates/charts.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@

<div id="storagecharts2">
<div class="personalblock topblock titleblock">
DjazzLab Storage Charts<span><?php print($l->t('Drag\'N\'Drop on the chart title to re-order')); ?>
</span>
<span><?php print($l->t('Drag\'N\'Drop on the chart title to re-order')); ?></span>
</div>
</div>
<div id="stc_frame">
Expand All @@ -70,9 +69,7 @@
<img
src="<?php print(OCP\Util::imagePath('storagecharts2', 'move.png')); ?>" />
<?php print($l->t($sc_sort_title).' '.$l->t('for')); ?>
"
<?php print(OC_Group::inGroup(OCP\User::getUser(), 'admin')?$l->t('all users'):OCP\User::getUser()); ?>
"
"<?php print(OC_Group::inGroup(OCP\User::getUser(), 'admin')?$l->t('all users'):OCP\User::getDisplayName()); ?>"
</h3>
<div id="<?php print(substr($sc_sort, 1)); ?>"
style="max-width: 100%; height: 400px; margin: 0 auto"></div>
Expand Down
3 changes: 2 additions & 1 deletion storagecharts2/src/main/php/templates/settings.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<form id="storagecharts2" method="POST"
action="<?php print(OC_Helper::linkTo('settings','personal.php')); ?>">
<fieldset class="personalblock">
<strong>DjazzLab Storage Charts</strong><span
<strong>Storage Charts 2</strong>
<span
style="margin-left: 10px; color: #BBB; font-style: italic;"><?php print($l->t('Uncheck charts you do not want to display')); ?>
</span>
<?php foreach($_['displays'] as $chart => $is_enable){
Expand Down

0 comments on commit e174064

Please sign in to comment.