mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
Ajax select widget fixes:
- Remove the need for the user to have access to the eTemplate app - Fix some settings being lost, and inability to clear the widget
This commit is contained in:
parent
bdf27e11d9
commit
b43a9982e3
@ -176,7 +176,12 @@
|
||||
$GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
|
||||
}
|
||||
$options = $GLOBALS['egw']->js->convert_phparray_jsarray("options['$name']", $options, true);
|
||||
$GLOBALS['egw']->js->set_onload("if(!options) { var options = new Object();}\n $options;\n ajax_select_widget_setup('$name', '$onchange', options['$name']); ");
|
||||
$GLOBALS['egw']->js->set_onload("if(!options) {
|
||||
var options = new Object();
|
||||
}\n
|
||||
$options;\n
|
||||
ajax_select_widget_setup('$name', '$onchange', options['$name'], '" . $GLOBALS['egw_info']['flags']['currentapp'] . "');
|
||||
");
|
||||
$GLOBALS['egw']->js->validate_file('', 'ajax_select', 'etemplate');
|
||||
|
||||
return True; // no extra label
|
||||
@ -202,7 +207,7 @@
|
||||
if(!is_object($get_rows_obj) || !method_exists($get_rows_obj, $get_rows_method)) {
|
||||
echo "$get_rows_app.$get_rows_class.$get_rows_method is not a valid method for getting the rows";
|
||||
} else {
|
||||
$query = $extension_data + $value_in;
|
||||
$query = array_merge($extension_data, $value_in);
|
||||
$count = $get_rows_obj->$get_rows_method($query, $results);
|
||||
|
||||
if($count == 1) {
|
||||
@ -218,7 +223,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (!$value_in['value'] && !$value_in['search']) {
|
||||
} elseif ($value_in['search'] == '') {
|
||||
// They're trying to clear the form
|
||||
$value = null;
|
||||
$loop = $GLOBALS['egw_info']['etemplate']['loop'] || $extension_data['required'];
|
||||
return !$extension_data['required'];
|
||||
|
@ -19,8 +19,10 @@
|
||||
-->
|
||||
|
||||
//xajaxDebug = 1;
|
||||
var current_app = 'etemplate';
|
||||
|
||||
function ajax_select_widget_setup(widget_id, onchange, options) {
|
||||
function ajax_select_widget_setup(widget_id, onchange, options, currentapp) {
|
||||
current_app = currentapp;
|
||||
if(onchange) {
|
||||
if(onchange == 1) {
|
||||
onchange = function() {submitit(this.form, this.value);};
|
||||
@ -117,7 +119,7 @@ function change(e, value) {
|
||||
selects[i].style.visibility = 'hidden';
|
||||
}
|
||||
}
|
||||
xajax_doXMLHTTP("etemplate.ajax_select_widget.ajax_search.etemplate", id, value, set_id, query);
|
||||
xajax_doXMLHTTP(current_app + ".ajax_select_widget.ajax_search.etemplate", id, value, set_id, query);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user