diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 33217aca..af579578 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -104,17 +104,17 @@ class calendar extends rcube_plugin $this->require_plugin('libcalendaring'); $this->require_plugin('libkolab'); + require $this->home . '/lib/calendar_ui.php'; + + // load localizations + $this->add_texts('localization/', $this->rc->task == 'calendar' && (!$this->rc->action || $this->rc->action == 'print')); + $this->lib = libcalendaring::get_instance(); $this->timezone = $this->lib->timezone; $this->gmt_offset = $this->lib->gmt_offset; $this->dst_active = $this->lib->dst_active; $this->timezone_offset = $this->gmt_offset / 3600 - $this->dst_active; - - // load localizations - $this->add_texts('localization/', $this->rc->task == 'calendar' && (!$this->rc->action || $this->rc->action == 'print')); - - require($this->home . '/lib/calendar_ui.php'); - $this->ui = new calendar_ui($this); + $this->ui = new calendar_ui($this); } /** @@ -141,6 +141,13 @@ class calendar extends rcube_plugin if ($args['action'] != 'attend') { $this->rc->output->set_env('calendar_settings', $this->load_settings()); } + + // A hack to replace "Edit/Share Calendar" label with "Edit calendar", for CalDAV driver + if ($args['task'] == 'calendar' && $this->rc->config->get('calendar_driver', 'database') === 'caldav') { + $merge = ['calendar.editcalendar' => $this->gettext('edcalendar')]; + $this->rc->load_language(null, [], $merge); + $this->rc->output->command('add_label', $merge); + } } if ($args['task'] == 'calendar' && $args['action'] != 'save-pref') { @@ -246,8 +253,8 @@ class calendar extends rcube_plugin $driver_name = $this->rc->config->get('calendar_driver', 'database'); $driver_class = $driver_name . '_driver'; - require_once($this->home . '/drivers/calendar_driver.php'); - require_once($this->home . '/drivers/' . $driver_name . '/' . $driver_class . '.php'); + require_once $this->home . '/drivers/calendar_driver.php'; + require_once $this->home . '/drivers/' . $driver_name . '/' . $driver_class . '.php'; $this->driver = new $driver_class($this); @@ -262,7 +269,8 @@ class calendar extends rcube_plugin private function load_itip() { if (empty($this->itip)) { - require_once($this->home . '/lib/calendar_itip.php'); + require_once $this->home . '/lib/calendar_itip.php'; + $this->itip = new calendar_itip($this); if ($this->rc->config->get('kolab_invitation_calendars')) { @@ -2791,8 +2799,8 @@ $("#rcmfd_new_category").keypress(function(event) { if ($driver_name = $this->rc->config->get('calendar_resources_driver')) { $driver_class = 'resources_driver_' . $driver_name; - require_once($this->home . '/drivers/resources_driver.php'); - require_once($this->home . '/drivers/' . $driver_name . '/' . $driver_class . '.php'); + require_once $this->home . '/drivers/resources_driver.php'; + require_once $this->home . '/drivers/' . $driver_name . '/' . $driver_class . '.php'; $this->resources_dir = new $driver_class($this); } diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc index 0f97d566..5a969aca 100644 --- a/plugins/calendar/localization/en_US.inc +++ b/plugins/calendar/localization/en_US.inc @@ -44,6 +44,7 @@ $labels['category'] = 'Category'; $labels['categories'] = 'Categories'; $labels['addcalendar'] = 'Add calendar'; $labels['createcalendar'] = 'Create new calendar'; +$labels['edcalendar'] = 'Edit calendar'; $labels['editcalendar'] = 'Edit/Share calendar'; $labels['deletecalendar'] = 'Delete calendar'; $labels['name'] = 'Name'; diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php index 27ac89d8..7454703d 100644 --- a/plugins/libcalendaring/lib/libcalendaring_itip.php +++ b/plugins/libcalendaring/lib/libcalendaring_itip.php @@ -793,11 +793,15 @@ class libcalendaring_itip $this->rc->output->add_script("rcube_libcalendaring.fetch_itip_object_status(" . rcube_output::json_serialize($metadata) . ")", 'docready'); // get localized texts from the right domain - foreach (array('savingdata','deleteobjectconfirm','declinedeleteconfirm','declineattendee', + $output_labels = []; + $labels = ['savingdata','deleteobjectconfirm','declinedeleteconfirm','declineattendee', 'cancel','itipdelegated','declineattendeeconfirm','itipcomment','delegateinvitation', - 'delegateto','delegatersvpme','delegateinvalidaddress') as $label) { - $this->rc->output->command('add_label', "itip.$label", $this->gettext($label)); + 'delegateto','delegatersvpme','delegateinvalidaddress' + ]; + foreach ($labels as $label) { + $output_labels["itip.$label"] = $this->gettext($label); } + $this->rc->output->command('add_label', $output_labels); // show event details with buttons return $this->itip_object_details_table($event, $title) . @@ -828,17 +832,22 @@ class libcalendaring_itip } // add localized texts for the delegation dialog + $output_labels = []; if (in_array('delegated', $actions)) { - foreach (array('itipdelegated','itipcomment','delegateinvitation', - 'delegateto','delegatersvpme','delegateinvalidaddress','cancel') as $label) { - $this->rc->output->command('add_label', "itip.$label", $this->gettext($label)); + $labels = ['itipdelegated','itipcomment','delegateinvitation', + 'delegateto','delegatersvpme','delegateinvalidaddress','cancel' + ]; + foreach ($labels as $label) { + $output_labels["itip.$label"] = $this->gettext($label); } } - foreach (array('all','current','future') as $mode) { - $this->rc->output->command('add_label', "rsvpmode$mode", $this->gettext("rsvpmode$mode")); + foreach (['all','current','future'] as $mode) { + $output_labels["rsvpmode$mode"] = $this->gettext("rsvpmode$mode"); } + $this->rc->output->command('add_label', $output_labels); + $savemode_radio = new html_radiobutton(array('name' => '_rsvpmode', 'class' => 'rsvp-replymode')); return html::div($attrib, diff --git a/plugins/tasklist/config.inc.php.dist b/plugins/tasklist/config.inc.php.dist index b04d96b7..d933e575 100644 --- a/plugins/tasklist/config.inc.php.dist +++ b/plugins/tasklist/config.inc.php.dist @@ -1,7 +1,7 @@ require_plugin('libcalendaring'); $this->require_plugin('libkolab'); - $this->rc = rcube::get_instance(); - $this->lib = libcalendaring::get_instance(); - - $this->register_task('tasks', 'tasklist'); - // load plugin configuration $this->load_config(); + $this->rc = rcube::get_instance(); + $this->lib = libcalendaring::get_instance(); $this->timezone = $this->lib->timezone; - // proceed initialization in startup hook - $this->add_hook('startup', array($this, 'startup')); + $this->register_task('tasks', 'tasklist'); + $this->add_hook('startup', array($this, 'startup')); $this->add_hook('user_delete', array($this, 'user_delete')); } @@ -100,8 +97,9 @@ class tasklist extends rcube_plugin public function startup($args) { // the tasks module can be enabled/disabled by the kolab_auth plugin - if ($this->rc->config->get('tasklist_disabled', false) || !$this->rc->config->get('tasklist_enabled', true)) + if ($this->rc->config->get('tasklist_disabled', false) || !$this->rc->config->get('tasklist_enabled', true)) { return; + } // load localizations $this->add_texts('localization/', $args['task'] == 'tasks' && (!$args['action'] || $args['action'] == 'print')); @@ -158,6 +156,13 @@ class tasklist extends rcube_plugin } if (!$this->rc->output->ajax_call && empty($this->rc->output->env['framed'])) { + // A hack to replace "Edit/Share List" label with "Edit list", for CalDAV driver + if ($args['task'] == 'tasks' && $this->rc->config->get('tasklist_driver', 'database') === 'caldav') { + $merge = ['tasklist.editlist' => $this->gettext('edlist')]; + $this->rc->load_language(null, [], $merge); + $this->rc->output->command('add_label', $merge); + } + $this->load_ui(); $this->ui->init(); } @@ -190,8 +195,8 @@ class tasklist extends rcube_plugin $driver_name = $this->rc->config->get('tasklist_driver', 'database'); $driver_class = 'tasklist_' . $driver_name . '_driver'; - require_once($this->home . '/drivers/tasklist_driver.php'); - require_once($this->home . '/drivers/' . $driver_name . '/' . $driver_class . '.php'); + require_once $this->home . '/drivers/tasklist_driver.php'; + require_once $this->home . '/drivers/' . $driver_name . '/' . $driver_class . '.php'; $this->driver = new $driver_class($this);