mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 00:58:55 +01:00
WIP allow cfs in extra tabs
This commit is contained in:
parent
335f618736
commit
8b59c76150
@ -139,7 +139,7 @@ class admin_customfields
|
||||
$this->use_private = !empty($_GET['use_private']) && $_GET['use_private'] !== 'undefined' || !empty($content['use_private']);
|
||||
|
||||
// Read fields, constructor doesn't always know appname
|
||||
$this->fields = Api\Storage\Customfields::get($this->appname,true);
|
||||
$this->fields = Api\Storage\Customfields::get($this->appname,true, null, null, null);
|
||||
|
||||
$this->tmpl = new Etemplate();
|
||||
$this->tmpl->read('admin.customfields');
|
||||
@ -349,7 +349,7 @@ class admin_customfields
|
||||
$this->use_readonly = !isset($_GET['use_readonly']) || (boolean)$_GET['use_readonly'] || !empty($content['use_readonly']);
|
||||
|
||||
// Read fields, constructor doesn't always know appname
|
||||
$this->fields = Api\Storage\Customfields::get($this->appname,true);
|
||||
$this->fields = Api\Storage\Customfields::get($this->appname,true, null, null, null);
|
||||
|
||||
// Update based on info returned from template
|
||||
if (is_array($content))
|
||||
|
@ -14,6 +14,7 @@
|
||||
namespace EGroupware\Api\Etemplate\Widget;
|
||||
|
||||
use EGroupware\Api\Etemplate;
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* eTemplate Tabs widget stacks multiple sub-templates and lets you switch between them
|
||||
@ -129,4 +130,41 @@ class Tabbox extends Etemplate\Widget
|
||||
if (true) $valid = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called before eT2 request is sent to client
|
||||
*
|
||||
* @param string $cname
|
||||
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
|
||||
*/
|
||||
public function beforeSendToClient($cname, array $expand=null)
|
||||
{
|
||||
[$app] = explode('.', self::$request->template['name']);
|
||||
if (empty($app) || !($cfs = Api\Storage\Customfields::get($app, false, null, null, true)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$tabs = [];
|
||||
$content = self::$request->content;
|
||||
foreach($cfs as $cf)
|
||||
{
|
||||
if (!empty($cf['tab']))
|
||||
{
|
||||
$tab = $tabs[$cf['tab']]['id'] ?? 'cf-tab'.(1+count($tabs));
|
||||
if (!isset($tabs[$cf['tab']]))
|
||||
{
|
||||
$tabs[$cf['tab']] = array(
|
||||
'id' => $tab,
|
||||
'template' => 'api.cf-tab',
|
||||
'label' => $cf['tab'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($tabs)
|
||||
{
|
||||
self::$request->content = $content;
|
||||
self::setElementAttribute($this->id, 'extraTabs', array_values($tabs));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user