2020-02-03 16:05:40 +01:00
"use strict" ;
2013-08-26 11:45:43 +02:00
/ * *
* EGroupware - Infolog - Javascript UI
*
2020-02-03 16:05:40 +01:00
* @ link : https : //www.egroupware.org
2013-08-26 11:45:43 +02:00
* @ package infolog
* @ author Hadi Nategh < hn - AT - stylite . de >
* @ copyright ( c ) 2008 - 13 by Ralf Becker < RalfBecker - AT - outdoor - training . de >
* @ license http : //opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* /
2020-02-03 16:05:40 +01:00
var _ _extends = ( this && this . _ _extends ) || ( function ( ) {
var extendStatics = function ( d , b ) {
extendStatics = Object . setPrototypeOf ||
( { _ _proto _ _ : [ ] } instanceof Array && function ( d , b ) { d . _ _proto _ _ = b ; } ) ||
function ( d , b ) { for ( var p in b ) if ( b . hasOwnProperty ( p ) ) d [ p ] = b [ p ] ; } ;
return extendStatics ( d , b ) ;
} ;
return function ( d , b ) {
extendStatics ( d , b ) ;
function _ _ ( ) { this . constructor = d ; }
d . prototype = b === null ? Object . create ( b ) : ( _ _ . prototype = b . prototype , new _ _ ( ) ) ;
} ;
} ) ( ) ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
/ * e g w : u s e s
/ a p i / j s / j s a p i / e g w _ a p p . j s
* /
require ( "jquery" ) ;
require ( "jqueryui" ) ;
require ( "../jsapi/egw_global" ) ;
require ( "../etemplate/et2_types" ) ;
var egw _app _1 = require ( "../../api/js/jsapi/egw_app" ) ;
2013-08-26 11:45:43 +02:00
/ * *
* UI for Infolog
*
* @ augments AppJS
* /
2020-02-03 16:05:40 +01:00
var InfologApp = /** @class */ ( function ( _super ) {
_ _extends ( InfologApp , _super ) ;
/ * *
* Constructor
*
* @ memberOf app . infolog
* /
function InfologApp ( ) {
// call parent
return _super . call ( this ) || this ;
}
/ * *
* Destructor
* /
InfologApp . prototype . destroy = function ( ) {
// call parent
_super . prototype . destroy . apply ( this , arguments ) ;
} ;
/ * *
* This function is called when the etemplate2 object is loaded
* and ready . If you must store a reference to the et2 object ,
* make sure to clean it up in destroy ( ) .
*
* @ param { etemplate2 } _et2 newly ready object
* @ param { string } _name template name
* /
InfologApp . prototype . et2 _ready = function ( _et2 , _name ) {
// call parent
_super . prototype . et2 _ready . apply ( this , arguments ) ;
switch ( _name ) {
case 'infolog.index' :
this . filter _change ( ) ;
// Show / hide descriptions according to details filter
var nm = this . et2 . getWidgetById ( 'nm' ) ;
var filter2 = nm . getWidgetById ( 'filter2' ) ;
this . show _details ( filter2 . value == 'all' , nm . getDOMNode ( nm ) ) ;
// Remove the rule added by show_details() if the template is removed
jQuery ( _et2 . DOMContainer ) . on ( 'clear' , jQuery . proxy ( function ( ) { egw . css ( this ) ; } , '#' + nm . getDOMNode ( nm ) . id + ' .et2_box.infoDes' ) ) ;
// Enable decrypt on hover
if ( this . egw . user ( 'apps' ) . stylite ) {
this . _get _stylite ( function ( ) { this . mailvelopeAvailable ( function ( ) { app . stylite . decrypt _hover ( nm ) ; } ) ; } ) ;
}
break ;
case 'infolog.edit.print' :
if ( this . et2 . getArrayMgr ( 'content' ) . data . info _des . indexOf ( this . begin _pgp _message ) != - 1 ) {
this . mailvelopeAvailable ( this . printEncrypt ) ;
}
else {
// Trigger print command if the infolog oppend for printing purpose
this . infolog _print _preview _onload ( ) ;
}
break ;
case 'infolog.edit' :
if ( this . et2 . getArrayMgr ( 'content' ) . data . info _des &&
this . et2 . getArrayMgr ( 'content' ) . data . info _des . indexOf ( this . begin _pgp _message ) != - 1 ) {
this . _get _stylite ( jQuery . proxy ( function ( ) {
this . mailvelopeAvailable ( jQuery . proxy ( function ( ) {
this . toggleEncrypt ( ) ;
// Decrypt history on hover
var history = this . et2 . getWidgetById ( 'history' ) ;
app . stylite . decrypt _hover ( history , 'span' ) ;
jQuery ( history . getDOMNode ( history ) )
. tooltip ( 'option' , 'position' , { my : 'top left' , at : 'top left' , of : history . getDOMNode ( history ) } ) ;
} , this ) ) ;
} , this ) ) ;
// This disables the diff in history
var history = this . et2 . getArrayMgr ( 'content' ) . getEntry ( 'history' ) ;
history [ 'status-widgets' ] . De = 'description' ;
}
break ;
}
} ;
/ * *
* Observer method receives update notifications from all applications
*
* InfoLog currently reacts to timesheet updates , as it might show time - sums .
* @ todo only trigger update , if times are shown
*
* @ param { string } _msg message ( already translated ) to show , eg . 'Entry deleted'
* @ param { string } _app application name
* @ param { ( string | number ) } _id id of entry to refresh or null
* @ param { string } _type either 'update' , 'edit' , 'delete' , 'add' or null
* - update : request just modified data from given rows . Sorting is not considered ,
* so if the sort field is changed , the row will not be moved .
* - edit : rows changed , but sorting may be affected . Requires full reload .
* - delete : just delete the given rows clientside ( no server interaction neccessary )
* - add : requires full reload for proper sorting
* @ param { string } _msg _type 'error' , 'warning' or 'success' ( default )
* @ param { object | null } _links app => array of ids of linked entries
* or null , if not triggered on server - side , which adds that info
* /
InfologApp . prototype . observer = function ( _msg , _app , _id , _type , _msg _type , _links ) {
if ( typeof _links != 'undefined' ) {
if ( typeof _links . infolog != 'undefined' ) {
switch ( _app ) {
case 'timesheet' :
var nm = this . et2 ? this . et2 . getWidgetById ( 'nm' ) : null ;
if ( nm )
nm . applyFilters ( ) ;
break ;
}
}
}
// Refresh handler for Addressbook CRM view
if ( _app == 'infolog' && this . et2 . getInstanceManager ( ) && this . et2 . getInstanceManager ( ) . app == 'addressbook' && this . et2 . getInstanceManager ( ) . name == 'infolog.index' ) {
this . et2 . _inst . refresh ( _msg , _app , _id , _type ) ;
}
} ;
/ * *
* 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
* /
InfologApp . prototype . getState = function ( ) {
// call parent
var state = _super . prototype . observer . apply ( this , arguments ) ;
var nm = { } ;
// Get index etemplate
var et2 = etemplate2 . getById ( 'infolog-index' ) ;
if ( et2 ) {
var content = et2 . widgetContainer . getArrayMgr ( 'content' ) ;
nm = content && content . data && content . data . nm ? 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
* /
InfologApp . prototype . setState = function ( state ) {
// as we have to set state.state.action, we have to set all other
// for "No filter" favorite to work as expected
var to _set = { col _filter : null , filter : '' , filter2 : '' , cat _id : '' , search : '' , action : null } ;
if ( typeof state . state == 'undefined' )
state . state = { } ;
for ( var name in to _set ) {
if ( typeof state . state [ name ] == 'undefined' )
state . state [ name ] = to _set [ name ] ;
}
return _super . prototype . setState . apply ( this , arguments ) ;
} ;
/ * *
* Enable or disable the date filter
*
* If the filter is set to something that needs dates , we enable the
* header _left template . Otherwise , it is disabled .
* /
InfologApp . prototype . filter _change = function ( ) {
var filter = this . et2 . getWidgetById ( 'filter' ) ;
var nm = this . et2 . getWidgetById ( 'nm' ) ;
var dates = this . et2 . getWidgetById ( 'infolog.index.dates' ) ;
if ( nm && filter ) {
switch ( filter . getValue ( ) ) {
case 'bydate' :
case 'duedate' :
if ( filter && dates ) {
dates . set _disabled ( false ) ;
window . setTimeout ( function ( ) {
jQuery ( dates . getWidgetById ( 'startdate' ) . getDOMNode ( ) ) . find ( 'input' ) . focus ( ) ;
} , 0 ) ;
}
break ;
default :
if ( dates ) {
dates . set _disabled ( true ) ;
}
break ;
}
}
} ;
/ * *
* show or hide the details of rows by selecting the filter2 option
* either 'all' for details or 'no_description' for no details
*
* @ param { Event } event Change event
* @ param { et2 _nextmatch } nm The nextmatch widget that owns the filter
* /
InfologApp . prototype . filter2 _change = function ( event , nm ) {
var filter2 = nm . getWidgetById ( 'filter2' ) ;
if ( nm && filter2 ) {
// Show / hide descriptions
this . show _details ( filter2 . get _value ( ) === 'all' , nm . getDOMNode ( nm ) ) ;
}
// Only change columns for a real user event, to avoid interfering with
// favorites
if ( nm && filter2 && ! nm . update _in _progress ) {
// Store selection as implicit preference
egw . set _preference ( 'infolog' , nm . options . settings . columnselection _pref . replace ( '-details' , '' ) + '-details-pref' , filter2 . value ) ;
// 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 ] . visible = false ;
if ( egw . preference ( nm . options . settings . columnselection _pref , 'infolog' ) ) {
nm . set _columns ( egw . preference ( nm . options . settings . columnselection _pref , 'infolog' ) . split ( ',' ) ) ;
}
nm . _applyUserPreferences ( nm . columns , colData ) ;
// Now apply them to columns
for ( var i = 0 ; i < colData . length ; i ++ ) {
nm . dataview . getColumnMgr ( ) . columns [ i ] . set _width ( colData [ i ] . width ) ;
nm . dataview . getColumnMgr ( ) . columns [ i ] . set _visibility ( colData [ i ] . visible ) ;
}
nm . dataview . getColumnMgr ( ) . updated = true ;
// Update page - set update_in_progress to true to avoid triggering
// the change handler and looping if the user has a custom field
// column change
var in _progress = nm . update _in _progress ;
nm . update _in _progress = true ;
// Set the actual filter value here
nm . activeFilters . filter2 = filter2 . get _value ( ) ;
nm . dataview . updateColumns ( ) ;
nm . update _in _progress = in _progress ;
}
return false ;
} ;
/ * *
* Show or hide details by changing the CSS class
*
* @ param { boolean } show
* @ param { DOMNode } dom _node
* /
InfologApp . prototype . show _details = function ( show , dom _node ) {
// Show / hide descriptions
egw . css ( ( dom _node && dom _node . id ? "#" + dom _node . id + ' ' : '' ) + ".et2_box.infoDes" , "display:" + ( show ? "block;" : "none;" ) ) ;
if ( egwIsMobile ( ) ) {
var $select = jQuery ( '.infoDetails' ) ;
( show ) ? $select . each ( function ( i , e ) { jQuery ( e ) . hide ( ) ; } ) : $select . each ( function ( i , e ) { jQuery ( e ) . show ( ) ; } ) ;
}
} ;
InfologApp . prototype . confirm _delete _2 = function ( _action , _senders ) {
var children = false ;
var child _button = jQuery ( '#delete_sub' ) . get ( 0 ) || jQuery ( '[id*="delete_sub"]' ) . get ( 0 ) ;
if ( child _button ) {
for ( var i = 0 ; i < _senders . length ; i ++ ) {
if ( jQuery ( _senders [ i ] . iface . node ) . hasClass ( 'infolog_rowHasSubs' ) ) {
children = true ;
break ;
}
}
child _button . style . display = children ? 'block' : 'none' ;
}
var callbackDeleteDialog = function ( button _id ) {
if ( button _id == et2 _dialog . YES _BUTTON ) {
}
} ;
et2 _dialog . show _dialog ( callbackDeleteDialog , this . egw . lang ( "Do you really want to DELETE this Rule" ) , this . egw . lang ( "Delete" ) , { } , et2 _dialog . BUTTONS _YES _NO _CANCEL , et2 _dialog . WARNING _MESSAGE ) ;
} ;
/ * *
* Confirm delete
* If entry has children , asks if you want to delete children too
*
* @ param _action
* @ param _senders
* /
InfologApp . prototype . confirm _delete = function ( _action , _senders ) {
var children = false ;
var child _button = jQuery ( '#delete_sub' ) . get ( 0 ) || jQuery ( '[id*="delete_sub"]' ) . get ( 0 ) ;
if ( child _button ) {
for ( var i = 0 ; i < _senders . length ; i ++ ) {
if ( jQuery ( _senders [ i ] . iface . getDOMNode ( ) ) . hasClass ( 'infolog_rowHasSubs' ) ) {
children = true ;
break ;
}
}
child _button . style . display = children ? 'block' : 'none' ;
}
nm _open _popup ( _action , _senders ) ;
} ;
/ * *
* Add email from addressbook
*
* @ param ab _id
* @ param info _cc
* /
InfologApp . prototype . add _email _from _ab = function ( ab _id , info _cc ) {
var ab = document . getElementById ( ab _id ) ;
if ( ! ab || ! ab . value ) {
jQuery ( "tr.hiddenRow" ) . css ( "display" , "table-row" ) ;
}
else {
var cc = document . getElementById ( info _cc ) ;
for ( var i = 0 ; i < ab . options . length && ab . options [ i ] . value != ab . value ; ++ i )
;
if ( i < ab . options . length ) {
cc . value += ( cc . value ? ', ' : '' ) + ab . options [ i ] . text . replace ( /^.* <(.*)>$/ , '$1' ) ;
ab . value = '' ;
ab . onchange ( ) ;
jQuery ( "tr.hiddenRow" ) . css ( "display" , "none" ) ;
}
}
return false ;
} ;
/ * *
* If one of info _status , info _percent or info _datecompleted changed -- > set others to reasonable values
*
* @ param { string } changed _id id of changed element
* @ param { string } status _id
* @ param { string } percent _id
* @ param { string } datecompleted _id
* /
InfologApp . prototype . status _changed = function ( changed _id , status _id , percent _id , datecompleted _id ) {
// Make sure this doesn't get executed while template is loading
if ( this . et2 == null || this . et2 . getInstanceManager ( ) == null )
return ;
var status = document . getElementById ( status _id ) ;
var percent = document . getElementById ( percent _id ) ;
var datecompleted = document . getElementById ( datecompleted _id + '[str]' ) ;
if ( ! datecompleted ) {
datecompleted = jQuery ( '#' + datecompleted _id + ' input' ) . get ( 0 ) ;
}
var completed ;
switch ( changed _id ) {
case status _id :
completed = status . value == 'done' || status . value == 'billed' ;
if ( completed || status . value == 'not-started' ||
( status . value == 'ongoing' ) != ( percent . value > 0 && percent . value < 100 ) ) {
if ( completed ) {
percent . value = 100 ;
}
else if ( status . value == 'not-started' ) {
percent . value = 0 ;
}
else if ( ! completed && ( percent . value == 0 || percent . value == 100 ) ) {
percent . value = 10 ;
}
}
break ;
case percent _id :
completed = percent . value == 100 ;
if ( completed != ( status . value == 'done' || status . value == 'billed' ) ||
( status . value == 'not-started' ) != ( percent . value == 0 ) ) {
status . value = percent . value == 0 ? ( jQuery ( '[value="not-started"]' , status ) . length ? 'not-started' : 'ongoing' ) : ( percent . value == 100 ? 'done' : 'ongoing' ) ;
}
break ;
case datecompleted _id + '[str]' :
case datecompleted _id :
completed = datecompleted . value != '' ;
if ( completed != ( status . value == 'done' || status . value == 'billed' ) ) {
status . value = completed ? 'done' : 'not-started' ;
}
if ( completed != ( percent . value == 100 ) ) {
percent . value = completed ? 100 : 0 ;
}
break ;
}
if ( ! completed && datecompleted && datecompleted . value != '' ) {
datecompleted . value = '' ;
}
else if ( completed && datecompleted && datecompleted . value == '' ) {
// todo: set current date in correct format
}
} ;
/ * *
* handle "print" action from "Actions" selectbox in edit infolog window .
* check if the template is dirty then submit the template otherwise just open new window as print .
*
* /
InfologApp . prototype . edit _actions = function ( ) {
var widget = this . et2 . getWidgetById ( 'action' ) ;
var template = this . et2 . _inst ;
if ( template ) {
var id = template . widgetContainer . getArrayMgr ( 'content' ) . data [ 'info_id' ] ;
}
if ( widget ) {
switch ( widget . get _value ( ) ) {
case 'print' :
if ( template . isDirty ( ) ) {
template . submit ( ) ;
}
egw _open ( id , 'infolog' , 'edit' , { print : 1 } ) ;
break ;
case 'ical' :
template . postSubmit ( ) ;
break ;
default :
template . submit ( ) ;
}
}
} ;
/ * *
* Open infolog entry for printing
*
* @ param { aciton object } _action
* @ param { object } _selected
* /
InfologApp . prototype . infolog _menu _print = function ( _action , _selected ) {
var id = _selected [ 0 ] . id . replace ( /^infolog::/g , '' ) ;
egw _open ( id , 'infolog' , 'edit' , { print : 1 } ) ;
} ;
/ * *
* Trigger print ( ) onload window
* /
InfologApp . prototype . infolog _print _preview _onload = function ( ) {
var that = this ;
jQuery ( '#infolog-edit-print' ) . bind ( 'load' , function ( ) {
var isLoadingCompleted = true ;
jQuery ( '#infolog-edit-print' ) . bind ( "DOMSubtreeModified" , function ( event ) {
isLoadingCompleted = false ;
jQuery ( '#infolog-edit-print' ) . unbind ( "DOMSubtreeModified" ) ;
} ) ;
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
* /
InfologApp . prototype . infolog _print _preview = function ( ) {
this . egw . message ( this . egw . lang ( 'Printing...' ) ) ;
this . egw . window . print ( ) ;
} ;
/ * *
*
* /
InfologApp . prototype . add _link _sidemenu = function ( ) {
egw . open ( '' , 'infolog' , 'add' ) ;
} ;
/ * *
* Wrapper so add - > New actions in the context menu can pass current
* filter values into new edit dialog
*
* @ see add _with _extras
*
* @ param { egwAction } action
* @ param { egwActionObject [ ] } selected
* /
InfologApp . prototype . add _action _handler = function ( action , selected ) {
var nm = action . getManager ( ) . data . nextmatch || false ;
if ( nm ) {
this . add _with _extras ( nm , action . id , nm . getArrayMgr ( 'content' ) . getEntry ( 'action' ) , nm . getArrayMgr ( 'content' ) . getEntry ( 'action_id' ) ) ;
}
} ;
/ * *
* 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 { et2 _widget } widget Originating / calling widget
* @ param _type string Type of infolog entry
* @ param _action string Special action for new infolog entry
* @ param _action _id string ID for special action
* /
InfologApp . prototype . add _with _extras = function ( widget , _type , _action , _action _id ) {
// We use widget.getRoot() instead of this.et2 for the case when the
// addressbook tab is viewing a contact + infolog list, there's 2 infolog
// etemplates
var nm = widget . getRoot ( ) . getWidgetById ( 'nm' ) ;
var nm _value = nm . getValue ( ) || { } ;
// It's important that all these keys are here, they override the link
// registry.
var action _id = nm _value . action _id ? nm _value . action _id : ( _action _id != '0' ? _action _id : "" ) || "" ;
if ( typeof action _id == "object" && typeof action _id . length == "undefined" ) {
// Need a real array here
action _id = jQuery . map ( action _id , function ( val ) { return val ; } ) ;
}
// No action? Try the linked filter, in case it's set
if ( ! _action && ! _action _id ) {
if ( nm _value . col _filter && nm _value . col _filter . linked ) {
var split = nm _value . col _filter . linked . split ( ':' ) || '' ;
_action = split [ 0 ] || '' ;
action _id = split [ 1 ] || '' ;
}
}
var extras = {
type : _type || nm _value . col _filter . info _type || "task" ,
cat _id : nm _value . cat _id || "" ,
action : nm _value . action || _action || "" ,
// egw_link can handle arrays; but server is expecting CSV
action _id : typeof action _id . join != "undefined" ? action _id . join ( ',' ) : action _id
} ;
egw . open ( '' , 'infolog' , 'add' , extras ) ;
} ;
/ * *
* Get title in order to set it as document title
* @ returns { string }
* /
InfologApp . prototype . getWindowTitle = function ( ) {
var widget = this . et2 . getWidgetById ( 'info_subject' ) ;
if ( widget )
return widget . options . value ;
} ;
/ * *
* View parent entry with all children
*
* @ param { aciton object } _action
* @ param { object } _selected
* /
InfologApp . prototype . view _parent = function ( _action , _selected ) {
var data = egw . dataGetUIDdata ( _selected [ 0 ] . id ) ;
if ( data && data . data && data . data . info _id _parent ) {
egw . link _handler ( egw . link ( '/index.php' , {
menuaction : "infolog.infolog_ui.index" ,
action : "sp" ,
action _id : data . data . info _id _parent ,
ajax : "true"
} ) , "infolog" ) ;
}
} ;
/ * *
* Mess with the query for parent widget to exclude self
*
* @ param { Object } request
* @ param { et2 _link _entry } widget
* @ returns { boolean }
* /
InfologApp . prototype . parent _query = function ( request , widget ) {
// No ID yet, no need to filter
if ( ! widget . getRoot ( ) . getArrayMgr ( 'content' ) . getEntry ( 'info_id' ) ) {
return true ;
}
if ( ! request . options ) {
request . options = { } ;
}
// Exclude self from results - no app needed since it's just one app
request . options . exclude = [ widget . getRoot ( ) . getArrayMgr ( 'content' ) . getEntry ( 'info_id' ) ] ;
return true ;
} ;
/ * *
* View a list of timesheets for the linked infolog entry
*
* Only one infolog entry at a time is allowed , we just pick the first one
*
* @ param { egwAction } _action
* @ param { egwActionObject [ ] } _selected
* /
InfologApp . prototype . timesheet _list = function ( _action , _selected ) {
var extras = {
link _app : 'infolog' ,
link _id : false
} ;
for ( var i = 0 ; i < _selected . length ; i ++ ) {
// Remove UID prefix for just contact_id
var ids = _selected [ i ] . id . split ( '::' ) ;
ids . shift ( ) ;
ids = ids . join ( '::' ) ;
extras . link _id = ids ;
break ;
}
egw . open ( "" , "timesheet" , "list" , extras , 'timesheet' ) ;
} ;
/ * *
* Go to parent entry
*
* @ param { aciton object } _action
* @ param { object } _selected
* /
InfologApp . prototype . has _parent = function ( _action , _selected ) {
var data = egw . dataGetUIDdata ( _selected [ 0 ] . id ) ;
return data && data . data && data . data . info _id _parent > 0 ;
} ;
/ * *
* Submit template if widget has a value
*
* Used for project - selection to update pricelist items from server
*
* @ param { DOMNode } _node
* @ param { et2 _widget } _widget
* /
InfologApp . prototype . submit _if _not _empty = function ( _node , _widget ) {
if ( _widget . get _value ( ) )
this . et2 . _inst . submit ( ) ;
} ;
/ * *
* Toggle encryption
*
* @ param { jQuery . Event } _event
* @ param { et2 _button } _widget
* @ param { DOMNode } _node
* /
InfologApp . prototype . toggleEncrypt = function ( _event , _widget , _node ) {
if ( ! this . egw . user ( 'apps' ) . stylite ) {
this . egw . message ( this . egw . lang ( 'InfoLog encryption requires EPL Subscription' ) + ': <a href="http://www.egroupware.org/EPL">www.egroupware.org/EPL</a>' ) ;
return ;
}
this . _get _stylite ( function ( ) { app . stylite . toggleEncrypt . call ( app . stylite , _event , _widget , _node ) ; } ) ;
} ;
/ * *
* Make sure stylite javascript is loaded , and call the given callback when it is
*
* @ param { function } callback
* @ param { object } attrs
*
* /
InfologApp . prototype . _get _stylite = function ( callback , attrs ) {
// use app object from etemplate2, which might be private and not just window.app
var app = this . et2 . getInstanceManager ( ) . app _obj ;
if ( ! app . stylite ) {
var self = this ;
egw _LAB . script ( 'stylite/js/infolog-encryption.js?' + this . et2 . getArrayMgr ( 'content' ) . data . encryption _ts ) . wait ( function ( ) {
app . stylite = new app . classes . stylite ;
app . stylite . et2 = self . et2 ;
if ( callback ) {
callback . apply ( app . stylite , attrs ) ;
}
} ) ;
}
else {
app . stylite . et2 = this . et2 ;
callback . apply ( app . stylite , attrs ) ;
}
} ;
/ * *
* OnChange callback for responsible
*
* @ param { jQuery . Event } _event
* @ param { et2 _widget } _widget
* /
InfologApp . prototype . onchangeResponsible = function ( _event , _widget ) {
if ( app . stylite && app . stylite . onchangeResponsible ) {
app . stylite . onchangeResponsible . call ( app . stylite , _event , _widget ) ;
}
} ;
/ * *
* Action handler for context menu change responsible action
*
* We populate the dialog with the current value .
*
* @ param { egwAction } _action
* @ param { egwActionObject [ ] } _selected
* /
InfologApp . prototype . change _responsible = function ( _action , _selected ) {
var et2 = _selected [ 0 ] . manager . data . nextmatch . getInstanceManager ( ) ;
var responsible = et2 . widgetContainer . getWidgetById ( 'responsible' ) ;
if ( responsible ) {
responsible . set _value ( [ ] ) ;
et2 . widgetContainer . getWidgetById ( 'responsible_action[title]' ) . set _value ( '' ) ;
et2 . widgetContainer . getWidgetById ( 'responsible_action[title]' ) . set _class ( '' ) ;
et2 . widgetContainer . getWidgetById ( 'responsible_action[ok]' ) . set _disabled ( _selected . length !== 1 ) ;
et2 . widgetContainer . getWidgetById ( 'responsible_action[add]' ) . set _disabled ( _selected . length === 1 ) ;
et2 . widgetContainer . getWidgetById ( 'responsible_action[delete]' ) . set _disabled ( _selected . length === 1 ) ;
}
if ( _selected . length === 1 ) {
var data = egw . dataGetUIDdata ( _selected [ 0 ] . id ) ;
if ( responsible && data && data . data ) {
et2 . widgetContainer . getWidgetById ( 'responsible_action[title]' ) . set _value ( data . data . info _subject ) ;
et2 . widgetContainer . getWidgetById ( 'responsible_action[title]' ) . set _class ( data . data . sub _class ) ;
responsible . set _value ( data . data . info _responsible ) ;
}
}
nm _open _popup ( _action , _selected ) ;
} ;
/ * *
* Handle encrypted info _desc for print purpose
* and triggers print action after decryption
*
* @ param { Keyring } _keyring Mailvelope keyring to use
* /
InfologApp . prototype . printEncrypt = function ( _keyring ) {
//this.mailvelopeAvailable(this.toggleEncrypt);
var info _desc = this . et2 . getWidgetById ( 'info_des' ) ;
var self = this ;
mailvelope . createDisplayContainer ( '#infolog-edit-print_info_des' , info _desc . value , _keyring ) . then ( function ( _container ) {
var $info _des _dom = jQuery ( self . et2 . getWidgetById ( 'info_des' ) . getDOMNode ( ) ) ;
// $info_des_dom.children('iframe').height($info_des_dom.height());
$info _des _dom . children ( 'span' ) . hide ( ) ;
//Trigger print action
self . infolog _print _preview ( ) ;
} , function ( _err ) {
self . egw . message ( _err , 'error' ) ;
} ) ;
} ;
return InfologApp ;
} ( egw _app _1 . EgwApp ) ) ;
app . classes . infolog = InfologApp ;
//# sourceMappingURL=app.js.map