forked from extern/egroupware
More work on nm actions that need real submit (POST)
This commit is contained in:
parent
16dddb46db
commit
d4aed5cf03
@ -35,9 +35,9 @@ if (!isset($GLOBALS['egw_info']))
|
||||
*
|
||||
* @ToDo supported customized templates stored in DB, currently we only support xet files stored in filesystem
|
||||
*/
|
||||
class etemplate extends etemplate_old {};
|
||||
class etemplate_new extends etemplate_widget_template
|
||||
//class etemplate extends etemplate_widget_template
|
||||
//class etemplate extends etemplate_old {};
|
||||
//class etemplate_new extends etemplate_widget_template
|
||||
class etemplate extends etemplate_widget_template
|
||||
{
|
||||
/**
|
||||
* Are we running as sitemgr module or not
|
||||
@ -50,7 +50,7 @@ class etemplate_new extends etemplate_widget_template
|
||||
* Tell egw framework it's ok to call this
|
||||
*/
|
||||
public $public_functions = array(
|
||||
'ajax_post_process' => true
|
||||
'process_exec' => true
|
||||
);
|
||||
|
||||
/**
|
||||
@ -225,8 +225,12 @@ class etemplate_new extends etemplate_widget_template
|
||||
/**
|
||||
* Process via POST submitted content
|
||||
*/
|
||||
static public function ajax_process_post()
|
||||
static public function process_exec()
|
||||
{
|
||||
$etemplate_exec_id = $_POST['etemplate_exec_id'];
|
||||
$content = json_decode($_POST['value'],true);
|
||||
error_log(__METHOD__."(".array2string($content).")");
|
||||
|
||||
self::$request = etemplate_request::read($_POST['etemplate_exec_id']);
|
||||
if (get_magic_quotes_gpc()) $_POST['value'] = stripslashes($_POST['value']);
|
||||
$content = json_decode($_POST['value'],true);
|
||||
|
@ -145,7 +145,7 @@ function nm_action(_action, _senders, _target, _ids)
|
||||
"checkboxes": checkboxes_elem ? checkboxes_elem.value : null
|
||||
};
|
||||
value[nextmatch.options.settings.action_var]= _action.id;
|
||||
if(_target && _target.id) value[_target.id] = true;
|
||||
//if(_target && _target.id) value[_target.id] = true;
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -255,7 +255,20 @@ function nm_open_popup(_action, _ids)
|
||||
var popup = jQuery("#"+_action.id+"_popup").get(0) || jQuery("[id*='" + _action.id + "_popup']").get(0);
|
||||
if (popup) {
|
||||
nm_popup_action = _action;
|
||||
nm_popup_ids = _ids;
|
||||
if(_ids.length && typeof _ids[0] == 'object')
|
||||
{
|
||||
egw().debug("warn", 'Not proper format for IDs');
|
||||
_action.data.nextmatch = _ids[0]._context._widget;
|
||||
nm_popup_ids = [];
|
||||
for(var i = 0; i < _ids.length; i++)
|
||||
{
|
||||
nm_popup_ids.push(_ids[i].id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nm_popup_ids = _ids;
|
||||
}
|
||||
popup.style.display = 'block';
|
||||
/*
|
||||
Not working yet - DOM manipulation causes et2 problems
|
||||
@ -304,6 +317,8 @@ function nm_submit_popup(button)
|
||||
}
|
||||
// call regular nm_action to transmit action and senders correct
|
||||
nm_action(nm_popup_action,nm_popup_ids, button, ids);
|
||||
|
||||
nm_hide_popup(button, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,7 +327,7 @@ function nm_submit_popup(button)
|
||||
function nm_hide_popup(element, div_id)
|
||||
{
|
||||
var prefix = element.id.substring(0,element.id.indexOf('['));
|
||||
var popup = jQuery("#"+_action.id+"_popup").get(0) || jQuery("[id*='" + _action.id + "_popup']").get(0);
|
||||
var popup = jQuery("#"+prefix+"_popup").get(0) || jQuery("[id*='" + prefix + "_popup']").get(0);
|
||||
|
||||
// Hide popup
|
||||
if(popup) {
|
||||
|
@ -313,7 +313,8 @@ etemplate2.prototype.postSubmit = function()
|
||||
|
||||
if (canSubmit)
|
||||
{
|
||||
var form = jQuery("<form id='form' action='"+egw().webserverUrl + "/json.php?menuaction=etemplate::ajax_process_post' method='POST'>");
|
||||
var form = jQuery("<form id='form' action='"+egw().webserverUrl +
|
||||
"/etemplate/process_exec.php?menuaction=" + this.widgetContainer.egw().getAppName()+ "' method='POST'>");
|
||||
|
||||
var etemplate_id = jQuery(document.createElement("input"))
|
||||
.attr("name",'etemplate_exec_id')
|
||||
@ -324,7 +325,6 @@ etemplate2.prototype.postSubmit = function()
|
||||
input.name = 'value';
|
||||
input.value = egw().jsonEncode(values);
|
||||
form.append(input);
|
||||
|
||||
form.appendTo(jQuery('body')).submit();
|
||||
}
|
||||
}
|
||||
|
@ -21,4 +21,4 @@ $GLOBALS['egw_info'] = array(
|
||||
);
|
||||
include('../header.inc.php');
|
||||
|
||||
ExecMethod('etemplate.etemplate_old.process_exec');
|
||||
ExecMethod('etemplate.etemplate.process_exec');
|
||||
|
Loading…
Reference in New Issue
Block a user