$notification->push($calendar, 'horde.error');
header('Location: ' . Horde::applicationUrl('calendars/', true));
exit;
-} elseif ($calendar->get('owner') != Horde_Auth::getAuth()) {
+} elseif ($calendar->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin())) {
$notification->push(_("You are not allowed to delete this calendar."), 'horde.error');
header('Location: ' . Horde::applicationUrl('calendars/', true));
exit;
$notification->push($calendar, 'horde.error');
header('Location: ' . Horde::applicationUrl('calendars/', true));
exit;
-} elseif ($calendar->get('owner') != Horde_Auth::getAuth()) {
+} elseif ($calendar->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin())) {
$notification->push(_("You are not allowed to change this calendar."), 'horde.error');
header('Location: ' . Horde::applicationUrl('calendars/', true));
exit;
$vars->set('description', $calendar->get('desc'));
$tagger = Kronolith::getTagger();
$vars->set('tags', implode(',', array_values($tagger->getTags($calendar->getName(), 'calendar'))));
+$vars->set('system', is_null($calendar->get('owner')));
$title = $form->getTitle();
require KRONOLITH_TEMPLATES . '/common-header.inc';
require KRONOLITH_TEMPLATES . '/menu.inc';
$calendars[$calendar->getName()] = $calendar;
$sorted_calendars[$calendar->getName()] = $calendar->get('name');
}
+if (Horde_Auth::isAdmin()) {
+ $system_calendars = $kronolith_shares->listSystemShares();
+ foreach ($system_calendars as $calendar) {
+ $calendars[$calendar->getName()] = $calendar;
+ $sorted_calendars[$calendar->getName()] = $calendar->get('name');
+ }
+}
$remote_calendars = unserialize($prefs->getValue('remote_cals'));
foreach ($remote_calendars as $calendar) {
$calendars[$calendar['url']] = $calendar;
v3.0-git
--------
+[jan] Add system calendars (Request #2059).
[jan] Add URL field to events.
[jan] Add task management capabilities to the Ajax interface.
[jan] Manage holidays like any other calendar driver.
-[mjr] Add support for resource scheduling.
+[mjr] Add resource scheduling.
[jan] Integrate tasks into Ajax interface (Gonçalo Queirós
<mail@goncaloqueiros.net>).
[mjr] Extend listTimeObjects API to include optional links and icons.
$this->addVariable(_("Color"), 'color', 'colorpicker', false);
$this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
$this->addVariable(_("Tags"), 'tags', 'text', false);
+ if (Horde_Auth::isAdmin()) {
+ $this->addVariable(_("System Calendar"), 'system', 'boolean', false, false, _("System calendars don't have an owner. Only administrators can change the calendar settings and permissions."));
+ }
$this->setButtons(array(_("Create")));
}
function execute()
{
$info = array();
- foreach (array('name', 'color', 'description', 'tags') as $key) {
+ foreach (array('name', 'color', 'description', 'tags', 'system') as $key) {
$info[$key] = $this->_vars->get($key);
}
return Kronolith::addShare($info);
$this->addVariable(_("Color"), 'color', 'colorpicker', false);
$this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
$this->addVariable(_("Tags"), 'tags', 'text', false);
+ if (Horde_Auth::isAdmin()) {
+ $this->addVariable(_("System Calendar"), 'system', 'boolean', false, false, _("System calendars don't have an owner. Only administrators can change the calendar settings and permissions."));
+ }
+
$this->setButtons(array(_("Save")));
}
function execute()
{
$info = array();
- foreach (array('name', 'color', 'description', 'tags') as $key) {
+ foreach (array('name', 'color', 'description', 'tags', 'system') as $key) {
$info[$key] = $this->_vars->get($key);
}
return Kronolith::updateShare($this->_calendar, $info);
$calendar->set('name', $info['name']);
$calendar->set('color', $info['color']);
$calendar->set('desc', $info['description']);
+ if (!empty($info['system'])) {
+ $calendar->set('owner', null);
+ }
$tagger = self::getTagger();
$tagger->tag($calendar->getName(), $info['tags'], 'calendar');
public static function updateShare(&$calendar, $info)
{
if (!Horde_Auth::getAuth() ||
- $calendar->get('owner') != Horde_Auth::getAuth()) {
+ ($calendar->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin()))) {
return PEAR::raiseError(_("You are not allowed to change this calendar."));
}
$calendar->set('name', $info['name']);
$calendar->set('color', $info['color']);
$calendar->set('desc', $info['description']);
+ $calendar->set('owner', empty($info['system']) ? Horde_Auth::getAuth() : null);
if ($original_name != $info['name']) {
$result = Kronolith::getDriver()->rename($original_name, $info['name']);
if (is_a($result, 'PEAR_Error')) {
*/
public static function deleteShare($calendar)
{
- if (!Horde_Auth::getAuth() ||
- $calendar->get('owner') != Horde_Auth::getAuth()) {
- return PEAR::raiseError(_("You are not allowed to delete this calendar."));
- }
-
if ($calendar->getName() == Horde_Auth::getAuth()) {
return PEAR::raiseError(_("This calendar cannot be deleted."));
}
+ if (!Horde_Auth::getAuth() ||
+ ($calendar->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin()))) {
+ return PEAR::raiseError(_("You are not allowed to delete this calendar."));
+ }
+
// Delete the calendar.
$result = Kronolith::getDriver()->delete($calendar->getName());
if (is_a($result, 'PEAR_Error')) {
<td><?php echo $remote_unsubscribe_url_base->add('url', $calendar['url'])->link(array('title' => _("Unsubscribe"))) . $delete_img . '</a>' ?></td>
<?php else: ?>
<td><?php echo htmlspecialchars($calendar->get('name')) ?></td>
- <td><?php echo _("Local") ?></td>
+ <td><?php echo is_null($calendar->get('owner')) ? _("System") : _("Local") ?></td>
<td><?php $url = $display_url_base->add('display_cal', $calendar->getName()); echo $url->link(array('title' => _("Click or copy this URL to display this calendar"))) . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
<td><?php $url = new Horde_Url($subscribe_url_base . ($calendar->get('owner') ? $calendar->get('owner') : '-system-') . '/' . $calendar->getName() . '.ics'); echo $url->link(array('title' => _("Click or copy this URL to display this calendar"), 'target' => '_blank')) . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
<td><?php echo $edit_url_base->add('c', $calendar->getName())->link(array('title' => _("Edit"))) . $edit_img . '</a>' ?></td>
v3.0-git
--------
+[jan] Add system task lists (Request #2059).
[jan] Set colors per task list (Request #7480).
[cjh] Quick Add support: there is a javascript UI element for quickly adding
tasks, and an API method (tasks/quickAdd) that provides the same
$this->addVariable(_("Name"), 'name', 'text', true);
$this->addVariable(_("Color"), 'color', 'colorpicker', false);
$this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
+ if (Horde_Auth::isAdmin()) {
+ $this->addVariable(_("System Task List"), 'system', 'boolean', false, false, _("System task lists don't have an owner. Only administrators can change the task list settings and permissions."));
+ }
$this->setButtons(array(_("Create")));
}
function execute()
{
$info = array();
- foreach (array('name', 'color', 'description') as $key) {
+ foreach (array('name', 'color', 'description', 'system') as $key) {
$info[$key] = $this->_vars->get($key);
}
return Nag::addTasklist($info);
$this->addHidden('', 't', 'text', true);
$this->addVariable(_("Task List Name"), 'name', 'text', true);
$this->addVariable(_("Task List Description"), 'description', 'longtext', false, false, null, array(4, 60));
+ if (Horde_Auth::isAdmin()) {
+ $this->addVariable(_("System Task List"), 'system', 'boolean', false, false, _("System task lists don't have an owner. Only administrators can change the task list settings and permissions."));
+ }
$this->setButtons(array(_("Save")));
}
function execute()
{
$info = array();
- foreach (array('name', 'color', 'description') as $key) {
+ foreach (array('name', 'color', 'description', 'system') as $key) {
$info[$key] = $this->_vars->get($key);
}
return Nag::updateTasklist($this->_tasklist, $info);
$tasklist->set('name', $info['name']);
$tasklist->set('color', $info['color']);
$tasklist->set('desc', $info['description']);
+ if (!empty($info['system'])) {
+ $tasklist->set('owner', null);
+ }
$result = $GLOBALS['nag_shares']->addShare($tasklist);
if (is_a($result, 'PEAR_Error')) {
public static function updateTasklist(&$tasklist, $info)
{
if (!Horde_Auth::getAuth() ||
- $tasklist->get('owner') != Horde_Auth::getAuth()) {
+ ($tasklist->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin()))) {
return PEAR::raiseError(_("You are not allowed to change this task list."));
}
$tasklist->set('name', $info['name']);
$tasklist->set('color', $info['color']);
$tasklist->set('desc', $info['description']);
+ $tasklist->set('owner', empty($info['system']) ? Horde_Auth::getAuth() : null);
$result = $tasklist->save();
if (is_a($result, 'PEAR_Error')) {
return PEAR::raiseError(sprintf(_("Unable to save task list \"%s\": %s"), $info['name'], $result->getMessage()));
}
if (!Horde_Auth::getAuth() ||
- $tasklist->get('owner') != Horde_Auth::getAuth()) {
+ ($tasklist->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin()))) {
return PEAR::raiseError(_("You are not allowed to delete this task list."));
}
}
$vars = Horde_Variables::getDefaultVariables();
-$tasklist = $nag_shares->getShare($vars->get('t'));
+$tasklist_id = $vars->get('t');
+if ($tasklist_id == Horde_Auth::getAuth()) {
+ $notification->push(_("This task list cannot be deleted."), 'horde.warning');
+ header('Location: ' . Horde::applicationUrl('tasklists/', true));
+ exit;
+}
+$tasklist = $nag_shares->getShare($tasklist_id);
if (is_a($tasklist, 'PEAR_Error')) {
$notification->push($tasklist, 'horde.error');
header('Location: ' . Horde::applicationUrl('tasklists/', true));
exit;
+} elseif ($tasklist->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin())) {
+ $notification->push(_("You are not allowed to delete this task list."), 'horde.error');
+ header('Location: ' . Horde::applicationUrl('tasklists/', true));
+ exit;
}
+
$form = new Nag_DeleteTaskListForm($vars, $tasklist);
// Execute if the form is valid (must pass with POST variables only).
$notification->push($tasklist, 'horde.error');
header('Location: ' . Horde::applicationUrl('tasklists/', true));
exit;
+} elseif ($tasklist->get('owner') != Horde_Auth::getAuth() &&
+ (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin())) {
+ $notification->push(_("You are not allowed to change this task list."), 'horde.error');
+ header('Location: ' . Horde::applicationUrl('tasklists/', true));
+ exit;
}
$form = new Nag_EditTaskListForm($vars, $tasklist);
$vars->set('name', $tasklist->get('name'));
$vars->set('description', $tasklist->get('desc'));
+$vars->set('system', is_null($tasklist->get('owner')));
$title = $form->getTitle();
require NAG_TEMPLATES . '/common-header.inc';
require NAG_TEMPLATES . '/menu.inc';
foreach ($tasklists as $tasklist) {
$sorted_tasklists[$tasklist->getName()] = $tasklist->get('name');
}
+if (Horde_Auth::isAdmin()) {
+ $system_tasklists = $nag_shares->listSystemShares();
+ foreach ($system_tasklists as $tasklist) {
+ $tasklists[$tasklist->getName()] = $tasklist;
+ $sorted_tasklists[$tasklist->getName()] = $tasklist->get('name');
+ }
+}
asort($sorted_tasklists);
$edit_img = Horde::img('edit.png', _("Edit"), null, $registry->getImageDir('horde'));
<thead>
<tr>
<th class="sortdown"><?php echo _("Task List") ?></th>
+ <th><?php echo _("Kind") ?></th>
<th class="tasklist-list-url nosort"><?php echo _("Display URL") ?></th>
<th class="tasklist-list-url nosort"><?php echo _("Subscription URL") ?></th>
<th class="tasklist-list-icon nosort" colspan="<?php echo empty($conf['share']['no_sharing']) ? 3 : 2 ?>"> </th>
<?php $tasklist = $tasklists[$tasklist_id] ?>
<tr>
<td><?php echo htmlspecialchars($tasklist->get('name')) ?></td>
+ <td><?php echo is_null($tasklist->get('owner')) ? _("System") : _("Local") ?></td>
<td><?php $url = Horde_Util::addParameter($display_url_base, 'display_cal', $tasklist->getName(), false); echo Horde::link($url, _("Click or copy this URL to display this task list"), '', '_blank') . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
<td><?php $url = $subscribe_url_base . ($tasklist->get('owner') ? $tasklist->get('owner') : '-system-') . '/' . $tasklist->getName() . '.ics'; echo Horde::link($url, _("Click or copy this URL to display this task list"), '', '_blank') . htmlspecialchars(shorten_url($url)) . '</a>' ?></td>
<td><?php echo Horde::link(Horde_Util::addParameter($edit_url_base, 't', $tasklist->getName()), _("Edit")) . $edit_img . '</a>' ?></td>