diff --git a/phpgwapi/inc/class.jscalendar.inc.php b/phpgwapi/inc/class.jscalendar.inc.php index 37fffa30a4..ae37eaee02 100644 --- a/phpgwapi/inc/class.jscalendar.inc.php +++ b/phpgwapi/inc/class.jscalendar.inc.php @@ -39,20 +39,22 @@ class jscalendar * @param string $path='jscalendar' * @return jscalendar */ - function jscalendar($do_header=True,$path='jscalendar') + function jscalendar($do_header=True,$path='jscalendar',$scriptreturn=false) { $this->jscalendar_url = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/'.$path; $this->dateformat = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; - if ($do_header && (strpos($GLOBALS['egw_info']['flags']['java_script'],'jscalendar')===false)) - { - $GLOBALS['egw_info']['flags']['java_script'] .= + $js= ' '; + if ($do_header && (strpos($GLOBALS['egw_info']['flags']['java_script'],'jscalendar')===false)) + { + $GLOBALS['egw_info']['flags']['java_script'] .=$js; } + if ($scriptreturn==true) return $js; //if the header is already send to the Browser } /** @@ -140,6 +142,7 @@ Calendar.setup( */ function flat($url,$date=null,$weekUrl='',$weekTTip='',$monthUrl='',$monthTTip='',$id='calendar-container') { + $javascript=$this->jscalendar(false,'jscalendar',true); if ($date) // string if format YYYYmmdd or timestamp { $date = is_int($date) ? adodb_date('m/d/Y',$date) : @@ -147,7 +150,7 @@ Calendar.setup( } return '
- +'.$javascript.' '; }