Elastic: Multi-selection on ActiveSync devices list
This commit is contained in:
parent
9124f11081
commit
a8f8eca470
4 changed files with 38 additions and 17 deletions
|
@ -35,7 +35,15 @@ function kolab_activesync_config()
|
|||
if (rcmail.gui_objects.devicelist) {
|
||||
var devicelist = new rcube_list_widget(rcmail.gui_objects.devicelist,
|
||||
{ multiselect:true, draggable:false, keyboard:true });
|
||||
devicelist.addEventListener('select', select_device).init().focus();
|
||||
|
||||
devicelist.addEventListener('select', select_device)
|
||||
.init()
|
||||
.focus();
|
||||
|
||||
rcmail.devicelist = devicelist;
|
||||
setTimeout(function() {
|
||||
rcmail.triggerEvent('listupdate', {list: devicelist, rowcount: devicelist.rowcount});
|
||||
}, 100);
|
||||
|
||||
// load frame if there are no devices
|
||||
if (!rcmail.env.devicecount)
|
||||
|
@ -72,7 +80,9 @@ function kolab_activesync_config()
|
|||
{
|
||||
active_device = list.get_single_selection();
|
||||
|
||||
if (active_device)
|
||||
rcmail.enable_command('plugin.delete-device', list.get_selection().length > 0);
|
||||
|
||||
if (active_device && !list.multi_selecting)
|
||||
device_select(active_device);
|
||||
else if (rcmail.env.contentframe)
|
||||
rcmail.show_contentframe(false);
|
||||
|
@ -139,16 +149,25 @@ function kolab_activesync_config()
|
|||
if (p.success && p.id && p['delete']) {
|
||||
active_device = null;
|
||||
device_select();
|
||||
devicelist.remove_row(p.id);
|
||||
|
||||
if (p.id == 'ALL')
|
||||
devicelist.clear();
|
||||
else
|
||||
devicelist.remove_row(p.id);
|
||||
|
||||
rcmail.triggerEvent('listupdate', {list: devicelist, rowcount: devicelist.rowcount});
|
||||
rcmail.enable_command('plugin.delete-device', false);
|
||||
}
|
||||
};
|
||||
|
||||
// handler for delete commands
|
||||
function delete_device_config()
|
||||
{
|
||||
if (active_device && confirm(rcmail.gettext('devicedeleteconfirm', 'kolab_activesync'))) {
|
||||
var selection = devicelist.get_selection();
|
||||
|
||||
if (selection.length && confirm(rcmail.gettext('devicedeleteconfirm', 'kolab_activesync'))) {
|
||||
http_lock = rcmail.set_busy(true, 'kolab_activesync.savingdata');
|
||||
rcmail.http_post('plugin.activesync-json', { cmd:'delete', id:active_device }, http_lock);
|
||||
rcmail.http_post('plugin.activesync-json', { cmd:'delete', id:selection }, http_lock);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -159,12 +159,17 @@ class kolab_activesync extends rcube_plugin
|
|||
break;
|
||||
|
||||
case 'delete':
|
||||
$success = $this->device_delete($imei);
|
||||
foreach ((array) $imei as $id) {
|
||||
$success = $this->device_delete($id);
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
$this->rc->output->show_message($this->gettext('successfullydeleted'), 'confirmation');
|
||||
$this->rc->output->command('plugin.activesync_save_complete', array(
|
||||
'success' => true, 'id' => $imei, 'delete' => true));
|
||||
'success' => true,
|
||||
'delete' => true,
|
||||
'id' => count($imei) > 1 ? 'ALL' : $imei[0],
|
||||
));
|
||||
}
|
||||
else
|
||||
$this->rc->output->show_message($this->gettext('savingerror'), 'error');
|
||||
|
|
|
@ -13,11 +13,8 @@
|
|||
</div>
|
||||
<div class="scroller">
|
||||
<roundcube:object name="plugin.devicelist" id="devices-table" class="listing"
|
||||
data-label-msg="listempty" role="listbox" />
|
||||
data-label-msg="listempty" role="listbox" data-list="devicelist" />
|
||||
</div>
|
||||
<!--
|
||||
<div class="footer"></div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<!-- device info frame -->
|
||||
|
|
|
@ -28,14 +28,14 @@
|
|||
}
|
||||
|
||||
#devices-table {
|
||||
td:before {
|
||||
&:extend(.font-icon-class);
|
||||
content: @fa-var-rss-square; // TODO: mobile icon is not free
|
||||
}
|
||||
|
||||
td {
|
||||
td:not(.selection) {
|
||||
display: flex;
|
||||
|
||||
&:before {
|
||||
&:extend(.font-icon-class);
|
||||
content: @fa-var-rss-square; // TODO: mobile icon is not free
|
||||
}
|
||||
|
||||
span {
|
||||
.overflow-ellipsis;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue