Use folder namespace for grouping in client-side treelist

This commit is contained in:
Thomas Bruederli 2014-05-15 17:20:58 +02:00
parent 857078428b
commit b415c512f0
8 changed files with 28 additions and 21 deletions

View file

@ -138,7 +138,7 @@ class database_driver extends calendar_driver
'color' => $prefs['color'], 'color' => $prefs['color'],
'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'), 'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'),
'active' => !in_array($id, $hidden), 'active' => !in_array($id, $hidden),
'class_name' => 'birthdays', 'group' => 'birthdays',
'readonly' => true, 'readonly' => true,
'default' => false, 'default' => false,
'children' => false, 'children' => false,

View file

@ -149,7 +149,8 @@ class kolab_driver extends calendar_driver
'owner' => $cal->get_owner(), 'owner' => $cal->get_owner(),
'virtual' => false, 'virtual' => false,
'readonly' => true, 'readonly' => true,
'class_name' => 'user', 'group' => 'other',
'class' => 'user',
); );
} }
else if ($cal->virtual) { else if ($cal->virtual) {
@ -160,6 +161,8 @@ class kolab_driver extends calendar_driver
'editname' => $cal->get_foldername(), 'editname' => $cal->get_foldername(),
'virtual' => true, 'virtual' => true,
'readonly' => true, 'readonly' => true,
'group' => $cal->get_namespace(),
'class' => 'folder',
); );
} }
else { else {
@ -171,7 +174,7 @@ class kolab_driver extends calendar_driver
'color' => $cal->get_color(), 'color' => $cal->get_color(),
'readonly' => $cal->readonly, 'readonly' => $cal->readonly,
'showalarms' => $cal->alarms, 'showalarms' => $cal->alarms,
'class_name' => $cal->get_namespace(), 'group' => $cal->get_namespace(),
'default' => $cal->default, 'default' => $cal->default,
'active' => $cal->is_active(), 'active' => $cal->is_active(),
'owner' => $cal->get_owner(), 'owner' => $cal->get_owner(),
@ -198,7 +201,7 @@ class kolab_driver extends calendar_driver
'color' => $prefs[$id]['color'], 'color' => $prefs[$id]['color'],
'active' => $prefs[$id]['active'], 'active' => $prefs[$id]['active'],
'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'), 'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'),
'class_name' => 'birthdays', 'group' => 'birthdays',
'readonly' => true, 'readonly' => true,
'default' => false, 'default' => false,
'children' => false, 'children' => false,

View file

@ -56,6 +56,7 @@ class kolab_user_calendar extends kolab_calendar
$this->id = kolab_storage::folder_id($this->userdata['kolabtargetfolder'], true); $this->id = kolab_storage::folder_id($this->userdata['kolabtargetfolder'], true);
$this->imap_folder = $this->userdata['kolabtargetfolder']; $this->imap_folder = $this->userdata['kolabtargetfolder'];
$this->name = $this->storage->get_name(); $this->name = $this->storage->get_name();
$this->parent = ''; // user calendars are top level
// user-specific alarms settings win // user-specific alarms settings win
$prefs = $this->cal->rc->config->get('kolab_calendars', array()); $prefs = $this->cal->rc->config->get('kolab_calendars', array());
@ -94,7 +95,7 @@ class kolab_user_calendar extends kolab_calendar
*/ */
public function get_namespace() public function get_namespace()
{ {
return 'user'; return 'other user';
} }

View file

@ -229,7 +229,7 @@ class calendar_ui
if ($attrib['activeonly'] && !$prop['active']) if ($attrib['activeonly'] && !$prop['active'])
continue; continue;
$html .= html::tag('li', array('id' => 'rcmlical' . $id), $html .= html::tag('li', array('id' => 'rcmlical' . $id, 'class' => $prop['group']),
$content = $this->calendar_list_item($id, $prop, $jsenv) $content = $this->calendar_list_item($id, $prop, $jsenv)
); );
} }
@ -260,7 +260,7 @@ class calendar_ui
if (strlen($content)) { if (strlen($content)) {
$out .= html::tag('li', array( $out .= html::tag('li', array(
'id' => 'rcmlical' . rcube_utils::html_identifier($id), 'id' => 'rcmlical' . rcube_utils::html_identifier($id),
'class' => $prop['virtual'] ? 'virtual' : '', 'class' => $prop['group'] . ($prop['virtual'] ? ' virtual' : ''),
), ),
$content); $content);
} }
@ -287,23 +287,23 @@ class calendar_ui
$jsenv[$id] = $prop; $jsenv[$id] = $prop;
} }
$class = 'calendar cal-' . asciiwords($id, true); $classes = array('calendar', 'cal-' . asciiwords($id, true));
$title = $prop['name'] != $prop['listname'] || strlen($prop['name']) > 25 ? $title = $prop['name'] != $prop['listname'] || strlen($prop['name']) > 25 ?
html_entity_decode($prop['name'], ENT_COMPAT, RCMAIL_CHARSET) : ''; html_entity_decode($prop['name'], ENT_COMPAT, RCMAIL_CHARSET) : '';
$is_collapsed = false; // TODO: determine this somehow? $is_collapsed = false; // TODO: determine this somehow?
if ($prop['virtual']) if ($prop['virtual'])
$class = 'folder virtual'; $classes[] = 'virtual';
else if ($prop['readonly']) else if ($prop['readonly'])
$class .= ' readonly'; $classes[] = 'readonly';
if ($prop['subscribed']) if ($prop['subscribed'])
$class .= ' subscribed'; $classes[] = ' subscribed';
if ($prop['class_name']) if ($prop['class'])
$class .= ' '.$prop['class_name']; $classes[] = $prop['class'];
$content = ''; $content = '';
if (!$attrib['activeonly'] || $prop['active']) { if (!$attrib['activeonly'] || $prop['active']) {
$content = html::div($class, $content = html::div(join(' ', $classes),
html::span(array('class' => 'calname', 'title' => $title), $prop['editname'] ? Q($prop['editname']) : $prop['listname']) . html::span(array('class' => 'calname', 'title' => $title), $prop['editname'] ? Q($prop['editname']) : $prop['listname']) .
($prop['virtual'] ? '' : ($prop['virtual'] ? '' :
html::tag('input', array('type' => 'checkbox', 'name' => '_cal[]', 'value' => $id, 'checked' => $prop['active']), '') . html::tag('input', array('type' => 'checkbox', 'name' => '_cal[]', 'value' => $id, 'checked' => $prop['active']), '') .

View file

@ -86,8 +86,9 @@ $labels['nmonthsback'] = '$nr months back';
$labels['showurl'] = 'Show calendar URL'; $labels['showurl'] = 'Show calendar URL';
$labels['showurldescription'] = 'Use the following address to access (read only) your calendar from other applications. You can copy and paste this into any calendar software that supports the iCal format.'; $labels['showurldescription'] = 'Use the following address to access (read only) your calendar from other applications. You can copy and paste this into any calendar software that supports the iCal format.';
$labels['caldavurldescription'] = 'Copy this address to a <a href="http://en.wikipedia.org/wiki/CalDAV" target="_blank">CalDAV</a> client application (e.g. Evolution or Mozilla Thunderbird) to fully synchronize this specific calendar with your computer or mobile device.'; $labels['caldavurldescription'] = 'Copy this address to a <a href="http://en.wikipedia.org/wiki/CalDAV" target="_blank">CalDAV</a> client application (e.g. Evolution or Mozilla Thunderbird) to fully synchronize this specific calendar with your computer or mobile device.';
$labels['findcalendars'] = 'Find calendars...';
$labels['calsearchresults'] = 'Available Calendars'; $labels['calsearchresults'] = 'Available Calendars';
$labels['calendarsubscribe'] = 'Listed permanently'; $labels['calendarsubscribe'] = 'List permanently';
// agenda view // agenda view
$labels['listrange'] = 'Range to display:'; $labels['listrange'] = 'Range to display:';

View file

@ -293,7 +293,7 @@ pre {
background-position: right -20px; background-position: right -20px;
} }
#calendars .treelist div.user span.calname { #calendars .treelist li.user > div > span.calname {
background-position: right -38px; background-position: right -38px;
} }
/* /*

View file

@ -25,7 +25,7 @@
<h2 class="boxtitle"><roundcube:label name="calendar.calendars" /></h2> <h2 class="boxtitle"><roundcube:label name="calendar.calendars" /></h2>
<div class="listsearchbox"> <div class="listsearchbox">
<div class="searchbox"> <div class="searchbox">
<input type="text" name="q" id="calendarlistsearch" /> <input type="text" name="q" id="calendarlistsearch" placeholder="<roundcube:label name='calendar.findcalendars' />" />
<a class="iconbutton searchicon"></a> <a class="iconbutton searchicon"></a>
<roundcube:button command="reset-listsearch" id="calendarlistsearch-reset" class="iconbutton reset" title="resetsearch" content="x" /> <roundcube:button command="reset-listsearch" id="calendarlistsearch-reset" class="iconbutton reset" title="resetsearch" content="x" />
</div> </div>

View file

@ -49,10 +49,12 @@ function kolab_folderlist(node, p)
.html(p.search_title ? '<h2 class="boxtitle">' + p.search_title + '</h2>' : '') .html(p.search_title ? '<h2 class="boxtitle">' + p.search_title + '</h2>' : '')
.insertAfter(me.container); .insertAfter(me.container);
search_results_widget = new rcube_treelist_widget('<ul class="treelist listing"></ul>', { search_results_widget = new rcube_treelist_widget('<ul>', {
id_prefix: p.id_prefix, id_prefix: p.id_prefix,
selectable: false selectable: false
}); });
// copy classes from main list
search_results_widget.container.addClass(me.container.attr('class'));
// register click handler on search result's checkboxes to select the given item for listing // register click handler on search result's checkboxes to select the given item for listing
search_results_widget.container search_results_widget.container
@ -94,7 +96,7 @@ function kolab_folderlist(node, p)
search_results[prop.id] = prop; search_results[prop.id] = prop;
search_results_widget.insert({ search_results_widget.insert({
id: prop.id, id: prop.id,
classes: prop.class_name ? String(prop.class_name).split(' ') : [], classes: [ prop.group || '' ],
html: item, html: item,
collapsed: true collapsed: true
}, prop.parent); }, prop.parent);
@ -142,10 +144,10 @@ function kolab_folderlist(node, p)
// move this result item to the main list widget // move this result item to the main list widget
me.insert({ me.insert({
id: id, id: id,
classes: [], classes: [ prop.group || '' ],
virtual: prop.virtual, virtual: prop.virtual,
html: dom_node, html: dom_node,
}, parent_id, parent_id ? true : false); }, parent_id, prop.group);
} }
delete prop.html; delete prop.html;