mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 12:51:52 +02:00
If hooked, keep app in extension_data to persist across etemplate loops. Fixes lost infolog custom fields in addressbook view when changing nm filters
- Attempt 2, see r36788.
This commit is contained in:
parent
a76985d1d2
commit
587418fca2
@ -26,6 +26,7 @@ class customfields_widget
|
|||||||
{
|
{
|
||||||
var $public_functions = array(
|
var $public_functions = array(
|
||||||
'pre_process' => True,
|
'pre_process' => True,
|
||||||
|
'post_process' => True,
|
||||||
);
|
);
|
||||||
var $human_name = array(
|
var $human_name = array(
|
||||||
'customfields' => 'custom fields',
|
'customfields' => 'custom fields',
|
||||||
@ -112,10 +113,16 @@ class customfields_widget
|
|||||||
function pre_process($form_name,&$value,&$cell,&$readonlys,&$extension_data,etemplate $tmpl)
|
function pre_process($form_name,&$value,&$cell,&$readonlys,&$extension_data,etemplate $tmpl)
|
||||||
{
|
{
|
||||||
list($app) = explode('.',$tmpl->name);
|
list($app) = explode('.',$tmpl->name);
|
||||||
|
if($extension_data['app']) $app = $extension_data['app'];
|
||||||
// if we are in the etemplate editor or the app has no cf's, load the cf's from the app the tpl belongs too
|
// if we are in the etemplate editor or the app has no cf's, load the cf's from the app the tpl belongs too
|
||||||
if ($app && $app != 'stylite' && $app != $this->appname && ($this->appname == 'etemplate' || !$this->customfields || etemplate::$hooked))
|
if ($app && $app != 'stylite' && $app != $this->appname && (
|
||||||
|
$this->appname == 'etemplate' || !$this->customfields || etemplate::$hooked || $extension_data['app']
|
||||||
|
))
|
||||||
{
|
{
|
||||||
self::__construct(null,$app); // app changed
|
self::__construct(null,$app); // app changed
|
||||||
|
|
||||||
|
// Need to keep hooked app for things like nm filter changes and validation errors
|
||||||
|
if(etemplate::$hooked) $extension_data['app'] = $app;
|
||||||
}
|
}
|
||||||
list($type2,$use_private,$field_names) = explode(',',$cell['size'],3);
|
list($type2,$use_private,$field_names) = explode(',',$cell['size'],3);
|
||||||
$fields_with_vals=array();
|
$fields_with_vals=array();
|
||||||
@ -493,6 +500,14 @@ class customfields_widget
|
|||||||
return True; // extra Label is ok
|
return True; // extra Label is ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override to pass along extension_data - doesn't happen otherwise
|
||||||
|
*/
|
||||||
|
public function post_process($name,&$value,&$extension_data,&$loop,etemplate &$tmpl,$value_in) {
|
||||||
|
$value = $value_in;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the options of a 'select' or 'radio' custom field from a file
|
* Read the options of a 'select' or 'radio' custom field from a file
|
||||||
*
|
*
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
*
|
*
|
||||||
* etemplate or uietemplate extends boetemplate, all vars and public functions are inherited
|
* etemplate or uietemplate extends boetemplate, all vars and public functions are inherited
|
||||||
*/
|
*/
|
||||||
|
//class etemplate extends etemplate_new {}
|
||||||
|
//class etemplate_old extends boetemplate
|
||||||
class etemplate extends boetemplate
|
class etemplate extends boetemplate
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +24,8 @@ if (!isset($GLOBALS['egw_info']))
|
|||||||
include_once '../../header.inc.php';
|
include_once '../../header.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$GLOBALS['egw_info']['flags']['js_link_registry'] = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New eTemplate serverside contains:
|
* New eTemplate serverside contains:
|
||||||
* - main server methods like read, exec
|
* - main server methods like read, exec
|
||||||
|
@ -86,6 +86,9 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
|
|||||||
|
|
||||||
// Store properties at top level, so all customfield widgets can share
|
// Store properties at top level, so all customfield widgets can share
|
||||||
$app =& $this->getElementAttribute(self::GLOBAL_VALS, 'app');
|
$app =& $this->getElementAttribute(self::GLOBAL_VALS, 'app');
|
||||||
|
// Value needs a text key, so it gets handled as a js object, not an array
|
||||||
|
//$this->setElementAttribute(self::GLOBAL_VALS, 'fields', Array('parse_as_object'=>null));
|
||||||
|
$this->setElementAttribute(self::GLOBAL_VALS, 'fields', Array());
|
||||||
if($this->getElementAttribute($form_name, 'app'))
|
if($this->getElementAttribute($form_name, 'app'))
|
||||||
{
|
{
|
||||||
$app =& $this->getElementAttribute($form_name, 'app');
|
$app =& $this->getElementAttribute($form_name, 'app');
|
||||||
|
@ -1471,6 +1471,7 @@ class nextmatch_widget
|
|||||||
$value['start'] = 0;
|
$value['start'] = 0;
|
||||||
$value['num_rows'] = 500;
|
$value['num_rows'] = 500;
|
||||||
$value['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
$value['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
|
||||||
|
$start = microtime(true);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!($total = self::call_get_rows($value,$rows)))
|
if (!($total = self::call_get_rows($value,$rows)))
|
||||||
@ -1505,6 +1506,7 @@ class nextmatch_widget
|
|||||||
}
|
}
|
||||||
while($total > $value['start']);
|
while($total > $value['start']);
|
||||||
|
|
||||||
|
$time = microtime(true) - $start;
|
||||||
unset($value['csv_export']);
|
unset($value['csv_export']);
|
||||||
$value['start'] = $backup_start;
|
$value['start'] = $backup_start;
|
||||||
$value['num_rows'] = $backup_num_rows;
|
$value['num_rows'] = $backup_num_rows;
|
||||||
@ -1512,6 +1514,8 @@ class nextmatch_widget
|
|||||||
{
|
{
|
||||||
self::call_get_rows($value);
|
self::call_get_rows($value);
|
||||||
}
|
}
|
||||||
|
fwrite($fp, "\n\nExport time: " . round($time,3) . 's' );
|
||||||
|
|
||||||
if ($fp)
|
if ($fp)
|
||||||
{
|
{
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user