From fc8785dac450c132c770ef5231c25c008151b082 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 2 Jan 2018 13:21:11 +0100 Subject: [PATCH] Elastic: Initial kolab_notes support TODO: printing, tags, and some small style fixes --- .../kolab_addressbook/kolab_addressbook.js | 2 +- .../skins/larry/kolab_addressbook.css | 6 +- plugins/kolab_notes/kolab_notes.php | 26 +- plugins/kolab_notes/kolab_notes_ui.php | 142 +++--- plugins/kolab_notes/localization/en_US.inc | 6 +- plugins/kolab_notes/notes.js | 472 ++++++++---------- plugins/kolab_notes/notes_mail.js | 102 ++-- .../skins/elastic/templates/dialogview.html | 29 ++ .../skins/elastic/templates/listform.html | 9 + .../skins/elastic/templates/notes.html | 172 +++++++ .../skins/elastic/templates/print.html | 17 + plugins/kolab_notes/skins/larry/notes.css | 17 + .../skins/larry/templates/kolabacl.html | 26 - .../skins/larry/templates/notes.html | 8 +- plugins/libkolab/libkolab.php | 1 + plugins/libkolab/localization/en_US.inc | 3 +- plugins/libkolab/skins/elastic/libkolab.less | 100 +++- 17 files changed, 672 insertions(+), 466 deletions(-) create mode 100644 plugins/kolab_notes/skins/elastic/templates/dialogview.html create mode 100644 plugins/kolab_notes/skins/elastic/templates/listform.html create mode 100644 plugins/kolab_notes/skins/elastic/templates/notes.html create mode 100644 plugins/kolab_notes/skins/elastic/templates/print.html delete mode 100644 plugins/kolab_notes/skins/larry/templates/kolabacl.html diff --git a/plugins/kolab_addressbook/kolab_addressbook.js b/plugins/kolab_addressbook/kolab_addressbook.js index f19dd268..60185c74 100644 --- a/plugins/kolab_addressbook/kolab_addressbook.js +++ b/plugins/kolab_addressbook/kolab_addressbook.js @@ -89,7 +89,7 @@ if (window.rcmail) { // append button to show contact audit trail if (rcmail.env.action == 'show' && rcmail.env.kolab_audit_trail && rcmail.env.cid) { - $('').attr({href: '#history', 'class': 'btn btn-secondary btn-contact-history', role: 'button', tabindex: 0}) + $('').attr({href: '#history', 'class': 'btn btn-secondary history contact-history', role: 'button', tabindex: 0}) .append($('').text(rcmail.get_label('kolab_addressbook.showhistory'))) .click(function(e) { var rc = rcmail.is_framed() && parent.rcmail.contact_history_dialog ? parent.rcmail : rcmail; diff --git a/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css b/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css index a2e78856..baf4a7ef 100644 --- a/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css +++ b/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css @@ -156,18 +156,18 @@ text-align: center; } -.formbuttons .btn-contact-history { +.formbuttons .contact-history { display: inline-block; padding: 1px; color: #333; text-decoration: none; } -.formbuttons .btn-contact-history:hover { +.formbuttons .contact-history:hover { text-decoration: underline; } -.formbuttons .btn-contact-history:before { +.formbuttons .contact-history:before { content: ""; display: inline-block; position: relative; diff --git a/plugins/kolab_notes/kolab_notes.php b/plugins/kolab_notes/kolab_notes.php index feeb6b38..ef6cf03f 100644 --- a/plugins/kolab_notes/kolab_notes.php +++ b/plugins/kolab_notes/kolab_notes.php @@ -79,6 +79,10 @@ class kolab_notes extends rcube_plugin $this->register_action('action', array($this, 'note_action')); $this->register_action('list', array($this, 'list_action')); $this->register_action('dialog-ui', array($this, 'dialog_view')); + + if (!$this->rc->output->ajax_call && in_array($args['action'], array('dialog-ui', 'list'))) { + $this->load_ui(); + } } else if ($args['task'] == 'mail') { $this->add_hook('storage_init', array($this, 'storage_init')); @@ -107,7 +111,7 @@ class kolab_notes extends rcube_plugin } } - if (!$this->rc->output->ajax_call && (!$this->rc->output->env['framed'] || in_array($args['action'], array('folder-acl','dialog-ui')))) { + if (!$this->rc->output->ajax_call && !$this->rc->output->env['framed']) { $this->load_ui(); } @@ -132,9 +136,11 @@ class kolab_notes extends rcube_plugin */ private function load_ui() { - require_once($this->home . '/kolab_notes_ui.php'); - $this->ui = new kolab_notes_ui($this); - $this->ui->init(); + if (!$this->ui) { + require_once($this->home . '/kolab_notes_ui.php'); + $this->ui = new kolab_notes_ui($this); + $this->ui->init(); + } } /** @@ -1027,7 +1033,7 @@ class kolab_notes extends rcube_plugin case 'form-new': case 'form-edit': $this->_read_lists(); - echo $this->ui->list_editform($action, $this->lists[$list['id']], $this->folders[$list['id']]); + $this->ui->list_editform($action, $this->lists[$list['id']], $this->folders[$list['id']]); exit; case 'new': @@ -1061,11 +1067,11 @@ class kolab_notes extends rcube_plugin $list['_reload'] = $list['parent'] != $oldparent; // compose the new display name - $delim = $this->rc->get_storage()->get_hierarchy_delimiter(); - $path_imap = explode($delim, $newfolder); + $delim = $this->rc->get_storage()->get_hierarchy_delimiter(); + $path_imap = explode($delim, $newfolder); $list['name'] = kolab_storage::object_name($newfolder); $list['editname'] = rcube_charset::convert(array_pop($path_imap), 'UTF7-IMAP'); - $list['listname'] = str_repeat('   ', count($path_imap)) . '» ' . $list['editname']; + $list['listname'] = (!empty($path_imap) ? str_repeat('   ', count($path_imap)) . '» ' : '') . $list['editname']; } break; @@ -1098,7 +1104,7 @@ class kolab_notes extends rcube_plugin } // report more results available if ($this->driver->search_more_results) { - $this->rc->output->show_message('autocompletemore', 'info'); + $this->rc->output->show_message('autocompletemore', 'notice'); } $this->rc->output->command('multi_thread_http_response', $results, rcube_utils::get_input_value('_reqid', rcube_utils::INPUT_GPC)); @@ -1200,7 +1206,7 @@ class kolab_notes extends rcube_plugin // prepend note links to message body if ($html) { $this->load_ui(); - $args['content'] = html::div('kolabmessagenotes', $html) . $args['content']; + $args['content'] = html::div('kolabmessagenotes ui alert', $html) . $args['content']; } return $args; diff --git a/plugins/kolab_notes/kolab_notes_ui.php b/plugins/kolab_notes/kolab_notes_ui.php index bf790237..41ce8118 100644 --- a/plugins/kolab_notes/kolab_notes_ui.php +++ b/plugins/kolab_notes/kolab_notes_ui.php @@ -33,7 +33,6 @@ class kolab_notes_ui $this->plugin->include_stylesheet($this->plugin->local_skin_path() . '/notes.css'); $this->plugin->register_action('print', array($this, 'print_template')); - $this->plugin->register_action('folder-acl', array($this, 'folder_acl')); $this->ready = true; } @@ -79,33 +78,10 @@ class kolab_notes_ui $settings['selected_uid'] = $uid; } - $lang_codes = array($_SESSION['language']); - $assets_dir = $this->rc->config->get('assets_dir') ?: INSTALL_PATH; - - if ($pos = strpos($_SESSION['language'], '_')) { - $lang_codes[] = substr($_SESSION['language'], 0, $pos); - } - - foreach ($lang_codes as $code) { - if (file_exists("$assets_dir/program/js/tinymce/langs/$code.js")) { - $lang = $code; - break; - } - } - - if (empty($lang)) { - $lang = 'en'; - } - - $settings['editor'] = array( - 'lang' => $lang, - 'spellcheck' => intval($this->rc->config->get('enable_spellcheck')), - 'spelldict' => intval($this->rc->config->get('spellcheck_dictionary')) - ); + $this->rc->html_editor(); $this->rc->output->set_env('kolab_notes_settings', $settings); - - $this->rc->output->add_label('save','cancel','delete','close'); + $this->rc->output->add_label('save','cancel','delete','close','listoptionstitle'); } public function folders($attrib) @@ -240,7 +216,7 @@ class kolab_notes_ui { $attrib += array('id' => 'rcmkolabnoteslist'); $this->rc->output->add_gui_object('noteslist', $attrib['id']); - return html::tag('ul', $attrib, '', html::$common_attrib); + return html::tag('table', $attrib, '', html::$common_attrib); } public function tagslist($attrib) @@ -254,10 +230,17 @@ class kolab_notes_ui { $attrib += array('action' => '#', 'id' => 'rcmkolabnoteseditform'); - $this->rc->output->add_gui_object('noteseditform', $attrib['id']); - $this->rc->output->include_script('tinymce/tinymce.min.js'); + $textarea = new html_textarea(array( + 'name' => 'content', + 'id' => 'notecontent', + 'cols' => 60, + 'rows' => 20, + 'tabindex' => 0, + 'class' => 'mce_editor form-control', + )); + + $this->rc->output->add_gui_object('noteseditform', $attrib['id']); - $textarea = new html_textarea(array('name' => 'content', 'id' => 'notecontent', 'cols' => 60, 'rows' => 20, 'tabindex' => 0)); return html::tag('form', $attrib, $textarea->show(), array_merge(html::$common_attrib, array('action'))); } @@ -273,16 +256,32 @@ class kolab_notes_ui $attrib += array('id' => 'rcmkolabnotestitle'); $this->rc->output->add_gui_object('noteviewtitle', $attrib['id']); - $summary = new html_inputfield(array('name' => 'summary', 'class' => 'notetitle inline-edit', 'size' => 60, 'tabindex' => 0)); + $summary = new html_inputfield(array( + 'name' => 'summary', + 'class' => 'notetitle inline-edit form-control', + 'size' => 60, + 'id' => 'notetitleinput', + 'tabindex' => 0 + )); - $html = $summary->show(); - $html .= html::div(array('class' => 'tagline tagedit', 'style' => 'display:none'), ' '); - $html .= html::div(array('class' => 'dates', 'style' => 'display:none'), - html::label(array(), $this->plugin->gettext('created')) . - html::span('notecreated', '') . - html::label(array(), $this->plugin->gettext('changed')) . - html::span('notechanged', '') - ); + $html = html::div('form-group row', + html::label(array('class' => 'col-sm-2 col-form-label', 'for' => 'notetitleinput'), $this->plugin->gettext('kolab_notes.title')) + . html::span('col-sm-10', $summary->show()) + ) + . html::div('form-group row', + html::label(array('class' => 'col-sm-2 col-form-label'), $this->plugin->gettext('kolab_notes.tags')) + . html::div(array('class' => 'tagline tagedit col-sm-10', 'style' => 'display:none'), ' ') + ) + . html::div(array('class' => 'dates', 'style' => 'display:none'), + html::div('form-group row', + html::label(array('class' => 'col-sm-2 col-form-label'), $this->plugin->gettext('created')) + . html::span('col-sm-10', html::span('notecreated form-control-plaintext', '')) + ) + . html::div('form-group row', + html::label(array('class' => 'col-sm-2 col-form-label'), $this->plugin->gettext('changed')) + . html::span('col-sm-10', html::span('notechanged form-control-plaintext', '')) + ) + ); return html::div($attrib, $html); } @@ -295,12 +294,24 @@ class kolab_notes_ui } /** - * Render edit for notes lists (folders) + * Render create/edit form for notes lists (folders) */ public function list_editform($action, $list, $folder) { - if (is_object($folder)) { - $folder_name = $folder->name; // UTF7 + $this->action = $action; + $this->list = $list; + $this->folder = $folder; + $this->rc->output->add_handler('notebookform', array($this, 'notebookform')); + $this->rc->output->send('kolab_notes.listform'); + } + + /** + * Render create/edit form for notes lists (folders) + */ + public function notebookform($attrib) + { + if (is_object($this->folder)) { + $folder_name = $this->folder->name; // UTF7 } else { $folder_name = ''; @@ -321,12 +332,12 @@ class kolab_notes_ui } else { $path_imap = ''; - $options = array(); + $options = array(); } // General tab $form['properties'] = array( - 'name' => $this->rc->gettext('properties'), + 'name' => $this->rc->gettext('properties'), 'fields' => array(), ); @@ -334,8 +345,8 @@ class kolab_notes_ui $input_name = new html_inputfield(array('name' => 'name', 'id' => 'noteslist-name', 'size' => 20)); $form['properties']['fields']['name'] = array( 'label' => $this->plugin->gettext('listname'), - 'value' => $input_name->show($list['editname'], array('disabled' => ($options['norename'] || $options['protected']))), - 'id' => 'noteslist-name', + 'value' => $input_name->show($this->list['editname'], array('disabled' => ($options['norename'] || $options['protected']))), + 'id' => 'noteslist-name', ); // prevent user from moving folder @@ -347,21 +358,15 @@ class kolab_notes_ui $form['properties']['fields']['path'] = array( 'label' => $this->plugin->gettext('parentfolder'), 'value' => $select->show(strlen($folder_name) ? $path_imap : ''), - 'id' => 'parent-folder', + 'id' => 'parent-folder', ); } // add folder ACL tab - if ($action != 'form-new') { + if ($this->action != 'form-new') { $form['sharing'] = array( 'name' => rcube::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'), - '') + 'content' => $this->folder_acl_form() ); } @@ -376,7 +381,7 @@ class kolab_notes_ui // create form output foreach ($form as $tab) { if (is_array($tab['fields']) && empty($tab['content'])) { - $table = new html_table(array('cols' => 2)); + $table = new html_table(array('cols' => 2, 'class' => 'propform')); foreach ($tab['fields'] as $col => $colprop) { $label = !empty($colprop['label']) ? $colprop['label'] : $this->plugin->gettext($col); @@ -394,33 +399,22 @@ class kolab_notes_ui } } - return html::tag('form', array('action' => "#", 'method' => "post", 'id' => "noteslistpropform"), $form_html); + return html::tag('form', $attrib + array('action' => '#', 'method' => 'post', 'id' => 'noteslistpropform'), $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('kolab_notes.kolabacl'); - } - - /** - * Handler for ACL form template object + * Returns ACL form */ public function folder_acl_form() { - $folder = rcube_utils::get_input_value('_folder', rcube_utils::INPUT_GPC); - - if (strlen($folder)) { + if (strlen($this->folder)) { + $this->plugin->require_plugin('acl'); $storage = $this->rc->get_storage(); - $options = $storage->folder_info($folder); + $options = $storage->folder_info($this->folder); // get sharing UI from acl plugin $acl = $this->rc->plugins->exec_hook('folder_form', - array('form' => array(), 'options' => $options, 'name' => $folder)); + array('form' => array(), 'options' => $options, 'name' => $this->folder)); } return $acl['form']['sharing']['content'] ?: html::div('hint', $this->plugin->gettext('aclnorights')); @@ -436,6 +430,4 @@ class kolab_notes_ui echo $this->rc->output->parse('kolab_notes.print', false, false); exit; } - } - diff --git a/plugins/kolab_notes/localization/en_US.inc b/plugins/kolab_notes/localization/en_US.inc index e0ede7a9..1aefffd1 100644 --- a/plugins/kolab_notes/localization/en_US.inc +++ b/plugins/kolab_notes/localization/en_US.inc @@ -37,12 +37,14 @@ $labels['appendnote'] = 'Add a Note'; $labels['editnote'] = 'Edit Note'; $labels['savein'] = 'Save in'; $labels['foldersubscribe'] = 'List permanently'; -$labels['findnotebooks'] = 'Find notebooks...'; +$labels['findnotebooks'] = 'Find notebooks'; +$labels['findnotes'] = 'Find notes'; $labels['listsearchresults'] = 'Additional notebooks'; $labels['nrnotebooksfound'] = '$nr notebooks found'; $labels['nonotebooksfound'] = 'No notebooks found'; $labels['removelist'] = 'Remove from list'; $labels['removelink'] = 'Remove email reference'; +$labels['listactions'] = 'Notebooks list actions'; $labels['savingdata'] = 'Saving data...'; $labels['recordnotfound'] = 'Record not found'; @@ -63,5 +65,5 @@ $labels['arialabelnotessortmenu'] = 'Notes list sorting options'; $labels['arialabelnotesoptionsmenu'] = 'Notebook actions menu'; $labels['arialabelnotebookform'] = 'Notebook properties'; $labels['arialabelmessagereferences'] = 'Linked email messages'; -$labels['arialabelfolderearchform'] = 'Notebooks search form'; +$labels['arialabelfoldersearchform'] = 'Notebooks search form'; $labels['arialabelnoteform'] = 'Note edit form'; diff --git a/plugins/kolab_notes/notes.js b/plugins/kolab_notes/notes.js index 3491bc81..3aad9105 100644 --- a/plugins/kolab_notes/notes.js +++ b/plugins/kolab_notes/notes.js @@ -2,11 +2,12 @@ * Client scripts for the Kolab Notes plugin * * @author Thomas Bruederli + * @author Aleksander Machniak * * @licstart The following is the entire license notice for the * JavaScript code in this file. * - * Copyright (C) 2014-2015, Kolab Systems AG + * Copyright (C) 2014-2017, Kolab Systems AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -47,6 +48,8 @@ function rcube_kolab_notes_ui(settings) this.selected_list = null; this.selected_note = null; this.notebooks = rcmail.env.kolab_notebooks || {}; + this.list_set_sort = list_set_sort; + this.settings = settings; /** * initialize the notes UI @@ -55,7 +58,7 @@ function rcube_kolab_notes_ui(settings) { // register button commands rcmail.register_command('createnote', function(){ - warn_unsaved_changes(function(){ edit_note(null, 'new'); }) + warn_unsaved_changes(function(){ edit_note(null, 'new'); }); }, false); rcmail.register_command('list-create', function(){ list_edit_dialog(null); }, true); rcmail.register_command('list-edit', function(){ list_edit_dialog(me.selected_list); }, false); @@ -76,7 +79,7 @@ function rcube_kolab_notes_ui(settings) rcmail.addEventListener('plugin.update_note', update_note); rcmail.addEventListener('plugin.update_list', list_update); rcmail.addEventListener('plugin.destroy_list', list_destroy); - rcmail.addEventListener('plugin.unlock_saving', function(){ + rcmail.addEventListener('plugin.unlock_saving', function() { if (saving_lock) { rcmail.set_busy(false, null, saving_lock); } @@ -105,7 +108,7 @@ function rcube_kolab_notes_ui(settings) id_prefix: 'rcmliknb', save_state: true, selectable: true, - keyboard: false, + keyboard: true, searchbox: '#notebooksearch', search_action: 'notes/list', search_sources: [ 'folders', 'users' ], @@ -124,6 +127,7 @@ function rcube_kolab_notes_ui(settings) rcmail.enable_command('list-delete', has_permission(me.notebooks[id], 'xa')); rcmail.enable_command('list-remove', !me.notebooks[id]['default']); fetch_notes(id); // sets me.selected_list + rcmail.triggerEvent('show-list', {title: me.notebooks[id].listname}); // Elastic }, function(){ // restore previous selection @@ -162,9 +166,16 @@ function rcube_kolab_notes_ui(settings) if (data.length) rcmail.display_message(rcmail.gettext('nrnotebooksfound','kolab_notes').replace('$nr', data.length), 'voice'); else - rcmail.display_message(rcmail.gettext('nonotebooksfound','kolab_notes'), 'info'); + rcmail.display_message(rcmail.gettext('nonotebooksfound','kolab_notes'), 'notice'); }); + // Make Elastic checkboxes pretty + if (window.UI && UI.pretty_checkbox) { + notebookslist.addEventListener('add-item', function(prop) { + UI.pretty_checkbox($(prop.li).find('input').addClass('flex-checkbox')); + }); + } + $(rcmail.gui_objects.notebooks).on('click', 'div.folder > a.listname', function(e) { var id = String($(this).closest('li').attr('id')).replace(/^rcmliknb/, ''); notebookslist.select(id); @@ -194,14 +205,14 @@ function rcube_kolab_notes_ui(settings) // initialize notes list widget if (rcmail.gui_objects.noteslist) { - noteslist = new rcube_list_widget(rcmail.gui_objects.noteslist, + rcmail.noteslist = noteslist = new rcube_list_widget(rcmail.gui_objects.noteslist, { multiselect:true, draggable:true, keyboard:true }); noteslist.addEventListener('select', function(list) { render_no_focus = rcube_event._last_keyboard_event && $(list.list).has(rcube_event._last_keyboard_event.target); var selection_changed = list.selection.length != 1 || !me.selected_note || list.selection[0] != me.selected_note.id; selection_changed && warn_unsaved_changes(function(){ var note; - if (noteslist.selection.length == 1 && (note = notesdata[noteslist.selection[0]])) { + if (!list.multi_selecting && noteslist.selection.length == 1 && (note = notesdata[noteslist.selection[0]])) { edit_note(note.uid, 'edit'); } else { @@ -340,23 +351,17 @@ function rcube_kolab_notes_ui(settings) if (rcmail.gui_objects.noteseditform) { rcmail.lock_form(rcmail.gui_objects.noteseditform, false); } + if (rcmail.is_framed()) { + parent.$(parent.kolab_note_dialog_element).dialog('destroy'); + } }); - var id; - for (id in me.notebooks) { - if (me.notebooks[id].editable) { - me.selected_list = id; - break; + var id, callback = function() { + if (settings.selected_uid) { + me.selected_list = settings.selected_list; + edit_note(settings.selected_uid); } - } - - init_editor(); - if (settings.selected_uid) { - me.selected_list = settings.selected_list; - edit_note(settings.selected_uid); - } - else { - setTimeout(function(){ + else { me.selected_note = $.extend({ list: me.selected_list, uid: null, @@ -367,59 +372,34 @@ function rcube_kolab_notes_ui(settings) changed: rcmail.gettext('now', 'kolab_notes') }, rcmail.env.kolab_notes_template || {}); render_note(me.selected_note); - }, 100); + } + }; + + for (id in me.notebooks) { + if (me.notebooks[id].editable) { + me.selected_list = id; + break; + } } + + init_editor(callback); } this.init_dialog = init_dialog; /** * initialize tinyMCE editor */ - function init_editor() + function init_editor(callback) { - var editor_conf = { - selector: '#notecontent', - theme: 'modern', - language: settings.editor.lang, - content_css: rcmail.assets_path('program/js/tinymce/roundcube/content.css?v2'), - plugins: 'autolink charmap code link paste tabfocus searchreplace table textcolor', - toolbar: 'bold italic underline | alignleft aligncenter alignright alignjustify ' - + '| bullist numlist outdent indent blockquote | forecolor backcolor fontselect fontsizeselect ' - + '| link unlink table charmap | code searchreplace undo redo', - menubar: false, - statusbar: false, - toolbar_items_size: 'small', - extended_valid_elements: 'font[face|size|color|style],span[id|class|align|style]', - relative_urls: false, - remove_script_host: false, - convert_urls: false, - image_description: false, - paste_webkit_style: "color font-size font-family", - paste_data_images: true, - //spellchecker_rpc_url: '../../../../../?_task=utils&_action=spell_html&_remote=1', - //spellchecker_language: rcmail.env.spell_lang, - accessibility_focus: false, - tabfocus_elements: [':prev','btn-save-note'], - setup: function(ed) { - // make links open on shift-click - ed.on('click', function(e) { - var link = $(e.target).closest('a'); - if (link.length && e.shiftKey) { - if (!bw.mz) window.open(link.get(0).href, '_blank'); - return false; - } - }); - } - }; + if (callback) { + rcmail.addEventListener('editor-load', callback); + } - // support external configuration settings e.g. from skin - if (window.rcmail_editor_settings) - $.extend(editor_conf, window.rcmail_editor_settings); - - tinyMCE.init(editor_conf); + // initialize HTML editor + rcmail.editor_init(rcmail.env.editor_config, 'notecontent'); // register click handler for message links - $(rcmail.gui_objects.notesattachmentslist).on('click', 'li a.messagelink', function(){ + $(rcmail.gui_objects.notesattachmentslist).on('click', 'li a.messagelink', function() { rcmail.open_window(this.href); return false; }); @@ -433,14 +413,6 @@ function rcube_kolab_notes_ui(settings) return String(str).replace(//g, '>').replace(/"/g, '"'); } - /** - * Trim whitespace off the given string - */ - function trim(str) - { - return String(str).replace(/\s+$/, '').replace(/^\s+/, ''); - } - /** * Check permissions on the given list object */ @@ -495,84 +467,45 @@ function rcube_kolab_notes_ui(settings) */ function list_edit_dialog(id) { - if (!rcmail.gui_containers.notebookeditform) { - return false; - } + var list = me.notebooks[id] || { name:'', editable:true, rights: 'riwta' }, + title = rcmail.gettext((list.id ? 'editlist' : 'newnotebook'), 'kolab_notes'), + params = {_do: (list.id ? 'form-edit' : 'form-new'), _list: {id: list.id}, _framed: 1}, + $dialog = $('