summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-08-12 10:25:14 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-08-12 10:25:46 (GMT)
commitfc2db9a8408c23ca8ac8e5640f7fc19354ec798f (patch)
treebb8d17091b30d3512f072ed1b3943ac7ad4ed95e
parent34f0891feab4c93d8543957d4966382a17c8259a (diff)
downloadroundcubemail-plugins-kolab-fc2db9a8408c23ca8ac8e5640f7fc19354ec798f.tar.gz
Fix random tags being created for tasks saved from mail (#3291): gui objects are not registered in the client and therefore tags are read from all hidden fields found in the document
-rw-r--r--plugins/tasklist/tasklist.php11
-rw-r--r--plugins/tasklist/tasklist_ui.php33
2 files changed, 35 insertions, 9 deletions
diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php
index dfd8bd9..35c59ee 100644
--- a/plugins/tasklist/tasklist.php
+++ b/plugins/tasklist/tasklist.php
@@ -1172,10 +1172,17 @@ class tasklist extends rcube_plugin
$this->ui->init_templates();
echo $this->api->output->parse('tasklist.taskedit', false, false);
+
+ $script_add = '';
+ foreach ($this->ui->get_gui_objects() as $obj => $id) {
+ $script_add .= rcmail_output::JS_OBJECT_NAME . ".gui_object('$obj', '$id');\n";
+ }
+
echo html::tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $this->url($this->local_skin_path() . '/tagedit.css'), 'nl' => true));
echo html::tag('script', array('type' => 'text/javascript'),
- "rcmail.set_env(" . json_encode($env) . ");\n".
- "rcmail.add_label(" . json_encode($texts) . ");\n"
+ rcmail_output::JS_OBJECT_NAME . ".set_env(" . json_encode($env) . ");\n".
+ rcmail_output::JS_OBJECT_NAME . ".add_label(" . json_encode($texts) . ");\n".
+ $script_add
);
exit;
}
diff --git a/plugins/tasklist/tasklist_ui.php b/plugins/tasklist/tasklist_ui.php
index 7d8f513..66ff799 100644
--- a/plugins/tasklist/tasklist_ui.php
+++ b/plugins/tasklist/tasklist_ui.php
@@ -27,6 +27,7 @@ class tasklist_ui
private $rc;
private $plugin;
private $ready = false;
+ private $gui_objects = array();
function __construct($plugin)
{
@@ -175,7 +176,7 @@ class tasklist_ui
}
$this->rc->output->set_env('tasklists', $jsenv);
- $this->rc->output->add_gui_object('tasklistslist', $attrib['id']);
+ $this->register_gui_object('tasklistslist', $attrib['id']);
return html::tag('ul', $attrib, $html, html::$common_attrib);
}
@@ -334,7 +335,7 @@ class tasklist_ui
$input = new html_inputfield(array('name' => 'text', 'id' => 'quickaddinput'));
$button = html::tag('input', array('type' => 'submit', 'value' => '+', 'title' => $this->plugin->gettext('createtask'), 'class' => 'button mainaction'));
- $this->rc->output->add_gui_object('quickaddform', $attrib['id']);
+ $this->register_gui_object('quickaddform', $attrib['id']);
return html::tag('form', $attrib, $label . $input->show() . $button);
}
@@ -345,7 +346,7 @@ class tasklist_ui
{
$attrib += array('id' => 'rcmtaskslist');
- $this->rc->output->add_gui_object('resultlist', $attrib['id']);
+ $this->register_gui_object('resultlist', $attrib['id']);
unset($attrib['name']);
return html::tag('ul', $attrib, '');
@@ -359,7 +360,7 @@ class tasklist_ui
$attrib += array('id' => 'rcmtasktagslist');
unset($attrib['name']);
- $this->rc->output->add_gui_object('tagslist', $attrib['id']);
+ $this->register_gui_object('tagslist', $attrib['id']);
return html::tag('ul', $attrib, '');
}
@@ -369,7 +370,7 @@ class tasklist_ui
function tags_editline($attrib)
{
$attrib += array('id' => 'rcmtasktagsedit');
- $this->rc->output->add_gui_object('edittagline', $attrib['id']);
+ $this->register_gui_object('edittagline', $attrib['id']);
$input = new html_inputfield(array('name' => 'tags[]', 'class' => 'tag', 'size' => $attrib['size'], 'tabindex' => $attrib['tabindex']));
unset($attrib['tabindex']);
@@ -384,7 +385,7 @@ class tasklist_ui
if (!$attrib['id'])
$attrib['id'] = 'rcmtaskattachmentlist';
- $this->rc->output->add_gui_object('attachmentlist', $attrib['id']);
+ $this->register_gui_object('attachmentlist', $attrib['id']);
return html::tag('ul', $attrib, '', html::$common_attrib);
}
@@ -423,7 +424,7 @@ class tasklist_ui
function file_drop_area($attrib = array())
{
if ($attrib['id']) {
- $this->rc->output->add_gui_object('filedrop', $attrib['id']);
+ $this->register_gui_object('filedrop', $attrib['id']);
$this->rc->output->set_env('filedrop', array('action' => 'upload', 'fieldname' => '_attachments'));
}
}
@@ -477,4 +478,22 @@ class tasklist_ui
$checkbox = new html_checkbox(array('name' => '_notify', 'id' => 'edit-attendees-donotify', 'value' => 1));
return html::div($attrib, html::label(null, $checkbox->show(1) . ' ' . $this->plugin->gettext('sendnotifications')));
}
+
+ /**
+ * Wrapper for rcube_output_html::add_gui_object()
+ */
+ function register_gui_object($name, $id)
+ {
+ $this->gui_objects[$name] = $id;
+ $this->rc->output->add_gui_object($name, $id);
+ }
+
+ /**
+ * Getter for registered gui objects.
+ * (for manual registration when loading the inline UI)
+ */
+ function get_gui_objects()
+ {
+ return $this->gui_objects;
+ }
}