Implement sub_app attribute for customfields widget, in order to be able to store sub-app's specific customfields

This commit is contained in:
Hadi Nategh 2017-06-07 17:54:09 +02:00
parent 9746e1533e
commit 11c03702dd
3 changed files with 9 additions and 3 deletions

View File

@ -127,7 +127,7 @@ class admin_customfields
{
// determine appname
$this->appname = $this->appname ? $this->appname : ($_GET['appname'] ? $_GET['appname'] : ($content['appname'] ? $content['appname'] : false));
if(!$this->appname) die(lang('Error! No appname found'));
if(!$this->appname || !Api\Link::get_registry($this->appname, 'title')) die(lang('Error! No appname found'));
$this->use_private = !isset($_GET['use_private']) || (boolean)$_GET['use_private'] || $content['use_private'];

View File

@ -48,6 +48,11 @@ var et2_customfields_list = (function(){ "use strict"; return et2_valueWidget.ex
'private': {
ignore: true,
type: 'boolean'
},
'sub_app': {
'name': 'sub app name',
'type': "string",
'description': "Name of sub application"
}
},

View File

@ -126,6 +126,7 @@ class Customfields extends Transformer
if(!$app)
{
$app =& $this->setElementAttribute(self::GLOBAL_VALS, 'app', $GLOBALS['egw_info']['flags']['currentapp']);
if ($this->attrs['sub-app']) $app .= '-'.$this->attrs['sub-app'];
$customfields =& $this->setElementAttribute(self::GLOBAL_VALS, 'customfields', Api\Storage\Customfields::get($app));
}