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) {
|
if (rcmail.gui_objects.devicelist) {
|
||||||
var devicelist = new rcube_list_widget(rcmail.gui_objects.devicelist,
|
var devicelist = new rcube_list_widget(rcmail.gui_objects.devicelist,
|
||||||
{ multiselect:true, draggable:false, keyboard:true });
|
{ 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
|
// load frame if there are no devices
|
||||||
if (!rcmail.env.devicecount)
|
if (!rcmail.env.devicecount)
|
||||||
|
@ -72,7 +80,9 @@ function kolab_activesync_config()
|
||||||
{
|
{
|
||||||
active_device = list.get_single_selection();
|
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);
|
device_select(active_device);
|
||||||
else if (rcmail.env.contentframe)
|
else if (rcmail.env.contentframe)
|
||||||
rcmail.show_contentframe(false);
|
rcmail.show_contentframe(false);
|
||||||
|
@ -139,16 +149,25 @@ function kolab_activesync_config()
|
||||||
if (p.success && p.id && p['delete']) {
|
if (p.success && p.id && p['delete']) {
|
||||||
active_device = null;
|
active_device = null;
|
||||||
device_select();
|
device_select();
|
||||||
|
|
||||||
|
if (p.id == 'ALL')
|
||||||
|
devicelist.clear();
|
||||||
|
else
|
||||||
devicelist.remove_row(p.id);
|
devicelist.remove_row(p.id);
|
||||||
|
|
||||||
|
rcmail.triggerEvent('listupdate', {list: devicelist, rowcount: devicelist.rowcount});
|
||||||
rcmail.enable_command('plugin.delete-device', false);
|
rcmail.enable_command('plugin.delete-device', false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// handler for delete commands
|
// handler for delete commands
|
||||||
function delete_device_config()
|
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');
|
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;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$success = $this->device_delete($imei);
|
foreach ((array) $imei as $id) {
|
||||||
|
$success = $this->device_delete($id);
|
||||||
|
}
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$this->rc->output->show_message($this->gettext('successfullydeleted'), 'confirmation');
|
$this->rc->output->show_message($this->gettext('successfullydeleted'), 'confirmation');
|
||||||
$this->rc->output->command('plugin.activesync_save_complete', array(
|
$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
|
else
|
||||||
$this->rc->output->show_message($this->gettext('savingerror'), 'error');
|
$this->rc->output->show_message($this->gettext('savingerror'), 'error');
|
||||||
|
|
|
@ -13,11 +13,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="scroller">
|
<div class="scroller">
|
||||||
<roundcube:object name="plugin.devicelist" id="devices-table" class="listing"
|
<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>
|
||||||
<!--
|
|
||||||
<div class="footer"></div>
|
|
||||||
-->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- device info frame -->
|
<!-- device info frame -->
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#devices-table {
|
#devices-table {
|
||||||
td:before {
|
td:not(.selection) {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
&:before {
|
||||||
&:extend(.font-icon-class);
|
&:extend(.font-icon-class);
|
||||||
content: @fa-var-rss-square; // TODO: mobile icon is not free
|
content: @fa-var-rss-square; // TODO: mobile icon is not free
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
span {
|
span {
|
||||||
.overflow-ellipsis;
|
.overflow-ellipsis;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue