* InfoLog: allow to (re-)set view of entries link to contacts via favorites

r49041: reverting r49030 and implementing same functionality with just app.infolog.(get|set)State(), fixes introduced error set you could not filter eg. by type in an action view
This commit is contained in:
Ralf Becker 2014-10-17 12:57:33 +00:00
parent 2ceddce771
commit 0a13a668a7
2 changed files with 57 additions and 18 deletions

View File

@ -1240,7 +1240,7 @@ class infolog_ui
/**
* Handles actions on multiple infologs
*
* @param action
* @param string $_action
* @param array $checked contact id's to use if !$use_all
* @param boolean $use_all if true use all entries of the current selection (in the session)
* @param int &$success number of succeded actions
@ -1251,7 +1251,7 @@ class infolog_ui
* @param boolean $skip_notifications true to NOT notify users about changes
* @return boolean true if all actions succeded, false otherwise
*/
function action($action, $checked, $use_all, &$success, &$failed, &$action_msg,
function action($_action, $checked, $use_all, &$success, &$failed, &$action_msg,
array $query, &$msg, $skip_notifications = false)
{
//echo '<p>'.__METHOD__."('$action',".array2string($checked).','.(int)$use_all.",...)</p>\n";
@ -1273,7 +1273,7 @@ class infolog_ui
}
// Actions with options in the selectbox
list($action, $settings) = explode('_', $action, 2);
list($action, $settings) = explode('_', $_action, 2);
// Actions that can handle a list of IDs
switch($action)
@ -1476,14 +1476,14 @@ class infolog_ui
* Closes an infolog
*
* @param int|array $values=0 info_id (default _GET[info_id])
* @param string $referer=''
* @param string $_referer=''
* @param boolean $closesingle=false
*/
function close($values=0,$referer='',$closesingle=false,$skip_notification = false)
function close($values=0,$_referer='',$closesingle=false,$skip_notification = false)
{
//echo "<p>".__METHOD__."($values,$referer,$closeall)</p>\n";
$info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
$referer = is_array($values) ? $values['referer'] : $referer;
$referer = is_array($values) ? $values['referer'] : $_referer;
if ($info_id)
{
@ -1526,14 +1526,14 @@ class infolog_ui
* Deletes an InfoLog entry
*
* @param array|int $values info_id (default _GET[info_id])
* @param string $referer
* @param string $_referer
* @param string $called_by
* @param boolean $skip_notification Do not send notification of deletion
*/
function delete($values=0,$referer='',$called_by='',$skip_notification=False)
function delete($values=0,$_referer='',$called_by='',$skip_notification=False)
{
$info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
$referer = is_array($values) ? $values['referer'] : $referer;
$referer = is_array($values) ? $values['referer'] : $_referer;
if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) // entries without subs get confirmed by javascript
{

View File

@ -90,7 +90,7 @@ app.classes.infolog = AppJS.extend(
if (typeof _links != 'undefined')
{
if (typeof _links.infolog != 'undefined')
{
{
switch (_app)
{
case 'timesheet':
@ -105,19 +105,56 @@ app.classes.infolog = AppJS.extend(
{
var info_type = egw.dataGetUIDdata(_app+"::"+_id)?egw.dataGetUIDdata(_app+"::"+_id).data.info_type:false;
var cal_show = egw.preference('cal_show','infolog')||false;
if (info_type && cal_show)
{
var rex = RegExp(info_type,'gi');
if (cal_show.match(rex))
{
//Trigger refresh the whole calendar if the changed infolog entry is integrated one
//Trigger refresh the whole calendar if the changed infolog entry is integrated one
if (typeof app['calendar'] != 'undefined') app.calendar.egw.window.location.reload();
}
}
}
}
},
/**
* Retrieve the current state of the application for future restoration
*
* Reimplemented to add action/action_id from content set by server
* when eg. viewing infologs linked to contacts.
*
* @return {object} Application specific map representing the current state
*/
getState: function()
{
// call parent
var state = this._super.apply(this, arguments);
var nm = this.et2 ? this.et2.getArrayMgr('content').data.nm : {};
state.action = nm.action || null;
state.action_id = nm.action_id || null;
return state;
},
/**
* Set the application's state to the given state.
*
* Reimplemented to also reset action/action_id.
*
* @param {{name: string, state: object}|string} state Object (or JSON string) for a state.
* Only state is required, and its contents are application specific.
*
* @return {boolean} false - Returns false to stop event propagation
*/
setState: function(state)
{
if (typeof state.state.action == 'undefined') state.state.action = null;
return this._super.apply(this, arguments);
},
/**
* Enable or disable the date filter
*
@ -172,7 +209,7 @@ app.classes.infolog = AppJS.extend(
// Change preference location - widget is nextmatch
nm.options.settings.columnselection_pref = nm.options.settings.columnselection_pref.replace('-details','') + (filter2.value == 'all' ? '-details' :'');
// Load new preferences
var colData = nm.columns.slice();
for(var i = 0; i < nm.columns.length; i++) colData[i].disabled=false;
@ -193,7 +230,8 @@ app.classes.infolog = AppJS.extend(
/**
* Show or hide details by changing the CSS class
*
* @param show
* @param {boolean} show
* @param {DOMNode} dom_node
*/
show_details: function(show, dom_node)
{
@ -403,18 +441,19 @@ app.classes.infolog = AppJS.extend(
isLoadingCompleted = false;
jQuery('#infolog-edit-print').unbind("DOMSubtreeModified");
});
setTimeout(function(){isLoadingCompleted = false},1000);
setTimeout(function() {
isLoadingCompleted = false;
}, 1000);
var interval = setInterval(function(){
if (!isLoadingCompleted)
{
clearInterval(interval);
that.infolog_print_preview();
}
}, 100);
});
},
/**
* Trigger print() function to print the current window
*/