Основные возможности:

  • Добавляет описание шрифтов;
  • Исправляет кодировку всех заголовков диаграммы Гантта (включая месяц и день);

Рассмотрены версии:

  • - jpgraph 2.x + eGroupware 1.6.001
  • - jpgraph 3.0.6 + eGroupware 1.6.002

Cкриншоты

Результат применения патча eGroupware и jpgraph

- jpgraph-2.x + eGroupware-1.6.001:
jpgraph-2.x+eGroupware-1.6.001

- jpgraph-3.0.6 + eGroupware-1.6.002:
jpgraph-3.0.6+eGroupware-1.6.002

Выбор шрифта в eGroupware Управление Проектами - Конфигурирование сайта

- jpgraph-2.x + eGroupware-1.6.001:
jpgraph-2.x+eGroupware-1.6.001

- jpgraph-3.0.6 + eGroupware-1.6.002:
jpgraph-3.0.6+eGroupware-1.6.002

Патч eGroupware и jpgraph

(Скачать файл можно будет здесь. ЗЫ Не тыкать! Жать правой кнопкой: сохранить ссылку как...)

Вариант jpgraph-2.x + eGroupware-1.6.001

Текст патча для class.projectmanager_admin.inc.php (eGroupware-1.6.001)

--- class.projectmanager_admin.inc.php  2008-10-10 17:29:54.000000000 +0400
+++ class.projectmanager_admin.inc.php  2008-12-02 13:47:17.000000000 +0300
@@ -165,6 +165,9 @@
       FF_GOTHIC    => 'Gothic (Japanese)',
       FF_PGOTHIC   => 'PGothic (Japanese)',
 
+      // Users fonts
+      FF_UFONTS    => 'Users fonts',
+
       // Hebrew fonts
       FF_DAVID     => 'David (Hebrew)',
       FF_MIRIAM    => 'Miriam (Hebrew)',
@@ -245,6 +248,8 @@
       DEFINE("FF_GOTHIC",42);
       DEFINE("FF_PGOTHIC",43);
 
+      DEFINE("FF_UFONTS",60);
+
       // TTF Font styles
       DEFINE("FS_NORMAL",9001);
       DEFINE("FS_BOLD",9002);
@@ -360,6 +365,10 @@
             FS_BOLD  =>'',
             FS_ITALIC  =>'',
             FS_BOLDITALIC  =>'' ),
+        FF_UFONTS =>   array(FS_NORMAL  =>UTTF_No,
+          FS_BOLD    =>UTTF_Bd,
+          FS_ITALIC  =>UTTF_It,
+          FS_BOLDITALIC  =>UTTF_BI ),
     );
     return $font_files[$font][$style];
   }
 

Текст патча для class.projectmanager_ganttchart.inc.php (eGroupware-1.6.001)

--- class.projectmanager_ganttchart.inc.php  2008-11-16 15:40:06.000000000 +0300
+++ class.projectmanager_ganttchart.inc.php  2008-12-02 14:30:07.000000000 +0300
@@ -40,7 +40,7 @@
         '/usr/share/fonts/ja/TrueType/',    // japanese fonts
         '/usr/share/fonts/msttcorefonts/',     // to install this fonts see http://www.aditus.nu/jpgraph/jpdownload.php
         'C:/windows/fonts/',          // windows default
-        // add your location here or to egw_config.config_value for config_app='projectmanger' AND config_name='TTF_DIR'
+        '/usr/share/fonts/truetype/',      // add your location here or to egw_config.config_value for config_app='projectmanger' AND config_name='TTF_DIR'
         EGW_SERVER_ROOT.'/projectmanager/inc/ttf-bitstream-vera-1.10/',  // our bundled Vera font
       ) as $dir)
       {
@@ -210,7 +210,7 @@
 
     // convert everything above ascii to nummeric html entities
     // not sure if this is necessary for non iso-8859-1 charsets, try to comment it out if you have problems
-    if ($this->gantt_char_encode) $text = preg_replace('/[^\x00-\x7F]/e', '"&#".ord("$0").";"',$text);
+    //if ($this->gantt_char_encode) $text = preg_replace('/[^\x00-\x7F]/e', '"&#".ord("$0").";"',$text);
 
     return $text;
   }
@@ -330,7 +330,9 @@
     // Change the font scale
     $graph->scale->week->SetFont($this->gantt_font,FS_NORMAL,8);
     $graph->scale->year->SetFont($this->gantt_font,GANTT_STYLE,10);
-
+    $graph->scale->day->SetFont($this->gantt_font,FS_NORMAL,6);
+    $graph->scale->month->SetFont($this->gantt_font,FS_NORMAL,6);
+
     // Title & subtitle
     $graph->title->Set($this->text_encode($title));
     $graph->title->SetFont($this->gantt_font,GANTT_STYLE,12);
 

Текст патча для jpg-config.inc.php (jpgraph-2.x)

--- src/jpg-config.inc.php  2008-12-02 10:45:18.000000000 +0300
+++ src/jpg-config.inc.php  2008-12-02 13:07:06.000000000 +0300
@@ -38,8 +38,17 @@
 //------------------------------------------------------------------------
 // DEFINE("CACHE_DIR","/tmp/jpgraph_cache/");
 // DEFINE("TTF_DIR","/usr/X11R6/lib/X11/fonts/truetype/");
+DEFINE("TTF_DIR","/usr/share/fonts/truetype/");
 // DEFINE("MBTTF_DIR","/usr/share/fonts/ja/TrueType/");
 
+// UTF-8 fonts for cyrillic language in jpgraph_gantt
+DEFINE("UFONTS",true);
+DEFINE('FF_UFONTS',60);
+DEFINE('UTTF_No','DejaVuSans.ttf');
+DEFINE('UTTF_It','DejaVuSans-Oblique.ttf');
+DEFINE('UTTF_Bd','DejaVuSans-Bold.ttf');
+DEFINE('UTTF_BI','DejaVuSans-BoldOblique.ttf');
+
 //-------------------------------------------------------------------------
 // Cache directory specification for use with CSIM graphs that are
 // using the cache.
 

Текст патча для jpgraph_gantt.php (jpgraph-2.x)

--- src/jpgraph_gantt.php  2008-12-02 13:14:58.000000000 +0300
+++ src/jpgraph_gantt.php  2008-12-02 14:32:56.000000000 +0300
@@ -2553,6 +2553,11 @@
       $txt = strtoupper($txt[0]);
       break;
     }
+    // patch UTF-8
+    if ( !defined('LANGUAGE_CHARSET') || stristr(LANGUAGE_CHARSET, 'UTF-8') ) {
+        $txt = iconv('','UTF-8',$txt);
+    }
+    //
 
     if( $day==0 )
         $img->SetColor($this->day->iSundayTextColor);
@@ -2679,6 +2684,11 @@
     $m=$sn[0];
     break;
   }
+  // patch UTF-8
+  if ( !defined('LANGUAGE_CHARSET') || stristr(LANGUAGE_CHARSET, 'UTF-8') ) {
+    $m = iconv('','UTF-8',$m);
+  }
+  //
   return $m;
     }
 

Текст патча для jpgraph_ttf.inc.php (jpgraph-2.x)

--- src/jpgraph_ttf.inc.php  2006-11-28 10:45:54.000000000 +0300
+++ src/jpgraph_ttf.inc.php  2008-12-02 10:39:19.000000000 +0300
@@ -51,7 +51,7 @@
 
 // Limits for fonts
 DEFINE("_FIRST_FONT",10);
-DEFINE("_LAST_FONT",53);
+DEFINE("_LAST_FONT",60);
 
 // TTF Font styles
 DEFINE("FS_NORMAL",9001);
@@ -302,6 +302,12 @@
           FS_BOLD  =>'',
           FS_ITALIC  =>'',
           FS_BOLDITALIC  =>'' ),
+      /* users fonts */
+      FF_UFONTS => array(FS_NORMAL  =>UTTF_No,
+          FS_BOLD  =>UTTF_Bd,
+          FS_ITALIC  =>UTTF_It,
+          FS_BOLDITALIC  =>UTTF_BI),
+
        );
     }
 

Вариант jpgraph-3.0.6 + eGroupware-1.6.002

Текст патча для class.projectmanager_admin.inc.php (eGroupware-1.6.002)

--- egroupware/projectmanager/inc/class.projectmanager_admin.inc.php  2009-07-20 18:28:11.000000000 +0400
+++ egroupware/projectmanager/inc/class.projectmanager_admin.inc.php  2009-12-31 12:37:53.000000000 +0300
@@ -170,6 +170,13 @@
       FF_MIRIAM    => 'Miriam (Hebrew)',
       FF_AHRON     => 'Ahron (Hebrew)',
 
+      // Dejavu-fonts http://sourceforge.net/projects/dejavu
+      FF_DV_SANSSERIF     => 'Sans Serif (Dejavu)',
+      FF_DV_SERIF         => 'Serif (Dejavu)',
+      FF_DV_SANSSERIFMONO => 'Sans Serif Mono (Dejavu)',
+      FF_DV_SERIFCOND     => 'Serif Cond (Dejavu)',
+      FF_DV_SANSSERIFCOND => 'Sans Serif Cond (Dejavu)',
+
       // Extra fonts
       // Download fonts from
       // http://www.webfontlist.com
@@ -245,6 +252,13 @@
       DEFINE("FF_GOTHIC",42);
       DEFINE("FF_PGOTHIC",43);
 
+      // Dejavu-fonts http://sourceforge.net/projects/dejavu
+      DEFINE("FF_DV_SANSSERIF",47);
+      DEFINE("FF_DV_SERIF",48);
+      DEFINE("FF_DV_SANSSERIFMONO",49);
+      DEFINE("FF_DV_SERIFCOND",50);
+      DEFINE("FF_DV_SANSSERIFCOND",51);
+
       // TTF Font styles
       DEFINE("FS_NORMAL",9001);
       DEFINE("FS_BOLD",9002);
@@ -360,6 +374,33 @@
             FS_BOLD  =>'',
             FS_ITALIC  =>'',
             FS_BOLDITALIC  =>'' ),
+
+        /* Dejavu fonts */
+        FF_DV_SANSSERIF => array(
+            FS_NORMAL  =>'DejaVuSans.ttf',
+            FS_BOLD  =>'DejaVuSans-Bold.ttf',
+            FS_ITALIC  =>'DejaVuSans-Oblique.ttf',
+            FS_BOLDITALIC  =>'DejaVuSans-BoldOblique.ttf' ),
+        FF_DV_SANSSERIFMONO => array(
+            FS_NORMAL  =>'DejaVuSansMono.ttf',
+            FS_BOLD  =>'DejaVuSansMono-Bold.ttf',
+            FS_ITALIC  =>'DejaVuSansMono-Oblique.ttf',
+            FS_BOLDITALIC  =>'DejaVuSansMono-BoldOblique.ttf' ),
+        FF_DV_SANSSERIFCOND => array(
+            FS_NORMAL  =>'DejaVuSansCondensed.ttf',
+            FS_BOLD  =>'DejaVuSansCondensed-Bold.ttf',
+            FS_ITALIC  =>'DejaVuSansCondensed-Oblique.ttf',
+            FS_BOLDITALIC  =>'DejaVuSansCondensed-BoldOblique.ttf' ),
+        FF_DV_SERIF => array(
+            FS_NORMAL  =>'DejaVuSerif.ttf',
+            FS_BOLD  =>'DejaVuSerif-Bold.ttf',
+            FS_ITALIC  =>'DejaVuSerif-Italic.ttf',
+            FS_BOLDITALIC =>'DejaVuSerif-BoldItalic.ttf' ),
+        FF_DV_SERIFCOND => array(
+            FS_NORMAL  =>'DejaVuSerifCondensed.ttf',
+            FS_BOLD  =>'DejaVuSerifCondensed-Bold.ttf',
+            FS_ITALIC  =>'DejaVuSerifCondensed-Italic.ttf',
+            FS_BOLDITALIC  =>'DejaVuSerifCondensed-BoldItalic.ttf' ),
     );
     return $font_files[$font][$style];
   }
 

Текст патча для class.projectmanager_ganttchart.inc.php (eGroupware-1.6.002)

--- egroupware/projectmanager/inc/class.projectmanager_ganttchart.inc.php  2009-12-31 11:44:40.000000000 +0300
+++ egroupware/projectmanager/inc/class.projectmanager_ganttchart.inc.php  2009-12-31 11:46:32.000000000 +0300
@@ -40,7 +40,7 @@
         '/usr/share/fonts/ja/TrueType/',    // japanese fonts
         '/usr/share/fonts/msttcorefonts/',     // to install this fonts see http://www.aditus.nu/jpgraph/jpdownload.php
         'C:/windows/fonts/',          // windows default
-        // add your location here or to egw_config.config_value for config_app='projectmanger' AND config_name='TTF_DIR'
+        '/usr/share/fonts/truetype/',  // add your location here or to egw_config.config_value for config_app='projectmanger' AND config_name='TTF_DIR'
         EGW_SERVER_ROOT.'/projectmanager/inc/ttf-bitstream-vera-1.10/',  // our bundled Vera font
       ) as $dir)
       {
@@ -210,7 +210,7 @@
 
     // convert everything above ascii to nummeric html entities
     // not sure if this is necessary for non iso-8859-1 charsets, try to comment it out if you have problems
-    if ($this->gantt_char_encode) $text = preg_replace('/[^\x00-\x7F]/e', '"&#".ord("$0").";"',$text);
+    //if ($this->gantt_char_encode) $text = preg_replace('/[^\x00-\x7F]/e', '"&#".ord("$0").";"',$text);
 
     return $text;
   }
@@ -303,6 +303,8 @@
     // Change the font scale
     $graph->scale->week->SetFont($this->gantt_font,FS_NORMAL,8);
     $graph->scale->year->SetFont($this->gantt_font,GANTT_STYLE,10);
+    $graph->scale->day->SetFont($this->gantt_font,FS_NORMAL,6);
+    $graph->scale->month->SetFont($this->gantt_font,FS_NORMAL,6);
 
     // Title & subtitle
     $graph->title->Set($this->text_encode($title));
 

Текст патча для jpg-config.inc.php (jpgraph-3.0.6)

--- src/jpg-config.inc.php  1970-01-01 12:13:08.000000000 +0300
+++ src/jpg-config.inc.php  2010-02-03 11:25:41.000000000 +0300
@@ -36,7 +36,7 @@
 //
 //------------------------------------------------------------------------
 // define('CACHE_DIR','/tmp/jpgraph_cache/');
-// define('TTF_DIR','/usr/share/fonts/truetype/');
+define('TTF_DIR','/usr/share/fonts/truetype/');
 // define('MBTTF_DIR','/usr/share/fonts/truetype/');
 
 //-------------------------------------------------------------------------
 

Текст патча для jpgraph_gantt.php (jpgraph-3.0.6)

--- src/jpgraph_gantt.php  1970-01-01 12:13:08.000000000 +0300
+++ src/jpgraph_gantt.php  2010-02-02 19:58:10.000000000 +0300
@@ -2659,6 +2659,11 @@
                         $txt = strtoupper($txt[0]);
                         break;
                 }
+                // patch UTF-8
+                if ( !defined('LANGUAGE_CHARSET') || stristr(LANGUAGE_CHARSET, 'UTF-8') ) {
+                    $txt = iconv('','UTF-8',$txt);
+                }
+                //
 
                 if( $day==0 )
                     $img->SetColor($this->day->iSundayTextColor);
@@ -2786,6 +2791,11 @@
                 $m=$sn[0];
                 break;
         }
+        // patch UTF-8
+        if ( !defined('LANGUAGE_CHARSET') || stristr(LANGUAGE_CHARSET, 'UTF-8') ) {
+            $m = iconv('','UTF-8',$m);
+        }
+        //
         return $m;
     }
 
 

Дополнительно

Если при выполнении asyncwrapper.php в cron появляется ошибка:
PHP Notice: Undefined index: _ in /usr/share/egroupware/phpgwapi/cron/asyncwrapper.php on line 30 sh: -q: command not found.
То это значит, что для пользователя, под которым запускается задание, не установлена переменная $_ENV["_"], используемая в asyncwrapper.php.
Достаточно заменить $_ENV["_"] на полный путь к php5 например /usr/bin/php5.
Примерно так:

...
system('/usr/bin/php5 -q -d memory_limit=16M '.$path_to_egroupware.'/phpgwapi/cron/asyncservices.php '. $matches[1]);
...

Если отдельные страницы (всплывающие) отображаются в неверной кодировке, можно установить по умолчанию нужную в php.ini:

...
; PHP's built-in default is text/html
default_mimetype = "text/html"
default_charset = "UTF-8"
...