Include sharing (acl) tab in task list edit dialog
This commit is contained in:
parent
b30c2124eb
commit
f6f7b710b3
11 changed files with 242 additions and 56 deletions
|
@ -50,6 +50,8 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
if (kolab_storage::$version == '2.0') {
|
||||
$this->alarm_absolute = false;
|
||||
}
|
||||
|
||||
$this->plugin->register_action('folder-acl', array($this, 'folder_acl'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -863,21 +865,132 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public function tasklist_edit_form($fieldprop)
|
||||
public function tasklist_edit_form($action, $list, $fieldprop)
|
||||
{
|
||||
$select = kolab_storage::folder_selector('task', array('name' => 'parent', 'id' => 'taskedit-parentfolder'), null);
|
||||
$fieldprop['parent'] = array(
|
||||
'id' => 'taskedit-parentfolder',
|
||||
'label' => $this->plugin->gettext('parentfolder'),
|
||||
'value' => $select->show(''),
|
||||
);
|
||||
|
||||
$formfields = array();
|
||||
foreach (array('name','parent','showalarms') as $f) {
|
||||
$formfields[$f] = $fieldprop[$f];
|
||||
if ($list['id'] && ($list = $this->lists[$list['id']])) {
|
||||
$folder_name = $this->folders[$list['id']]->name; // UTF7
|
||||
}
|
||||
else {
|
||||
$folder_name = '';
|
||||
}
|
||||
|
||||
return parent::tasklist_edit_form($formfields);
|
||||
$storage = $this->rc->get_storage();
|
||||
$delim = $storage->get_hierarchy_delimiter();
|
||||
$form = array();
|
||||
|
||||
if (strlen($folder_name)) {
|
||||
$path_imap = explode($delim, $folder_name);
|
||||
array_pop($path_imap); // pop off name part
|
||||
$path_imap = implode($path_imap, $delim);
|
||||
|
||||
$options = $storage->folder_info($folder_name);
|
||||
}
|
||||
else {
|
||||
$path_imap = '';
|
||||
}
|
||||
|
||||
$hidden_fields[] = array('name' => 'oldname', 'value' => $folder_name);
|
||||
|
||||
// folder name (default field)
|
||||
$input_name = new html_inputfield(array('name' => 'name', 'id' => 'taskedit-tasklistame', 'size' => 20));
|
||||
$fieldprop['name']['value'] = $input_name->show($list['editname'], array('disabled' => ($options['norename'] || $options['protected'])));
|
||||
|
||||
// prevent user from moving folder
|
||||
if (!empty($options) && ($options['norename'] || $options['protected'])) {
|
||||
$hidden_fields[] = array('name' => 'parent', 'value' => $path_imap);
|
||||
}
|
||||
else {
|
||||
$select = kolab_storage::folder_selector('task', array('name' => 'parent', 'id' => 'taskedit-parentfolder'), $folder_name);
|
||||
$fieldprop['parent'] = array(
|
||||
'id' => 'taskedit-parentfolder',
|
||||
'label' => $this->plugin->gettext('parentfolder'),
|
||||
'value' => $select->show($path_imap),
|
||||
);
|
||||
}
|
||||
|
||||
// General tab
|
||||
$form['properties'] = array(
|
||||
'name' => $this->rc->gettext('properties'),
|
||||
'fields' => array(),
|
||||
);
|
||||
|
||||
foreach (array('name','parent','showalarms') as $f) {
|
||||
$form['properties']['fields'][$f] = $fieldprop[$f];
|
||||
}
|
||||
|
||||
// add folder ACL tab
|
||||
if ($action != 'form-new') {
|
||||
$form['sharing'] = array(
|
||||
'name' => Q($this->plugin->gettext('tabsharing')),
|
||||
'content' => html::tag('iframe', array(
|
||||
'src' => $this->rc->url(array('_action' => 'folder-acl', '_folder' => $folder_name, 'framed' => 1)),
|
||||
'width' => '100%',
|
||||
'height' => 280,
|
||||
'border' => 0,
|
||||
'style' => 'border:0'),
|
||||
'')
|
||||
);
|
||||
}
|
||||
|
||||
$form_html = '';
|
||||
if (is_array($hidden_fields)) {
|
||||
foreach ($hidden_fields as $field) {
|
||||
$hiddenfield = new html_hiddenfield($field);
|
||||
$form_html .= $hiddenfield->show() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// create form output
|
||||
foreach ($form as $tab) {
|
||||
if (is_array($tab['fields']) && empty($tab['content'])) {
|
||||
$table = new html_table(array('cols' => 2));
|
||||
foreach ($tab['fields'] as $col => $colprop) {
|
||||
$colprop['id'] = '_'.$col;
|
||||
$label = !empty($colprop['label']) ? $colprop['label'] : $this->plugin->gettext($col);
|
||||
|
||||
$table->add('title', html::label($colprop['id'], Q($label)));
|
||||
$table->add(null, $colprop['value']);
|
||||
}
|
||||
$content = $table->show();
|
||||
}
|
||||
else {
|
||||
$content = $tab['content'];
|
||||
}
|
||||
|
||||
if (!empty($content)) {
|
||||
$form_html .= html::tag('fieldset', null, html::tag('legend', null, Q($tab['name'])) . $content) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $form_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler to render ACL form for a notes folder
|
||||
*/
|
||||
public function folder_acl()
|
||||
{
|
||||
$this->plugin->require_plugin('acl');
|
||||
$this->rc->output->add_handler('folderacl', array($this, 'folder_acl_form'));
|
||||
$this->rc->output->send('tasklist.kolabacl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for ACL form template object
|
||||
*/
|
||||
public function folder_acl_form()
|
||||
{
|
||||
$folder = rcube_utils::get_input_value('_folder', RCUBE_INPUT_GPC);
|
||||
|
||||
if (strlen($folder)) {
|
||||
$storage = $this->rc->get_storage();
|
||||
$options = $storage->folder_info($folder);
|
||||
|
||||
// get sharing UI from acl plugin
|
||||
$acl = $this->rc->plugins->exec_hook('folder_form',
|
||||
array('form' => array(), 'options' => $options, 'name' => $folder));
|
||||
}
|
||||
|
||||
return $acl['form']['sharing']['content'] ?: html::div('hint', $this->plugin->gettext('aclnorights'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,10 +260,12 @@ abstract class tasklist_driver
|
|||
* Build the edit/create form for lists.
|
||||
* This gives the drivers the opportunity to add more list properties
|
||||
*
|
||||
* @param array List with form fields to be rendered
|
||||
* @param string The action called this form
|
||||
* @param array Tasklist properties
|
||||
* @param array List with form fields to be rendered
|
||||
* @return string HTML content of the form
|
||||
*/
|
||||
public function tasklist_edit_form($formfields)
|
||||
public function tasklist_edit_form($action, $list, $formfields)
|
||||
{
|
||||
$html = '';
|
||||
foreach ($formfields as $field) {
|
||||
|
|
|
@ -54,3 +54,4 @@ $labels['invalidstartduedates'] = 'Beginn der Aufgabe darf nicht grösser als da
|
|||
$labels['deletetasktconfirm'] = 'Möchten Sie diese Aufgabe wirklich löschen?';
|
||||
$labels['deleteparenttasktconfirm'] = 'Möchten Sie diese Aufgabe inklusive aller Teilaufgaben wirklich löschen?';
|
||||
$labels['deletelistconfirm'] = 'Möchten Sie diese Liste mit allen Aufgaben wirklich löschen?';
|
||||
$labels['aclnorights'] = 'Der Zugriff auf diese Liste erfordert Administrator-Rechte.';
|
||||
|
|
|
@ -53,3 +53,4 @@ $labels['invalidstartduedates'] = 'Das Anfangsdatum muss vor dem Fälligkeitsdat
|
|||
$labels['deletetasktconfirm'] = 'Diese Aufgabe wirklich löschen?';
|
||||
$labels['deleteparenttasktconfirm'] = 'Diese Aufgabe wirklich mit allen Teilaufgaben löschen?';
|
||||
$labels['deletelistconfirm'] = 'Diese Aufgabenliste wirklich mit allen Aufgaben löschen?';
|
||||
$labels['aclnorights'] = 'Der Zugriff auf diese Liste erfordert Administrator-Rechte.';
|
||||
|
|
|
@ -69,3 +69,4 @@ $labels['deletetasktconfirm'] = 'Do you really want to delete this task?';
|
|||
$labels['deleteparenttasktconfirm'] = 'Do you really want to delete this task and all its subtasks?';
|
||||
$labels['deletelistconfirm'] = 'Do you really want to delete this list with all its tasks?';
|
||||
$labels['deletelistconfirmrecursive'] = 'Do you really want to delete this list with all its sub-lists and tasks?';
|
||||
$labels['aclnorights'] = 'You do not have administrator rights on this task list.';
|
||||
|
|
|
@ -834,6 +834,23 @@ label.block {
|
|||
outline: none;
|
||||
}
|
||||
|
||||
.tasklistview .uidialog .tabbed {
|
||||
margin: -12px -8px 0 -8px;
|
||||
min-width: 600px;
|
||||
}
|
||||
|
||||
.tasklistview .uidialog .propform fieldset.tab {
|
||||
display: block;
|
||||
background: #efefef;
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em 1em;
|
||||
min-height: 290px;
|
||||
}
|
||||
|
||||
.tasklistview .uidialog .propform #taskedit-tasklistame {
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Styles of the tagedit inputsforms
|
||||
|
|
26
plugins/tasklist/skins/larry/templates/kolabacl.html
Normal file
26
plugins/tasklist/skins/larry/templates/kolabacl.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<roundcube:object name="doctype" value="html5" />
|
||||
<html>
|
||||
<head>
|
||||
<title><roundcube:object name="pagetitle" /></title>
|
||||
<roundcube:include file="/includes/links.html" />
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
body.aclform {
|
||||
background: #efefef;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body.aclform .hint {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body class="iframe aclform">
|
||||
|
||||
<roundcube:object name="folderacl" />
|
||||
|
||||
<roundcube:include file="/includes/footer.html" />
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -146,7 +146,8 @@
|
|||
<roundcube:include file="/templates/taskedit.html" />
|
||||
|
||||
<div id="tasklistform" class="uidialog">
|
||||
<roundcube:object name="plugin.tasklist_editform" />
|
||||
<roundcube:label name="loading" />
|
||||
<roundcube:container name="tasklistform" id="tasklistform" />
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -156,6 +157,12 @@ var UI = new rcube_mail_ui();
|
|||
|
||||
$(document).ready(function(e){
|
||||
UI.init();
|
||||
|
||||
rcmail.addEventListener('tasklist_editform_load', function(e){
|
||||
if (rcmail.env.tasklist_driver == 'kolab')
|
||||
UI.init_tabs($('#tasklistform > form').addClass('propform tabbed'));
|
||||
});
|
||||
|
||||
new rcube_splitter({ id:'taskviewsplitter', p1:'#sidebar', p2:'#mainview-right',
|
||||
orientation:'v', relative:true, start:240, min:180, size:16, offset:2 }).init();
|
||||
new rcube_splitter({ id:'taskviewsplitterv', p1:'#tagsbox', p2:'#tasklistsbox',
|
||||
|
|
|
@ -1618,8 +1618,7 @@ function rcube_tasklist_ui(settings)
|
|||
function list_edit_dialog(id)
|
||||
{
|
||||
var list = me.tasklists[id],
|
||||
$dialog = $('#tasklistform');
|
||||
editform = $('#tasklisteditform');
|
||||
$dialog = $(rcmail.gui_containers.tasklistform);
|
||||
|
||||
if ($dialog.is(':ui-dialog'))
|
||||
$dialog.dialog('close');
|
||||
|
@ -1627,55 +1626,70 @@ function rcube_tasklist_ui(settings)
|
|||
if (!list)
|
||||
list = { name:'', editable:true, showalarms:true };
|
||||
|
||||
// fill edit form
|
||||
var name = $('#taskedit-tasklistame').prop('disabled', list.norename||false).val(list.editname || list.name),
|
||||
alarms = $('#taskedit-showalarms').prop('checked', list.showalarms).get(0),
|
||||
parent = $('#taskedit-parentfolder').val(list.parentfolder);
|
||||
var editform, name, alarms;
|
||||
|
||||
$dialog.html(rcmail.get_label('loading'));
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
dataType: 'html',
|
||||
url: rcmail.url('tasklist'),
|
||||
data: { action:(list.id ? 'form-edit' : 'form-new'), l:{ id:list.id } },
|
||||
success: function(data) {
|
||||
$dialog.html(data);
|
||||
rcmail.triggerEvent('tasklist_editform_load', list);
|
||||
|
||||
// resize and reposition dialog window
|
||||
editform = $('#tasklisteditform');
|
||||
me.dialog_resize(rcmail.gui_containers.tasklistform, editform.height(), editform.width());
|
||||
|
||||
name = $('#taskedit-tasklistame').prop('disabled', list.norename||false).val(list.editname || list.name);
|
||||
alarms = $('#taskedit-showalarms').prop('checked', list.showalarms).get(0);
|
||||
name.select();
|
||||
}
|
||||
});
|
||||
|
||||
// dialog buttons
|
||||
var buttons = {};
|
||||
|
||||
buttons[rcmail.gettext('save','tasklist')] = function() {
|
||||
// do some input validation
|
||||
if (!name.val() || name.val().length < 2) {
|
||||
alert(rcmail.gettext('invalidlistproperties', 'tasklist'));
|
||||
name.select();
|
||||
return;
|
||||
}
|
||||
// do some input validation
|
||||
if (!name.val() || name.val().length < 2) {
|
||||
alert(rcmail.gettext('invalidlistproperties', 'tasklist'));
|
||||
name.select();
|
||||
return;
|
||||
}
|
||||
|
||||
// post data to server
|
||||
var data = editform.serializeJSON();
|
||||
if (list.id)
|
||||
data.id = list.id;
|
||||
if (alarms)
|
||||
data.showalarms = alarms.checked ? 1 : 0;
|
||||
if (parent.length)
|
||||
data.parentfolder = $('option:selected', parent).val();
|
||||
// post data to server
|
||||
var data = editform.serializeJSON();
|
||||
if (list.id)
|
||||
data.id = list.id;
|
||||
if (alarms)
|
||||
data.showalarms = alarms.checked ? 1 : 0;
|
||||
|
||||
saving_lock = rcmail.set_busy(true, 'tasklist.savingdata');
|
||||
rcmail.http_post('tasklist', { action:(list.id ? 'edit' : 'new'), l:data });
|
||||
$dialog.dialog('close');
|
||||
saving_lock = rcmail.set_busy(true, 'tasklist.savingdata');
|
||||
rcmail.http_post('tasklist', { action:(list.id ? 'edit' : 'new'), l:data });
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
buttons[rcmail.gettext('cancel','tasklist')] = function() {
|
||||
$dialog.dialog('close');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
// open jquery UI dialog
|
||||
$dialog.dialog({
|
||||
modal: true,
|
||||
resizable: true,
|
||||
closeOnEscape: false,
|
||||
title: rcmail.gettext((list.id ? 'editlist' : 'createlist'), 'tasklist'),
|
||||
open: function() {
|
||||
$dialog.parent().find('.ui-dialog-buttonset .ui-button').first().addClass('mainaction');
|
||||
},
|
||||
close: function() {
|
||||
$dialog.dialog('destroy').hide();
|
||||
},
|
||||
buttons: buttons,
|
||||
minWidth: 400,
|
||||
width: 420
|
||||
modal: true,
|
||||
resizable: true,
|
||||
closeOnEscape: false,
|
||||
title: rcmail.gettext((list.id ? 'editlist' : 'createlist'), 'tasklist'),
|
||||
open: function() {
|
||||
$dialog.parent().find('.ui-dialog-buttonset .ui-button').first().addClass('mainaction');
|
||||
},
|
||||
close: function() {
|
||||
$dialog.dialog('destroy').hide();
|
||||
},
|
||||
buttons: buttons,
|
||||
minWidth: 400,
|
||||
width: 420
|
||||
}).show();
|
||||
}
|
||||
|
||||
|
|
|
@ -478,13 +478,18 @@ class tasklist extends rcube_plugin
|
|||
public function tasklist_action()
|
||||
{
|
||||
$action = get_input_value('action', RCUBE_INPUT_GPC);
|
||||
$list = get_input_value('l', RCUBE_INPUT_POST, true);
|
||||
$list = get_input_value('l', RCUBE_INPUT_GPC, true);
|
||||
$success = false;
|
||||
|
||||
if (isset($list['showalarms']))
|
||||
$list['showalarms'] = intval($list['showalarms']);
|
||||
|
||||
switch ($action) {
|
||||
case 'form-new':
|
||||
case 'form-edit':
|
||||
echo $this->ui->tasklist_editform($action, $list);
|
||||
exit;
|
||||
|
||||
case 'new':
|
||||
$list += array('showalarms' => true, 'active' => true, 'editable' => true);
|
||||
if ($insert_id = $this->driver->create_list($list)) {
|
||||
|
|
|
@ -70,7 +70,6 @@ class tasklist_ui
|
|||
$this->plugin->register_handler('plugin.category_select', array($this, 'category_select'));
|
||||
$this->plugin->register_handler('plugin.searchform', array($this->rc->output, 'search_form'));
|
||||
$this->plugin->register_handler('plugin.quickaddform', array($this, 'quickadd_form'));
|
||||
$this->plugin->register_handler('plugin.tasklist_editform', array($this, 'tasklist_editform'));
|
||||
$this->plugin->register_handler('plugin.tasks', array($this, 'tasks_resultview'));
|
||||
$this->plugin->register_handler('plugin.tagslist', array($this, 'tagslist'));
|
||||
$this->plugin->register_handler('plugin.tags_editline', array($this, 'tags_editline'));
|
||||
|
@ -146,7 +145,7 @@ class tasklist_ui
|
|||
}
|
||||
|
||||
|
||||
function tasklist_editform($attrib = array())
|
||||
function tasklist_editform($action, $list = array())
|
||||
{
|
||||
$fields = array(
|
||||
'name' => array(
|
||||
|
@ -169,7 +168,7 @@ class tasklist_ui
|
|||
);
|
||||
|
||||
return html::tag('form', array('action' => "#", 'method' => "post", 'id' => 'tasklisteditform'),
|
||||
$this->plugin->driver->tasklist_edit_form($fields)
|
||||
$this->plugin->driver->tasklist_edit_form($action, $list, $fields)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue