add this.form.submit() to legacy functions and use regular nextmatch filter-change, if onchange="this.form.submit()" is set, some more changes etemplate_new --> etemplate

This commit is contained in:
Ralf Becker 2012-03-29 15:10:25 +00:00
parent 4e0ea875b9
commit cedb8e3f6c
3 changed files with 19 additions and 11 deletions

View File

@ -18,7 +18,7 @@ if (!isset($GLOBALS['egw_info']))
'flags' => array(
'currentapp' => $_REQUEST['sessionid'] ? 'etemplate' : 'login',
'nonavbar' => true,
'debug' => 'etemplate_new',
'debug' => 'etemplate',
)
);
include_once '../../header.inc.php';
@ -174,7 +174,7 @@ class etemplate_new extends etemplate_widget_template
<script>
egw.langRequire(window, '.json_encode($langRequire).');
egw(window).ready(function() {
var et2 = new etemplate2(document.getElementById("container"), "etemplate_new::ajax_process_content");
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).');
}, null, true);
</script>
@ -419,7 +419,6 @@ class etemplate_new extends etemplate_widget_template
* creates HTML from an eTemplate
*
* Compatibility function for calendar, which uses etemplate::show to generate html --> use etemplate_old class
* @todo Once etemplate_new is renamed to etemplate and we have an explicit etemplate_old class, change it at caller (egw. calendar)
*
* This is done by calling show_cell for each cell in the form. show_cell itself
* calls show recursivly for each included eTemplate.
@ -445,10 +444,11 @@ class etemplate_new extends etemplate_widget_template
}
}
if ($GLOBALS['egw_info']['flags']['debug'] == 'etemplate_new')
if ($GLOBALS['egw_info']['flags']['debug'] == 'etemplate')
{
$name = isset($_GET['name']) ? $_GET['name'] : 'timesheet.edit';
$template = new etemplate_new();
$template = new etemplate();
if (!$template->read($name))
{
header('HTTP-Status: 404 Not Found');

View File

@ -77,6 +77,11 @@
_val = _val.replace(/^xajax_doXMLHTTP\('etemplate\.([a-z]+_widget\.[a-zA-Z0-9_]+)\'/,
"xajax_doXMLHTTP('"+egw.getAppName()+".$1.etemplate'");
}
if (_val.indexOf('this.form.submit()') != -1)
{
_val = _val.replace('this.form.submit()','widget.getInstanceManager().submit()');
}
return _val;
}

View File

@ -1052,7 +1052,8 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader, {
// Set onChange
var input = select.input;
if(this.nextmatch.options.settings[name+"_onchange"])
if (this.nextmatch.options.settings[name+"_onchange"] &&
!this.nextmatch.options.settings[name+"_onchange"].match('/^this\.form\.submit();?$/'))
{
// Get the onchange function string
var onchange = this.nextmatch.options.settings[name+"_onchange"];
@ -1060,11 +1061,13 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader, {
// Connect it to the onchange event of the input element
input.change(this.nextmatch, et2_compileLegacyJS(onchange, this.nextmatch, input));
}
input.change(this.nextmatch, function(event) {
event.data.activeFilters[name] = input.val()
event.data.applyFilters();
});
else // default request changed rows with new filters, previous this.form.submit()
{
input.change(this.nextmatch, function(event) {
event.data.activeFilters[name] = input.val();
event.data.applyFilters();
});
}
return select;
},