2 commits - plugins/libcalendaring plugins/odfviewer

Thomas Brüderli bruederli at kolabsys.com
Wed Jan 21 20:33:43 CET 2015


 plugins/libcalendaring/libcalendaring.php |   12 ++++++------
 plugins/odfviewer/odfviewer.php           |    5 +++--
 2 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit a8acc5052085db3b4b8db8153f9ecd5082c270e0
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Jan 21 20:33:10 2015 +0100

    Move assets loading and env setting routine to startup hook.
    
    This will give the odfviewer plugin the opportunity to update the config
    with the additional mimetypes regardless of the plugin loading order.

diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
index ec82fdf..b9055b1 100644
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -98,12 +98,6 @@ class libcalendaring extends rcube_plugin
 
         // include client scripts and styles
         if ($this->rc->output) {
-            if ($this->rc->output->type == 'html') {
-                $this->rc->output->set_env('libcal_settings', $this->load_settings());
-                $this->include_script('libcalendaring.js');
-                $this->include_stylesheet($this->local_skin_path() . '/libcal.css');
-            }
-
             // add hook to display alarms
             $this->add_hook('refresh', array($this, 'refresh'));
             $this->register_action('plugin.alarms', array($this, 'alarms_action'));
@@ -119,6 +113,12 @@ class libcalendaring extends rcube_plugin
      */
     public function startup($args)
     {
+        if ($this->rc->output && $this->rc->output->type == 'html') {
+            $this->rc->output->set_env('libcal_settings', $this->load_settings());
+            $this->include_script('libcalendaring.js');
+            $this->include_stylesheet($this->local_skin_path() . '/libcal.css');
+        }
+
         if ($args['task'] == 'mail') {
             if ($args['action'] == 'show' || $args['action'] == 'preview') {
                 $this->add_hook('message_load', array($this, 'mail_message_load'));


commit 8d420a94cc3fe3eda4475b22b1dc1b218cb84aca
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Jan 21 20:32:06 2015 +0100

    Use asset_url() for loading viewer files (#4307)

diff --git a/plugins/odfviewer/odfviewer.php b/plugins/odfviewer/odfviewer.php
index 4a57b64..77285a0 100644
--- a/plugins/odfviewer/odfviewer.php
+++ b/plugins/odfviewer/odfviewer.php
@@ -74,6 +74,7 @@ class odfviewer extends rcube_plugin
   {
     if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->odf_mimetypes)) {
       if (empty($_GET['_load'])) {
+        $rcmail = rcube::get_instance();
         $exts = rcube_mime::get_mime_extensions($args['mimetype']);
         $suffix = $exts ? '.'.$exts[0] : '.odt';
         $fn = md5(session_id() . $_SERVER['REQUEST_URI']) . $suffix;
@@ -99,8 +100,8 @@ class odfviewer extends rcube_plugin
         $html = file_get_contents($this->home . '/odf.html');
         header("Content-Type: text/html; charset=" . RCMAIL_CHARSET);
         echo strtr($html, array(
-          '%%DOCROOT%%' => $this->urlbase,
-          '%%DOCURL%%' => $this->tempbase . $fn, # $_SERVER['REQUEST_URI'].'&_load=1',
+          '%%DOCROOT%%' => $rcmail->output->asset_url($this->urlbase),
+          '%%DOCURL%%' => $rcmail->output->asset_url($this->tempbase . $fn), # $_SERVER['REQUEST_URI'].'&_load=1',
           ));
         $args['abort'] = true;
       }




More information about the commits mailing list