mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
- Add js function to open a edit dialog with some fields pre-filled (type, category, action), use for buttons in nm right header
- Use different DOM ID for list when called from elsewhere
This commit is contained in:
parent
b86173ad16
commit
5c6cceaa53
@ -711,11 +711,17 @@ class infolog_ui
|
|||||||
{
|
{
|
||||||
$nm = egw_cache::getSession('infolog', $this->called_by.'session_data');
|
$nm = egw_cache::getSession('infolog', $this->called_by.'session_data');
|
||||||
unset($nm['rows']);
|
unset($nm['rows']);
|
||||||
if ($values === 'reset_action_view' || $_GET['ajax'] === 'true')
|
if ($values === 'reset_action_view')
|
||||||
{
|
{
|
||||||
$nm['action'] = $action = '';
|
$action = '';
|
||||||
$nm['action_id'] = $action_id = 0;
|
$action_id = 0;
|
||||||
$nm['action_title'] = $action_title = '';
|
$action_title = '';
|
||||||
|
}
|
||||||
|
if($_GET['ajax'] === 'true')
|
||||||
|
{
|
||||||
|
$nm['action'] = '';
|
||||||
|
$nm['action_id'] = 0;
|
||||||
|
$nm['action_title'] = '';
|
||||||
// check if action-view reset filter and restore it
|
// check if action-view reset filter and restore it
|
||||||
if (($filter = egw_cache::getSession('infolog', 'filter_reset_from')))
|
if (($filter = egw_cache::getSession('infolog', 'filter_reset_from')))
|
||||||
{
|
{
|
||||||
@ -880,6 +886,8 @@ class infolog_ui
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$values['css'] = '<style type="text/css">@import url('.$GLOBALS['egw_info']['server']['webserver_url'].'/infolog/templates/default/app.css);'."</style>";
|
$values['css'] = '<style type="text/css">@import url('.$GLOBALS['egw_info']['server']['webserver_url'].'/infolog/templates/default/app.css);'."</style>";
|
||||||
|
// Avoid DOM conflicts
|
||||||
|
$this->tmpl->set_dom_id("{$this->tmpl->name}-$action-$action_id");
|
||||||
}
|
}
|
||||||
// add scrollbar to long description, if user choose so in his prefs
|
// add scrollbar to long description, if user choose so in his prefs
|
||||||
if ($this->prefs['limit_des_lines'] > 0 || (string)$this->prefs['limit_des_lines'] == '');
|
if ($this->prefs['limit_des_lines'] > 0 || (string)$this->prefs['limit_des_lines'] == '');
|
||||||
|
@ -309,4 +309,36 @@ app.classes.infolog = AppJS.extend(
|
|||||||
{
|
{
|
||||||
egw.open('','infolog','add');
|
egw.open('','infolog','add');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a new edit dialog with some extra url parameters pulled from
|
||||||
|
* standard locations. Done with a function instead of hardcoding so
|
||||||
|
* the values can be updated if user changes them in UI.
|
||||||
|
*
|
||||||
|
* @param _type string Type of infolog entry
|
||||||
|
* @param _action string Special action for new infolog entry
|
||||||
|
* @param _action_id string ID for special action
|
||||||
|
*/
|
||||||
|
add_with_extras: function(_type, _action, _action_id)
|
||||||
|
{
|
||||||
|
var nm = this.et2.getWidgetById('nm');
|
||||||
|
var nm_value = nm.getValue() || {};
|
||||||
|
|
||||||
|
var extras = {
|
||||||
|
type: _type || nm_value.filter || null,
|
||||||
|
cat_id: nm_value.cat_id || null,
|
||||||
|
action: _action || null,
|
||||||
|
action_id: _action_id != '0' ? _action_id : null || null
|
||||||
|
};
|
||||||
|
|
||||||
|
// Remove any missing values
|
||||||
|
for(var key in extras)
|
||||||
|
{
|
||||||
|
if(extras[key] == null)
|
||||||
|
{
|
||||||
|
delete extras[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
egw.open('','infolog','add',extras);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
<template id="infolog.index.header_right" template="" lang="" group="0" version="1.9.001">
|
<template id="infolog.index.header_right" template="" lang="" group="0" version="1.9.001">
|
||||||
<hbox>
|
<hbox>
|
||||||
<description value="Add:" class="infolog_headertext"/>
|
<description value="Add:" class="infolog_headertext"/>
|
||||||
<button statustext="Add a new ToDo" label="ToDo" id="add[task]" onclick="var options = {type: 'task',cat_id:widget.getRoot().getWidgetById('cat_id').getValue()}; if('$cont[action]' != 'null') options.action = '$cont[action]'; egw.open('','infolog','add',options)" image="task"/>
|
<button statustext="Add a new ToDo" label="ToDo" id="add[task]" onclick="app.infolog.add_with_extras('task','$cont[action]','$cont[action_id]');" image="task"/>
|
||||||
<button statustext="Add a new Phonecall" label="Phonecall" id="add[phone]" onclick="var options = {type: 'phone',cat_id:widget.getRoot().getWidgetById('cat_id').getValue()}; if('$cont[action]' != 'null') options.action = '$cont[action]'; egw.open('','infolog','add',options)" image="phone"/>
|
<button statustext="Add a new Phonecall" label="Phonecall" id="add[phone]" onclick="app.infolog.add_with_extras('phone','$cont[action]','$cont[action_id]');" image="phone"/>
|
||||||
<button statustext="Add a new Note" label="Note" id="add[note]" onclick="var options = {type: 'note',cat_id:widget.getRoot().getWidgetById('cat_id').getValue()}; if('$cont[action]' != 'null') options.action = '$cont[action]'; egw.open('','infolog','add',options)" image="note"/>
|
<button statustext="Add a new Note" label="Note" id="add[note]" onclick="app.infolog.add_with_extras('note','$cont[action]','$cont[action_id]');" image="note"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</template>
|
</template>
|
||||||
<template id="infolog.index.rows" template="" lang="" group="0" version="1.9.005">
|
<template id="infolog.index.rows" template="" lang="" group="0" version="1.9.005">
|
||||||
|
Loading…
Reference in New Issue
Block a user