mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
Move site config over to etemplate, and move custom notifications into site config
This commit is contained in:
parent
8f1ab82083
commit
ad36ac309a
@ -17,7 +17,6 @@ class infolog_customfields
|
||||
{
|
||||
var $public_functions = array(
|
||||
'edit' => True,
|
||||
'custom_notifications' => true
|
||||
);
|
||||
/**
|
||||
* Instance of the infolog BO class
|
||||
@ -372,68 +371,4 @@ class infolog_customfields
|
||||
config::save_value('customfields',$this->fields,'infolog');
|
||||
config::save_value('group_owners',$this->group_owners,'infolog');
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit custom notifications for all infolog types and each type
|
||||
*/
|
||||
public function custom_notifications(Array $content = array())
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Custom notifications');
|
||||
if (is_array($content))
|
||||
{
|
||||
//echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
|
||||
list($action) = @each($content['button']);
|
||||
switch($action)
|
||||
{
|
||||
case 'save':
|
||||
case 'apply':
|
||||
$notifications = array();
|
||||
foreach($content['notification'] as $type)
|
||||
{
|
||||
if(trim($type['value']))
|
||||
{
|
||||
$notifications[$type['old_name']] = trim($type['value']);
|
||||
}
|
||||
}
|
||||
config::save_value('custom_notification', $notifications,'infolog');
|
||||
if ($action != 'save')
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 'cancel':
|
||||
$GLOBALS['egw']->redirect_link('/admin/');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = array();
|
||||
}
|
||||
$readonlys = array();
|
||||
$config = config::read('infolog');
|
||||
|
||||
$n = 0;
|
||||
$content['notification'][++$n] = array(
|
||||
'name' => "~global~",
|
||||
'value' => $config['custom_notification']['~global~'],
|
||||
'label' => 'all',
|
||||
'disabled' => False
|
||||
);
|
||||
$preserve['notification'][$n]['old_name'] = '~global~';
|
||||
|
||||
foreach($this->types as $type => $label)
|
||||
{
|
||||
$content['notification'][++$n] = array(
|
||||
'value' => $config['custom_notification'][$type],
|
||||
'label' => $label,
|
||||
'disabled' => False
|
||||
);
|
||||
$preserve['notification'][$n]['old_name'] = $type;
|
||||
}
|
||||
|
||||
//echo '<p>'.__METHOD__'.(content = <pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
|
||||
//echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n";
|
||||
$this->tmpl->read('infolog.custom_notification');
|
||||
$this->tmpl->exec('infolog.infolog_customfields.custom_notifications',$content,array(),$readonlys,$preserve);
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,6 @@ class infolog_export_csv implements importexport_iface_export_plugin {
|
||||
public function get_selectors_etpl() {
|
||||
return array(
|
||||
'name' => 'infolog.export_csv_selectors',
|
||||
'content' => 'search'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -124,9 +124,6 @@ class infolog_hooks
|
||||
'global_cats'=> True)),
|
||||
'Custom fields, typ and status' => egw::link('/index.php',array(
|
||||
'menuaction' => 'infolog.infolog_customfields.edit')),
|
||||
'Custom notifications' => egw::link('/index.php',array(
|
||||
'menuaction' => 'infolog.infolog_customfields.custom_notifications'
|
||||
)),
|
||||
);
|
||||
if ($location == 'admin')
|
||||
{
|
||||
|
@ -328,14 +328,14 @@ class infolog_tracking extends bo_tracking
|
||||
return '';
|
||||
}
|
||||
// Per-type notification
|
||||
elseif($info_config[self::CUSTOM_NOTIFICATION][$data['info_type']])
|
||||
{
|
||||
$config = $info_config[self::CUSTOM_NOTIFICATION][$data['info_type']];
|
||||
}
|
||||
else
|
||||
{
|
||||
$config = $info_config[self::CUSTOM_NOTIFICATION]['~global~'];
|
||||
}
|
||||
$global = $info_config[self::CUSTOM_NOTIFICATION]['~global~'];
|
||||
|
||||
// Disabled
|
||||
if(!$config['use_custom'] && !$global['use_custom']) return '';
|
||||
|
||||
// Type or globabl
|
||||
$config = trim(strip_tags($config['message'])) != '' && $config['use_custom'] ? $config['message'] : $global['message'];
|
||||
break;
|
||||
}
|
||||
return $config;
|
||||
|
@ -2242,7 +2242,7 @@ else
|
||||
* Infolog's site configuration
|
||||
*
|
||||
*/
|
||||
function admin( )
|
||||
public function admin($content = array())
|
||||
{
|
||||
$fields = array(
|
||||
'info_cat' => 'Category',
|
||||
@ -2293,19 +2293,19 @@ else
|
||||
$sub_excludefields = $excludefields;
|
||||
unset($sub_excludefields['info_id_parent']); // always set to parent!
|
||||
|
||||
$config_data = config::read('infolog');
|
||||
$config = config::read('infolog');
|
||||
|
||||
if($_POST['save'] || $_POST['apply'])
|
||||
if($content)
|
||||
{
|
||||
if (get_magic_quotes_gpc())
|
||||
// Save
|
||||
$button = key($content['button']);
|
||||
if($button == 'save' || $button == 'apply')
|
||||
{
|
||||
$_POST = self::array_stripslashes($_POST);
|
||||
}
|
||||
$this->bo->responsible_edit = array('info_status','info_percent','info_datecompleted');
|
||||
|
||||
if ($_POST['responsible_edit'])
|
||||
if ($content['responsible_edit'])
|
||||
{
|
||||
$extra = array_intersect((array)$_POST['responsible_edit'],array_keys($fields));
|
||||
$extra = array_intersect((array)$content['responsible_edit'],array_keys($fields));
|
||||
$this->bo->responsible_edit = array_merge($this->bo->responsible_edit,$extra);
|
||||
}
|
||||
// some fields like id, uid, created, createdby, modified and modifiedby are excluded by default
|
||||
@ -2315,9 +2315,9 @@ else
|
||||
$this->bo->$name = array_unique(array_diff($this->bo->$name, $efs, // restore default from bo
|
||||
$name == 'sub_excludefields' ? $this->bo->default_sub_excludefields : array()));
|
||||
|
||||
if ($_POST[$name])
|
||||
if ($content[$name])
|
||||
{
|
||||
$this->bo->$name = array_merge($this->bo->$name, array_intersect((array)$_POST[$name], $efs));
|
||||
$this->bo->$name = array_merge($this->bo->$name, array_intersect((array)$content[$name], $efs));
|
||||
}
|
||||
elseif ($name == 'sub_excludefields' && !in_array('explicit-set',$this->bo->sub_excludefields))
|
||||
{
|
||||
@ -2327,57 +2327,63 @@ else
|
||||
config::save_value('copy_excludefields',$this->bo->copy_excludefields,'infolog');
|
||||
config::save_value('sub_excludefields',$this->bo->sub_excludefields,'infolog');
|
||||
config::save_value('responsible_edit',$this->bo->responsible_edit,'infolog');
|
||||
config::save_value('implicit_rights',$this->bo->implicit_rights = $_POST['implicit_rights'] == 'edit' ? 'edit' : 'read','infolog');
|
||||
config::save_value('history',$this->bo->history = $_POST['history'],'infolog');
|
||||
config::save_value('index_load_cfs',$config_data['index_load_cfs'] = $_POST['index_load_cfs'],'infolog');
|
||||
config::save_value('sub_prefix',$config_data['sub_prefix'] = $_POST['sub_prefix'],'infolog');
|
||||
config::save_value('implicit_rights',$this->bo->implicit_rights = $content['implicit_rights'] == 'edit' ? 'edit' : 'read','infolog');
|
||||
config::save_value('history',$this->bo->history = $content['history'],'infolog');
|
||||
config::save_value('index_load_cfs',$config_data['index_load_cfs'] = $content['index_load_cfs'],'infolog');
|
||||
config::save_value('sub_prefix',$config_data['sub_prefix'] = $content['sub_prefix'],'infolog');
|
||||
|
||||
// Notifications
|
||||
$notifications =& $config[infolog_tracking::CUSTOM_NOTIFICATION];
|
||||
$notifications[$content['notification_type']] = $content['notification'];
|
||||
config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications,'infolog');
|
||||
}
|
||||
if($_POST['cancel'] || $_POST['save'])
|
||||
|
||||
if($button == 'save' || $button == 'cancel')
|
||||
{
|
||||
egw::redirect_link('/infolog/index.php');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load
|
||||
$content = $config;
|
||||
|
||||
$content['implicit_rights'] = $this->bo->implicit_rights;
|
||||
$content['responsible_edit'] = $this->bo->responsible_edit;
|
||||
$content['copy_excludefields'] = $this->bo->copy_excludefields;
|
||||
$content['sub_excludefields'] = $this->bo->sub_excludefields;
|
||||
$content['history'] = $this->bo->history;
|
||||
}
|
||||
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Site configuration');
|
||||
common::egw_header();
|
||||
|
||||
$GLOBALS['egw']->template->set_file(array('info_admin_t' => 'admin.tpl'));
|
||||
$GLOBALS['egw']->template->set_block('info_admin_t', 'info_admin');
|
||||
|
||||
$GLOBALS['egw']->template->set_var(Array(
|
||||
'lang_responsible_rights' => lang('Rights for the responsible'),
|
||||
'lang_implicit_rights' => lang('Which implicit ACL rights should the responsible get?'),
|
||||
'implicit_rights' => html::select('implicit_rights',$this->bo->implicit_rights,array(
|
||||
// Load selected custom notification
|
||||
if(!$content['notification_type'])
|
||||
{
|
||||
$content['notification_type'] = '~global~';
|
||||
}
|
||||
$content['notification'] = $config[infolog_tracking::CUSTOM_NOTIFICATION][$content['notification_type']];
|
||||
$sel_options = array(
|
||||
'implicit_rights' => array(
|
||||
'read' => 'read rights (default)',
|
||||
'edit' => 'edit rights (full edit rights incl. making someone else responsible!)',
|
||||
)),
|
||||
'lang_responsible_edit' => lang('Which additional fields should the responsible be allowed to edit without having edit rights?<br />Status, percent and date completed are always allowed.'),
|
||||
'responsible_edit' => html::checkbox_multiselect('responsible_edit',$this->bo->responsible_edit,$fields,false,'',6),
|
||||
'lang_copy_excludefields' => lang('Fields to exclude when copying an infolog:'),
|
||||
'copy_excludefields' => html::checkbox_multiselect('copy_excludefields',$this->bo->copy_excludefields,$excludefields,false,'',6),
|
||||
'lang_sub_excludefields' => lang('Fields to exclude when creating a sub-entry:'),
|
||||
'sub_excludefields' => html::checkbox_multiselect('sub_excludefields',$this->bo->sub_excludefields,$sub_excludefields,false,'',6),
|
||||
'text' => lang('<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients'),
|
||||
'action_url' => html::link('/index.php',array('menuaction'=>'infolog.infolog_ui.admin')),
|
||||
'save_button' => html::submit_button('save','Save'),
|
||||
'apply_button' => html::submit_button('apply','Apply'),
|
||||
'cancel_button' => html::submit_button('cancel','Cancel'),
|
||||
'lang_history'=> lang('History logging'),
|
||||
'lang_history2'=> lang('History logging and deleting of items'),
|
||||
'history' => html::select('history',$this->bo->history,array(
|
||||
),
|
||||
'responsible_edit' => $fields,
|
||||
'copy_excludefields' => $excludefields,
|
||||
'sub_excludefields' => $sub_excludefields,
|
||||
'history' => array(
|
||||
'' => lang('No'),
|
||||
'history' => lang('Yes, with purging of deleted items possible'),
|
||||
'history_admin_delete' => lang('Yes, only admins can purge deleted items'),
|
||||
'history_no_delete' => lang('Yes, noone can purge deleted items'),
|
||||
)),
|
||||
'lang_other' => lang('Other configurations'),
|
||||
'lang_index_load_cfs' => lang('Load custom fields in index, if filtered by selected types (eg. to display them in a type-specific index template)'),
|
||||
'index_load_cfs' => html::checkbox_multiselect('index_load_cfs',$config_data['index_load_cfs'],$this->bo->enums['type'],true,'',5),
|
||||
'lang_sub_prefix' => lang('Prefix for sub-entries (default: Re:)'),
|
||||
'sub_prefix' => html::input('sub_prefix',$config_data['sub_prefix']),
|
||||
));
|
||||
|
||||
echo parse_navbar();
|
||||
$GLOBALS['egw']->template->pfp('phpgw_body','info_admin');
|
||||
),
|
||||
'index_load_cfs' => $this->bo->enums['type'],
|
||||
'notification_type' => array('~global~' => 'all') + $this->bo->enums['type']
|
||||
);
|
||||
$preserve['notification_old_type'] = $content['notification_type'];
|
||||
$this->tmpl->read('infolog.config');
|
||||
$this->tmpl->exec('infolog.infolog_ui.admin',$content,$sel_options,$readonlys,$preserve);
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,57 +0,0 @@
|
||||
<!-- BEGIN info_admin -->
|
||||
<br>
|
||||
<form action="{action_url}" method="POST">
|
||||
<table border="0">
|
||||
<tr class="th">
|
||||
<td colspan="4"><b>{lang_responsible_rights}</b></td>
|
||||
</tr>
|
||||
<tr class="row_off">
|
||||
<td colspan="3">{lang_implicit_rights}</td>
|
||||
<td>{implicit_rights}</td>
|
||||
</tr>
|
||||
<tr class="row_on">
|
||||
<td colspan="3">{lang_responsible_edit}</td>
|
||||
<td>{responsible_edit}</td>
|
||||
</tr>
|
||||
<tr class="th">
|
||||
<td colspan="4"><b>{lang_history}</b></td>
|
||||
</tr>
|
||||
<tr class="row_off">
|
||||
<td colspan="3">{lang_history2}</td>
|
||||
<td>{history}</td>
|
||||
</tr>
|
||||
<tr class="th">
|
||||
<td colspan="4"><b>{lang_other}</b></td>
|
||||
</tr>
|
||||
<tr class="row_off">
|
||||
<td colspan="3">{lang_copy_excludefields}</td>
|
||||
<td>
|
||||
{copy_excludefields}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row_on">
|
||||
<td colspan="3">{lang_index_load_cfs}</td>
|
||||
<td>
|
||||
{index_load_cfs}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row_off">
|
||||
<td colspan="3">{lang_sub_prefix}</td>
|
||||
<td>
|
||||
{sub_prefix}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row_on">
|
||||
<td colspan="3">{lang_sub_excludefields}</td>
|
||||
<td>
|
||||
{sub_excludefields}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" align="left">
|
||||
{save_button} {apply_button} {cancel_button}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!-- END info_admin -->
|
112
infolog/templates/default/config.xet
Normal file
112
infolog/templates/default/config.xet
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="infolog.config.configuration" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="60%"/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
<description value="Rights for the responsible" span="all"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Which implicit ACL rights should the responsible get"/>
|
||||
<menulist>
|
||||
<menupopup id="implicit_rights"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Which additional fields should the responsible be allowed to edit without having edit rights?<br />Status, percent and date completed are always allowed."/>
|
||||
<listbox id="responsible_edit" rows="6" options=",,,,,,1"/>
|
||||
</row>
|
||||
<row class="th">
|
||||
<description value="History logging" span="all"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="History logging and deleting of items"/>
|
||||
<menulist>
|
||||
<menupopup id="history"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row class="th">
|
||||
<description value="Other configurations" span="all"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Fields to exclude when copying an infolog:"/>
|
||||
<listbox id="copy_excludefields" rows="6"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Load custom fields in index, if filtered by selected types (eg. to display them in a type-specific index template)"/>
|
||||
<listbox id="index_load_cfs" rows="6" options=",,,,,,1"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Prefix for sub-entries (default: Re:)"/>
|
||||
<textbox id="sub_prefix" no_lang="1"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Fields to exclude when creating a sub-entry:"/>
|
||||
<listbox id="sub_excludefields" rows="6"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="infolog.config.notification" template="" lang="" group="0" version="">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<menulist>
|
||||
<menupopup label="Type" id="notification_type" onchange="1"/>
|
||||
</menulist>
|
||||
<checkbox label="Use custom notification message" id="notification[use_custom]"/>
|
||||
</row>
|
||||
<row>
|
||||
<htmlarea id="notification[message]" height="180px" width="100%" toolbar="false" span="all"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Full list of placeholder names" href="infolog.infolog_merge.show_replacements" extra_link_target="_blank"/>
|
||||
<description/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="infolog.config" template="" lang="" group="0" version="1.9.001">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description id="msg" span="all" class="message"/>
|
||||
</row>
|
||||
<row>
|
||||
<tabbox id="configuration|notification">
|
||||
<tabs>
|
||||
<tab id="configuration" label="Configuration"/>
|
||||
<tab id="notification" label="Notification"/>
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<template id="infolog.config.configuration"/>
|
||||
<template id="infolog.config.notification"/>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
</row>
|
||||
<row>
|
||||
<hbox>
|
||||
<button label="Save" id="button[save]"/>
|
||||
<button label="Apply" id="button[apply]"/>
|
||||
<button align="right" label="Cancel" id="button[cancel]"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<styles>select {
|
||||
min-width: 30em;
|
||||
}</styles>
|
||||
</template>
|
||||
</overlay>
|
@ -1,47 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="infolog.custom_notification" template="" lang="" group="0" version="1.9.001">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description id="msg" span="all" class="message"/>
|
||||
</row>
|
||||
<row>
|
||||
<grid width="100%" id="notification">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
<description value="Type"/>
|
||||
<description value="Notification"/>
|
||||
</row>
|
||||
<row>
|
||||
<description id="${row}[label]"/>
|
||||
<textbox multiline="true" id="${row}[value]"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</row>
|
||||
<row>
|
||||
<hbox>
|
||||
<button label="Save" id="button[save]"/>
|
||||
<button label="Apply" id="button[apply]"/>
|
||||
<button align="right" label="Cancel" id="button[cancel]"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<styles>
|
||||
textarea {
|
||||
min-width: 100em;
|
||||
min-height: 5em;
|
||||
}
|
||||
</styles>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user