Skip to content

Commit

Permalink
Hide the 'Add' icon, and/or entire section if needed.
Browse files Browse the repository at this point in the history
If remote_cals pref is locked, don't allow adding new calendars,
and hide the section if it's locked AND empty.
  • Loading branch information
mrubinsk committed Jun 18, 2015
1 parent b09ce56 commit 67d623f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion kronolith/lib/View/Sidebar.php
Expand Up @@ -61,7 +61,8 @@ public function __construct($config = array())
$sidebar->admin = $registry->isAdmin();
$sidebar->resourceAdmin = $registry->isAdmin() || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management');
$sidebar->resources = $GLOBALS['conf']['resources']['enabled'];

$sidebar->addRemote = !$prefs->isLocked('remote_cals');
$sidebar->showRemote = !($prefs->isLocked('remote_cals') && empty(unserialize($prefs->getValue('remote_cals'))));
$this->content = $sidebar->render('dynamic/sidebar');
}
}
6 changes: 5 additions & 1 deletion kronolith/templates/dynamic/sidebar.html.php
Expand Up @@ -124,14 +124,17 @@
<div id="kronolithResourceGroups" class="horde-resources"></div>
</div>
</div>
<?php endif ?>
<?php endif; ?>

<div id="kronolithExternalCalendars"></div>

<?php if ($this->showRemote): ?>
<div class="horde-sidebar-split"></div>
<div>
<h3>
<?php if ($this->addRemote): ?>
<a href="#" id="kronolithAddremote" class="horde-add" title="<?php echo _("Add Remote Calendar") ?>">+</a>
<?php endif; ?>
<span class="horde-expand" title="<?php echo _("Expand") ?>"><?php echo _("Remote Calendars") ?></span>
</h3>

Expand All @@ -140,6 +143,7 @@
<div id="kronolithRemoteCalendars" class="horde-resources"></div>
</div>
</div>
<?php endif;?>

<div class="horde-sidebar-split"></div>
<div>
Expand Down

0 comments on commit 67d623f

Please sign in to comment.