Now always including egw and etemplate2 javascript code if we are in the top window

This commit is contained in:
Andreas Stöckel 2012-03-08 14:05:00 +00:00
parent 60a2fd9855
commit df06f6657c
5 changed files with 28 additions and 26 deletions

View File

@ -101,17 +101,12 @@ class etemplate_new extends etemplate_widget_template
*/ */
function exec($method,$content,$sel_options='',$readonlys='',$preserv='',$output_mode=0,$ignore_validation='',$changes='') function exec($method,$content,$sel_options='',$readonlys='',$preserv='',$output_mode=0,$ignore_validation='',$changes='')
{ {
// Overwrite "nonavbar" is the output_mode is two
$GLOBALS['egw_info']['flags']['nonavbar'] = ($output_mode == 2);
if (!$this->rel_path) throw new egw_exception_assertion_failed('No (valid) template read!'); if (!$this->rel_path) throw new egw_exception_assertion_failed('No (valid) template read!');
// load translations
translation::add_app('etemplate');
foreach(translation::$loaded_apps as $app => $lang)
{
egw_framework::validate_file('/phpgwapi/lang.php', array(
'app' => $app,
'lang' => $lang,
));
}
// generate new etemplate request object // generate new etemplate request object
self::$request = etemplate_request::read(); self::$request = etemplate_request::read();
self::$request->output_mode = $output_mode; // let extensions "know" they are run eg. in a popup self::$request->output_mode = $output_mode; // let extensions "know" they are run eg. in a popup
@ -151,7 +146,6 @@ class etemplate_new extends etemplate_widget_template
{ {
// missing dependency, thought egw:uses jquery.jquery.tools does NOT work, maybe we should rename it to jquery-tools // missing dependency, thought egw:uses jquery.jquery.tools does NOT work, maybe we should rename it to jquery-tools
egw_framework::validate_file('jquery','jquery.tools.min'); egw_framework::validate_file('jquery','jquery.tools.min');
egw_framework::validate_file('.','etemplate2','etemplate');
egw_framework::includeCSS('/etemplate/js/test/test.css'); egw_framework::includeCSS('/etemplate/js/test/test.css');
common::egw_header(); common::egw_header();

View File

@ -113,7 +113,7 @@ var et2_inputWidget = et2_valueWidget.extend(et2_IInput, {
change: function(_node) { change: function(_node) {
if (this.onchange) if (this.onchange)
{ {
return this.onchange(_node); return et2_compileLegacyJS(this.onchange, this, _node)();
} }
}, },

View File

@ -14,9 +14,6 @@
/*egw:uses /*egw:uses
jquery.jquery; jquery.jquery;
jscalendar.calendar-setup;
jscalendar.calendar;
/phpgwapi/js/jscalendar/lang/calendar-en.js;
lib/date; lib/date;
et2_core_inputWidget; et2_core_inputWidget;
et2_core_valueWidget; et2_core_valueWidget;
@ -81,17 +78,10 @@ var et2_date = et2_inputWidget.extend({
if (!dateformat) dateformat = "Y-m-d"; if (!dateformat) dateformat = "Y-m-d";
dateformat = dateformat.replace("Y","%Y").replace("d","%d").replace("m","%m").replace("M", "%b"); dateformat = dateformat.replace("Y","%Y").replace("d","%d").replace("m","%m").replace("M", "%b");
var setup = { this.egw().calendar(this.input_date, this.button,
inputField: this.options.id, function(_value) {
button: this.button.attr("id"), this.set_value(_value);
showsTime: false, }, this);
onUpdate: function(_value) {_this.set_value(_value)},
daFormat: dateformat,
firstDay: this.egw().preference("weekdaystarts","calendar")
};
/*window.setTimeout(function() {
Calendar.setup(setup);
}, 500);*/
} }
// If date also has a time, or browser doesn't support HTML5 time type // If date also has a time, or browser doesn't support HTML5 time type

View File

@ -94,7 +94,7 @@ abstract class egw_framework
'/phpgwapi/js/./egw_json.js', '/phpgwapi/js/./egw_json.js',
// always include javascript helper functions // always include javascript helper functions
'/phpgwapi/js/jsapi/jsapi.js', '/phpgwapi/js/jsapi/jsapi.js',
'/phpgwapi/js/jsapi/egw.js', // '/phpgwapi/js/jsapi/egw.js',
)); ));
} }

View File

@ -64,6 +64,8 @@ class idots_framework extends egw_framework
{ {
parent::__construct($template); // call the constructor of the extended class parent::__construct($template); // call the constructor of the extended class
$GLOBALS['egw_info']['flags']['js_link_registry'] = true;
$this->tplsav2 = new tplsavant2(); $this->tplsav2 = new tplsavant2();
$this->tplsav2->set_tpl_path(EGW_SERVER_ROOT.SEP.'phpgwapi'.SEP.'templates'.SEP.'idots'); $this->tplsav2->set_tpl_path(EGW_SERVER_ROOT.SEP.'phpgwapi'.SEP.'templates'.SEP.'idots');
} }
@ -87,6 +89,22 @@ class idots_framework extends egw_framework
if (self::$header_done) return ''; if (self::$header_done) return '';
self::$header_done = true; self::$header_done = true;
// load translations
translation::add_app('etemplate');
foreach(translation::$loaded_apps as $app => $lang)
{
egw_framework::validate_file('/phpgwapi/lang.php', array(
'app' => $app,
'lang' => $lang,
));
}
if ($this->isTop(false))
{
self::validate_file('jsapi', 'egw', 'phpgwapi');
self::validate_file('.', 'etemplate2', 'etemplate');
}
// add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv) // add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv)
header('Content-type: text/html; charset='.translation::charset()); header('Content-type: text/html; charset='.translation::charset());