forked from extern/egroupware
Fix missing infolog custom types
This commit is contained in:
parent
3ec33534dc
commit
4da6635a51
@ -113,7 +113,7 @@ class customfields
|
|||||||
$this->content_types = (array)egw_link::get_registry($this->appname,'default_types');
|
$this->content_types = (array)egw_link::get_registry($this->appname,'default_types');
|
||||||
}
|
}
|
||||||
// Set this now, we need to know it for updates
|
// Set this now, we need to know it for updates
|
||||||
$this->content_type = $content['content_types']['types'];
|
$this->content_type = $content['content_types']['types'] ? $content['content_types']['types'] : (array_key_exists(0,$this->content_types) ? $this->content_types[0] : key($this->content_types));
|
||||||
|
|
||||||
// Common type changes - add, delete
|
// Common type changes - add, delete
|
||||||
if($content['content_types']['delete'])
|
if($content['content_types']['delete'])
|
||||||
@ -122,7 +122,11 @@ class customfields
|
|||||||
}
|
}
|
||||||
elseif($content['content_types']['create'])
|
elseif($content['content_types']['create'])
|
||||||
{
|
{
|
||||||
$content['content_types']['types'] = $this->create_content_type($content);
|
if($new_type = $this->create_content_type($content))
|
||||||
|
{
|
||||||
|
$content['content_types']['types'] = $this->content_type = $new_type;
|
||||||
|
}
|
||||||
|
unset($content['content_types']['create']);
|
||||||
unset($content['content_types']['name']);
|
unset($content['content_types']['name']);
|
||||||
}
|
}
|
||||||
// No common type change and type didn't change, try an update
|
// No common type change and type didn't change, try an update
|
||||||
@ -181,7 +185,6 @@ class customfields
|
|||||||
$content['type_template'] = $this->appname . '.admin.types';
|
$content['type_template'] = $this->appname . '.admin.types';
|
||||||
$content['content_types']['appname'] = $this->appname;
|
$content['content_types']['appname'] = $this->appname;
|
||||||
$content_types = array_keys($this->content_types);
|
$content_types = array_keys($this->content_types);
|
||||||
$this->content_type = $content['content_types']['types'] ? $content['content_types']['types'] : $content_types[0];
|
|
||||||
|
|
||||||
$content['content_type_options'] = $this->content_types[$this->content_type]['options'];
|
$content['content_type_options'] = $this->content_types[$this->content_type]['options'];
|
||||||
$content['content_type_options']['type'] = $this->types2[$this->content_type];
|
$content['content_type_options']['type'] = $this->types2[$this->content_type];
|
||||||
@ -535,6 +538,12 @@ class customfields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate and create a new content type
|
||||||
|
*
|
||||||
|
* @param array $content
|
||||||
|
* @return string|boolean New type ID, or false for error
|
||||||
|
*/
|
||||||
function create_content_type(&$content)
|
function create_content_type(&$content)
|
||||||
{
|
{
|
||||||
$new_name = trim($content['content_types']['name']);
|
$new_name = trim($content['content_types']['name']);
|
||||||
|
@ -71,6 +71,11 @@ class infolog_customfields extends customfields
|
|||||||
}
|
}
|
||||||
$readonlys['content_type_options']['status']["create$name"] = True;
|
$readonlys['content_type_options']['status']["create$name"] = True;
|
||||||
}
|
}
|
||||||
|
$content['content_type_options']['status'][++$n] = array(
|
||||||
|
'name' => '',
|
||||||
|
'label' => '',
|
||||||
|
'disabled' => False
|
||||||
|
);
|
||||||
$content['content_type_options']['status']['default'] = $this->status['defaults'][$this->content_type];
|
$content['content_type_options']['status']['default'] = $this->status['defaults'][$this->content_type];
|
||||||
$content['content_type_options']['group_owner'] = $this->group_owners[$this->content_type];
|
$content['content_type_options']['group_owner'] = $this->group_owners[$this->content_type];
|
||||||
$readonlys['content_types']['delete'] = isset($this->bo->stock_enums['type'][$this->content_type]);
|
$readonlys['content_types']['delete'] = isset($this->bo->stock_enums['type'][$this->content_type]);
|
||||||
@ -250,31 +255,37 @@ class infolog_customfields extends customfields
|
|||||||
$this->save_repository();
|
$this->save_repository();
|
||||||
}
|
}
|
||||||
|
|
||||||
function create(&$content)
|
function create_content_type(&$content)
|
||||||
{
|
{
|
||||||
$new_name = trim($content['new_name']);
|
$new_name = trim($content['content_types']['name']);
|
||||||
unset($content['new_name']);
|
if (empty($new_name))
|
||||||
if (empty($new_name) || isset($this->content_types[$new_name]))
|
|
||||||
{
|
{
|
||||||
$content['error_msg'] .= empty($new_name) ?
|
$this->tmpl->set_validation_error('content_types[name]','You have to enter a name, to create a new type!!!');
|
||||||
lang('You have to enter a name, to create a new typ!!!') :
|
return false;
|
||||||
lang("Typ '%1' already exists !!!",$new_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->content_types[$new_name] = $new_name;
|
foreach($this->content_types as $letter => $name)
|
||||||
$this->status[$new_name] = array(
|
{
|
||||||
'ongoing' => 'ongoing',
|
if($name == $new_name)
|
||||||
'done' => 'done'
|
{
|
||||||
);
|
$this->tmpl->set_validation_error('content_types[name]',lang("type '%1' already exists !!!",$new_name));
|
||||||
$this->status['defaults'][$new_name] = 'ongoing';
|
return false;
|
||||||
|
}
|
||||||
// save changes to repository
|
}
|
||||||
$this->save_repository();
|
|
||||||
|
|
||||||
$content['type2'] = $new_name; // show the new entry
|
|
||||||
}
|
}
|
||||||
|
$this->content_types[$new_name] = $new_name;
|
||||||
|
$this->status[$new_name] = array(
|
||||||
|
'ongoing' => 'ongoing',
|
||||||
|
'done' => 'done'
|
||||||
|
);
|
||||||
|
$this->status['defaults'][$new_name] = 'ongoing';
|
||||||
|
|
||||||
|
// save changes to repository
|
||||||
|
$this->save_repository();
|
||||||
|
return $new_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_repository()
|
function save_repository()
|
||||||
{
|
{
|
||||||
// save changes to repository
|
// save changes to repository
|
||||||
|
Loading…
Reference in New Issue
Block a user