mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 15:38:27 +01:00
Get most submit actions working
This commit is contained in:
parent
f50c5f2799
commit
b2e9b07af8
@ -685,7 +685,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
$value = self::get_array($content, $form_name);
|
$value = self::get_array($content, $form_name);
|
||||||
|
|
||||||
// On client, rows does not get its own namespace, but all apps are expecting it
|
// On client, rows does not get its own namespace, but all apps are expecting it
|
||||||
$value[$form_name]['rows'] = $value;
|
$value['rows'] = $value;
|
||||||
|
|
||||||
// Save current column settings as default (admins only)
|
// Save current column settings as default (admins only)
|
||||||
if($value['as_default'])
|
if($value['as_default'])
|
||||||
@ -703,7 +703,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
$GLOBALS['egw']->preferences->save_repository(false,'default');
|
$GLOBALS['egw']->preferences->save_repository(false,'default');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$validated = $value;
|
$validated[$form_name] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -278,6 +278,9 @@ var et2_dataview_selectionManager = Class.extend({
|
|||||||
|
|
||||||
// Create an action object for the tr and connect it to a dummy AOI
|
// Create an action object for the tr and connect it to a dummy AOI
|
||||||
_entry.ao = this._actionObjectManager.addObject(_uid, dummyAOI);
|
_entry.ao = this._actionObjectManager.addObject(_uid, dummyAOI);
|
||||||
|
|
||||||
|
// Force context (actual widget) in here, it's the last place it's available
|
||||||
|
_entry.ao._context = this._context;
|
||||||
_entry.ao.updateActionLinks(_links);
|
_entry.ao.updateActionLinks(_links);
|
||||||
_entry.ao._index = _idx;
|
_entry.ao._index = _idx;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ var et2_INextmatchSortable = new Interface({
|
|||||||
/**
|
/**
|
||||||
* Class which implements the "nextmatch" XET-Tag
|
* Class which implements the "nextmatch" XET-Tag
|
||||||
*/
|
*/
|
||||||
var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], {
|
||||||
|
|
||||||
attributes: {
|
attributes: {
|
||||||
"template": {
|
"template": {
|
||||||
@ -845,10 +845,15 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
|
|||||||
|
|
||||||
getPath: function() {
|
getPath: function() {
|
||||||
var path = this._super.apply(this,arguments);
|
var path = this._super.apply(this,arguments);
|
||||||
if(this.id) path.push(this.id);
|
if(this.id && path[path.length -1] == this.id) path.pop();
|
||||||
return path;
|
return path;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// Input widget
|
||||||
|
getValue: function() { return null;},
|
||||||
|
resetDirty: function() {},
|
||||||
|
isDirty: function() { return false;}
|
||||||
});
|
});
|
||||||
|
|
||||||
et2_register_widget(et2_nextmatch, ["nextmatch"]);
|
et2_register_widget(et2_nextmatch, ["nextmatch"]);
|
||||||
|
@ -130,19 +130,32 @@ function nm_action(_action, _senders, _target, _ids)
|
|||||||
for (var i in checkboxes)
|
for (var i in checkboxes)
|
||||||
checkboxes_elem.value += checkboxes[i].id + ":" + (checkboxes[i].checked ? "1" : "0") + ";";
|
checkboxes_elem.value += checkboxes[i].id + ":" + (checkboxes[i].checked ? "1" : "0") + ";";
|
||||||
|
|
||||||
document.getElementById(mgr.etemplate_var_prefix+'[nm][nm_action]').value = _action.id;
|
var nextmatch = _action.data.nextmatch;
|
||||||
document.getElementById(mgr.etemplate_var_prefix+'[nm][selected]').value = ids;
|
if(!nextmatch && _senders.length)
|
||||||
if (typeof _action.data.button != 'undefined')
|
|
||||||
{
|
{
|
||||||
submitit(mgr.etemplate_form.context, mgr.etemplate_var_prefix+'[nm][rows]['+_action.data.button+']['+ids+']');
|
// Pull it from deep within, where it was stuffed in et2_dataview_controller_selection._attachActionObject()
|
||||||
|
nextmatch = _senders[0]._context._widget;
|
||||||
|
}
|
||||||
|
if(nextmatch)
|
||||||
|
{
|
||||||
|
// Fake a getValue() function
|
||||||
|
nextmatch.getValue = function() {
|
||||||
|
var value = {
|
||||||
|
"selected": idsArr,
|
||||||
|
"checkboxes": checkboxes_elem ? checkboxes_elem.value : null
|
||||||
|
};
|
||||||
|
value[nextmatch.options.settings.action_var]= _action.id;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
nextmatch.getInstanceManager().submit();
|
||||||
|
|
||||||
|
// Clear action in case there's another one
|
||||||
|
delete nextmatch.getValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mgr.etemplate_form.submit();
|
egw().debug("error", "Missing nextmatch widget, could not submit", _action);
|
||||||
}
|
}
|
||||||
// Clear action in case there's another one
|
|
||||||
document.getElementById(mgr.etemplate_var_prefix+'[nm][nm_action]').value = null;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,8 +240,7 @@ var nm_popup_action, nm_popup_ids = null;
|
|||||||
*/
|
*/
|
||||||
function nm_open_popup(_action, _ids)
|
function nm_open_popup(_action, _ids)
|
||||||
{
|
{
|
||||||
var popup = document.getElementById(_action.getManager().etemplate_var_prefix + '[' + _action.id + '_popup]');
|
var popup = jQuery("#"+_action.id+"_popup").get(0) || jQuery("[id*='" + _action.id + "_popup']").get(0);
|
||||||
|
|
||||||
if (popup) {
|
if (popup) {
|
||||||
nm_popup_action = _action;
|
nm_popup_action = _action;
|
||||||
nm_popup_ids = _ids;
|
nm_popup_ids = _ids;
|
||||||
@ -241,10 +253,20 @@ function nm_open_popup(_action, _ids)
|
|||||||
*/
|
*/
|
||||||
function nm_submit_popup(button)
|
function nm_submit_popup(button)
|
||||||
{
|
{
|
||||||
button.form.submit_button.value = button.name; // set name of button (sub-action)
|
if(button.form)
|
||||||
|
{
|
||||||
|
button.form.submit_button.value = button.name; // set name of button (sub-action)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mangle senders to get IDs where nm_action() wants them
|
||||||
|
// No idea why this is needed
|
||||||
|
var ids = {ids:[]};
|
||||||
|
for(var i in nm_popup_ids)
|
||||||
|
{
|
||||||
|
ids.ids.push(nm_popup_ids[i].id);
|
||||||
|
}
|
||||||
// call regular nm_action to transmit action and senders correct
|
// call regular nm_action to transmit action and senders correct
|
||||||
nm_action(nm_popup_action, null, null, nm_popup_ids);
|
nm_action(nm_popup_action,nm_popup_ids, null, ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,7 +275,7 @@ function nm_submit_popup(button)
|
|||||||
function nm_hide_popup(element, div_id)
|
function nm_hide_popup(element, div_id)
|
||||||
{
|
{
|
||||||
var prefix = element.id.substring(0,element.id.indexOf('['));
|
var prefix = element.id.substring(0,element.id.indexOf('['));
|
||||||
var popup = document.getElementById(prefix+'['+div_id+']');
|
var popup = jQuery("#"+_action.id+"_popup").get(0) || jQuery("[id*='" + _action.id + "_popup']").get(0);
|
||||||
|
|
||||||
// Hide popup
|
// Hide popup
|
||||||
if(popup) {
|
if(popup) {
|
||||||
|
@ -128,6 +128,10 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
|
|||||||
// Get the selected ids descriptor object
|
// Get the selected ids descriptor object
|
||||||
var ids = self._selectionMgr.getSelected();
|
var ids = self._selectionMgr.getSelected();
|
||||||
|
|
||||||
|
// Pass a reference to the actual widget
|
||||||
|
if (typeof _action.data == 'undefined' || !_action.data) _action.data = {};
|
||||||
|
_action.data.nextmatch = self._widget;
|
||||||
|
|
||||||
// Call the nm_action function with the ids
|
// Call the nm_action function with the ids
|
||||||
nm_action(_action, _senders, _target, ids);
|
nm_action(_action, _senders, _target, ids);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user