use egw.includeJS instead of egw.ready for ajax-exec, eg. used in mail

This commit is contained in:
Ralf Becker 2013-02-13 16:30:30 +00:00
parent 5f1c76ae91
commit bfc0c48210

View File

@ -174,7 +174,25 @@ class etemplate_new extends etemplate_widget_template
$langRequire[] = array('app' => $app, 'lang' => $lang);
}
echo '
// check if we are in an ajax-exec call from jdots template (or future other tabed templates)
if (isset($GLOBALS['egw']->framework->response))
{
echo '
<div id="container"></div>
<script>
egw.langRequire(window, '.json_encode($langRequire).');
egw(window).includeJS('.json_encode(egw_framework::get_script_links(true, true)). // return and clear
',function() {
egw.debug("info", "Instanciating etemplate2 object for '.$this->name.'");
var et2 = new etemplate2(document.getElementById("container"), "etemplate::ajax_process_content");
et2.load("'.$this->name.'","'.$GLOBALS['egw_info']['server']['webserver_url'].$this->rel_path.'",'.json_encode($data).');
}, window, egw.webserverUrl);
</script>
';
}
else
{
echo '
<div id="container"></div>
<script>
egw.langRequire(window, '.json_encode($langRequire).');
@ -184,6 +202,7 @@ class etemplate_new extends etemplate_widget_template
}, null, true);
</script>
';
}
common::egw_footer();
}
}