Improved application log backend. Now all controllers have " @log 'debug|notice|error', 'some ' " available.
This commit is contained in:
parent
5820f23da5
commit
76cafc60ba
36 changed files with 219 additions and 231 deletions
|
@ -452,7 +452,7 @@ class App.ControllerModal extends App.Controller
|
||||||
|
|
||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@log 'You need to implement your own "submit" method!'
|
@log 'error', 'You need to implement your own "submit" method!'
|
||||||
|
|
||||||
class App.ErrorModal extends App.ControllerModal
|
class App.ErrorModal extends App.ControllerModal
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
|
|
@ -18,7 +18,7 @@ class App.ControllerForm extends App.Controller
|
||||||
@form.html()
|
@form.html()
|
||||||
|
|
||||||
formGen: ->
|
formGen: ->
|
||||||
App.Log.log 'ControllerForm', 'debug', 'formGen', @model.configure_attributes
|
App.Log.debug 'ControllerForm', 'formGen', @model.configure_attributes
|
||||||
|
|
||||||
fieldset = $('<fieldset>')
|
fieldset = $('<fieldset>')
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class App.ControllerForm extends App.Controller
|
||||||
if attribute.name of @params
|
if attribute.name of @params
|
||||||
attribute.value = @params[attribute.name]
|
attribute.value = @params[attribute.name]
|
||||||
|
|
||||||
App.Log.log 'ControllerForm', 'debug', 'formGenItem-before', attribute
|
App.Log.debug 'ControllerForm', 'formGenItem-before', attribute
|
||||||
|
|
||||||
# build options list based on config
|
# build options list based on config
|
||||||
@_getConfigOptionList( attribute )
|
@_getConfigOptionList( attribute )
|
||||||
|
@ -259,7 +259,6 @@ class App.ControllerForm extends App.Controller
|
||||||
counter = 0
|
counter = 0
|
||||||
for key of loopData
|
for key of loopData
|
||||||
counter =+ 1
|
counter =+ 1
|
||||||
# @log 'kkk', key, loopData[ key ]
|
|
||||||
|
|
||||||
# clone to keep it untouched for next loop
|
# clone to keep it untouched for next loop
|
||||||
select = _.clone( attribute )
|
select = _.clone( attribute )
|
||||||
|
@ -432,17 +431,15 @@ class App.ControllerForm extends App.Controller
|
||||||
source: '/users/search',
|
source: '/users/search',
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
select: ( event, ui ) =>
|
select: ( event, ui ) =>
|
||||||
@log 'selected', event, ui
|
@log 'notice', 'selected', event, ui
|
||||||
b(event, ui.item.id)
|
b(event, ui.item.id)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
###
|
###
|
||||||
# @log '111111', @local_attribute_full, item
|
|
||||||
$(@local_attribute_full).autocomplete(
|
$(@local_attribute_full).autocomplete(
|
||||||
source: 'api/users/search',
|
source: 'api/users/search',
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
select: ( event, ui ) =>
|
select: ( event, ui ) =>
|
||||||
# @log 'selected', event, ui
|
|
||||||
b(event, ui.item.id)
|
b(event, ui.item.id)
|
||||||
)
|
)
|
||||||
@delay( a, 180 )
|
@delay( a, 180 )
|
||||||
|
@ -935,7 +932,6 @@ class App.ControllerForm extends App.Controller
|
||||||
item = $( App.view('generic/input')( attribute: attribute ) )
|
item = $( App.view('generic/input')( attribute: attribute ) )
|
||||||
|
|
||||||
if attribute.onchange
|
if attribute.onchange
|
||||||
# @log 'on change', attribute.name
|
|
||||||
if typeof attribute.onchange is 'function'
|
if typeof attribute.onchange is 'function'
|
||||||
attribute.onchange(attribute)
|
attribute.onchange(attribute)
|
||||||
else
|
else
|
||||||
|
@ -943,7 +939,6 @@ class App.ControllerForm extends App.Controller
|
||||||
a = i.split(/__/)
|
a = i.split(/__/)
|
||||||
if a[1]
|
if a[1]
|
||||||
if a[0] is attribute.name
|
if a[0] is attribute.name
|
||||||
# @log 'aaa', i, a[0], attribute.id
|
|
||||||
@attribute = attribute
|
@attribute = attribute
|
||||||
@classname = classname
|
@classname = classname
|
||||||
@attributes_clean = attributes_clean
|
@attributes_clean = attributes_clean
|
||||||
|
@ -1114,11 +1109,11 @@ class App.ControllerForm extends App.Controller
|
||||||
|
|
||||||
list = []
|
list = []
|
||||||
if attribute.filter
|
if attribute.filter
|
||||||
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter', attribute.filter
|
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter', attribute.filter
|
||||||
|
|
||||||
# function based filter
|
# function based filter
|
||||||
if typeof attribute.filter is 'function'
|
if typeof attribute.filter is 'function'
|
||||||
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-function'
|
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-function'
|
||||||
|
|
||||||
all = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
all = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
||||||
|
|
||||||
|
@ -1128,7 +1123,7 @@ class App.ControllerForm extends App.Controller
|
||||||
else if attribute.filter[ attribute.name ]
|
else if attribute.filter[ attribute.name ]
|
||||||
filter = attribute.filter[ attribute.name ]
|
filter = attribute.filter[ attribute.name ]
|
||||||
|
|
||||||
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-data', filter
|
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-data', filter
|
||||||
|
|
||||||
# check all records
|
# check all records
|
||||||
for record in App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
for record in App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
||||||
|
@ -1143,13 +1138,13 @@ class App.ControllerForm extends App.Controller
|
||||||
|
|
||||||
# no data filter matched
|
# no data filter matched
|
||||||
else
|
else
|
||||||
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-data no filter matched'
|
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-data no filter matched'
|
||||||
list = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
list = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
||||||
else
|
else
|
||||||
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList:filter-no filter defined'
|
App.Log.debug 'ControllerForm', '_getRelationOptionList:filter-no filter defined'
|
||||||
list = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
list = App.Collection.all( type: attribute.relation, sortBy: attribute.sortBy || 'name' )
|
||||||
|
|
||||||
App.Log.log 'ControllerForm', 'debug', '_getRelationOptionList', attribute, list
|
App.Log.debug 'ControllerForm', '_getRelationOptionList', attribute, list
|
||||||
|
|
||||||
# build options list
|
# build options list
|
||||||
@_buildOptionList( list, attribute )
|
@_buildOptionList( list, attribute )
|
||||||
|
@ -1180,7 +1175,7 @@ class App.ControllerForm extends App.Controller
|
||||||
return if !attribute.options
|
return if !attribute.options
|
||||||
|
|
||||||
return if typeof attribute.filter isnt 'function'
|
return if typeof attribute.filter isnt 'function'
|
||||||
App.Log.log 'ControllerForm', 'debug', '_filterOption:filter-function'
|
App.Log.debug 'ControllerForm', '_filterOption:filter-function'
|
||||||
|
|
||||||
attribute.options = attribute.filter( attribute.options, attribute )
|
attribute.options = attribute.filter( attribute.options, attribute )
|
||||||
|
|
||||||
|
@ -1251,7 +1246,7 @@ class App.ControllerForm extends App.Controller
|
||||||
else if form.parents().find('form')[0]
|
else if form.parents().find('form')[0]
|
||||||
form = form.parents().find('form')
|
form = form.parents().find('form')
|
||||||
else
|
else
|
||||||
App.Log.log 'ControllerForm', 'error', 'no form found!', form
|
App.Log.error 'ControllerForm', 'no form found!', form
|
||||||
|
|
||||||
array = form.serializeArray()
|
array = form.serializeArray()
|
||||||
|
|
||||||
|
@ -1320,7 +1315,7 @@ class App.ControllerForm extends App.Controller
|
||||||
for key of inputSelectObject
|
for key of inputSelectObject
|
||||||
param[ key ] = inputSelectObject[ key ]
|
param[ key ] = inputSelectObject[ key ]
|
||||||
|
|
||||||
#App.Log.log 'ControllerForm', 'notice', 'formParam', form, param
|
#App.Log.notice 'ControllerForm', 'formParam', form, param
|
||||||
return param
|
return param
|
||||||
|
|
||||||
@formId: ->
|
@formId: ->
|
||||||
|
@ -1328,14 +1323,14 @@ class App.ControllerForm extends App.Controller
|
||||||
formId.toString().substr formId.toString().length-9, 9
|
formId.toString().substr formId.toString().length-9, 9
|
||||||
|
|
||||||
@disable: (form) ->
|
@disable: (form) ->
|
||||||
App.Log.log 'ControllerForm', 'notice', 'disable...', $(form.target).parent()
|
App.Log.notice 'ControllerForm', 'disable...', $(form.target).parent()
|
||||||
$(form.target).parent().find('button').attr('disabled', true)
|
$(form.target).parent().find('button').attr('disabled', true)
|
||||||
$(form.target).parent().find('[type="submit"]').attr('disabled', true)
|
$(form.target).parent().find('[type="submit"]').attr('disabled', true)
|
||||||
$(form.target).parent().find('[type="reset"]').attr('disabled', true)
|
$(form.target).parent().find('[type="reset"]').attr('disabled', true)
|
||||||
|
|
||||||
|
|
||||||
@enable: (form) ->
|
@enable: (form) ->
|
||||||
App.Log.log 'ControllerForm', 'notice', 'enable...', $(form.target).parent()
|
App.Log.notice 'ControllerForm', 'enable...', $(form.target).parent()
|
||||||
$(form.target).parent().find('button').attr('disabled', false)
|
$(form.target).parent().find('button').attr('disabled', false)
|
||||||
$(form.target).parent().find('[type="submit"]').attr('disabled', false)
|
$(form.target).parent().find('[type="submit"]').attr('disabled', false)
|
||||||
$(form.target).parent().find('[type="reset"]').attr('disabled', false)
|
$(form.target).parent().find('[type="reset"]').attr('disabled', false)
|
||||||
|
|
|
@ -21,7 +21,6 @@ class App.ControllerGenericNew extends App.ControllerModal
|
||||||
@modalShow()
|
@modalShow()
|
||||||
|
|
||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
@log 'submit'
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
params = @formParam( e.target )
|
params = @formParam( e.target )
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ class App.ControllerGenericNew extends App.ControllerModal
|
||||||
# validate
|
# validate
|
||||||
errors = object.validate()
|
errors = object.validate()
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@ class App.ControllerGenericEdit extends App.ControllerModal
|
||||||
# validate
|
# validate
|
||||||
errors = @item.validate()
|
errors = @item.validate()
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -133,9 +132,9 @@ class App.ControllerGenericIndex extends App.ControllerContent
|
||||||
)
|
)
|
||||||
|
|
||||||
App[ @genericObject ].bind 'ajaxError', (rec, msg) =>
|
App[ @genericObject ].bind 'ajaxError', (rec, msg) =>
|
||||||
@log 'ajax notice', msg.status
|
@log 'error', 'ajax', msg.status
|
||||||
if msg.status is 401
|
if msg.status is 401
|
||||||
@log 'ajax error', rec, msg, msg.status
|
@log 'error', 'ajax', rec, msg, msg.status
|
||||||
# @navigate @pageData.navupdate
|
# @navigate @pageData.navupdate
|
||||||
# alert('relogin')
|
# alert('relogin')
|
||||||
@navigate 'login'
|
@navigate 'login'
|
||||||
|
|
|
@ -110,7 +110,7 @@ class App.ControllerTable extends App.Controller
|
||||||
record = App.Collection.find( attribute.relation, object[rowWithoutId] )
|
record = App.Collection.find( attribute.relation, object[rowWithoutId] )
|
||||||
object[row.name] = record.name
|
object[row.name] = record.name
|
||||||
|
|
||||||
@log 'ControllerTable', 'debug', 'table', 'header', header, 'overview', dataTypesForCols, 'objects', data.objects
|
@log 'debug', 'table', 'header', header, 'overview', dataTypesForCols, 'objects', data.objects
|
||||||
table = App.view('generic/table')(
|
table = App.view('generic/table')(
|
||||||
header: header
|
header: header
|
||||||
overview: dataTypesForCols
|
overview: dataTypesForCols
|
||||||
|
@ -133,4 +133,4 @@ class App.ControllerTable extends App.Controller
|
||||||
$(e.target).parents().find('[name="bulk"]').attr( 'checked', false );
|
$(e.target).parents().find('[name="bulk"]').attr( 'checked', false );
|
||||||
)
|
)
|
||||||
|
|
||||||
return table
|
return table
|
||||||
|
|
|
@ -119,7 +119,7 @@ class App.ChannelEmailFilterEdit extends App.ControllerModal
|
||||||
|
|
||||||
# show errors in form
|
# show errors in form
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -131,7 +131,6 @@ class App.ChannelEmailFilterEdit extends App.ControllerModal
|
||||||
success: =>
|
success: =>
|
||||||
@modalHide()
|
@modalHide()
|
||||||
error: =>
|
error: =>
|
||||||
@log 'errors'
|
|
||||||
@modalHide()
|
@modalHide()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -211,7 +210,7 @@ class App.ChannelEmailAddressEdit extends App.ControllerModal
|
||||||
|
|
||||||
# show errors in form
|
# show errors in form
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -223,7 +222,6 @@ class App.ChannelEmailAddressEdit extends App.ControllerModal
|
||||||
success: =>
|
success: =>
|
||||||
@modalHide()
|
@modalHide()
|
||||||
error: =>
|
error: =>
|
||||||
@log 'errors'
|
|
||||||
@modalHide()
|
@modalHide()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -259,7 +257,6 @@ class App.ChannelEmailSignature extends App.Controller
|
||||||
edit: (e) =>
|
edit: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
item = $(e.target).item( App.Signature )
|
item = $(e.target).item( App.Signature )
|
||||||
@log '123', item, $(e.target)
|
|
||||||
new App.ChannelEmailSignatureEdit( object: item )
|
new App.ChannelEmailSignatureEdit( object: item )
|
||||||
|
|
||||||
class App.ChannelEmailSignatureEdit extends App.ControllerModal
|
class App.ChannelEmailSignatureEdit extends App.ControllerModal
|
||||||
|
@ -303,7 +300,7 @@ class App.ChannelEmailSignatureEdit extends App.ControllerModal
|
||||||
|
|
||||||
# show errors in form
|
# show errors in form
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -315,7 +312,6 @@ class App.ChannelEmailSignatureEdit extends App.ControllerModal
|
||||||
success: =>
|
success: =>
|
||||||
@modalHide()
|
@modalHide()
|
||||||
error: =>
|
error: =>
|
||||||
@log 'errors'
|
|
||||||
@modalHide()
|
@modalHide()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -430,7 +426,7 @@ class App.ChannelEmailInboundEdit extends App.ControllerModal
|
||||||
|
|
||||||
# show errors in form
|
# show errors in form
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -442,7 +438,6 @@ class App.ChannelEmailInboundEdit extends App.ControllerModal
|
||||||
success: =>
|
success: =>
|
||||||
@modalHide()
|
@modalHide()
|
||||||
error: =>
|
error: =>
|
||||||
@log 'errors'
|
|
||||||
@modalHide()
|
@modalHide()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,6 @@ class App.DashboardActivityStream extends App.Controller
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
id = $(e.target).parents('[data-id]').data('id')
|
id = $(e.target).parents('[data-id]').data('id')
|
||||||
subid = $(e.target).parents('[data-subid]').data('subid')
|
subid = $(e.target).parents('[data-subid]').data('subid')
|
||||||
@log 'goto zoom!', id, subid
|
|
||||||
if subid
|
if subid
|
||||||
@navigate 'ticket/zoom/' + id + '/' + subid
|
@navigate 'ticket/zoom/' + id + '/' + subid
|
||||||
else
|
else
|
||||||
|
|
|
@ -4,7 +4,6 @@ class App.DashboardRecentViewed extends App.Controller
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
# @log 'aaaa', @el
|
|
||||||
|
|
||||||
@items = []
|
@items = []
|
||||||
|
|
||||||
|
@ -54,5 +53,5 @@ class App.DashboardRecentViewed extends App.Controller
|
||||||
zoom: (e) =>
|
zoom: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
id = $(e.target).parents('[data-id]').data('id')
|
id = $(e.target).parents('[data-id]').data('id')
|
||||||
@log 'goto zoom!'
|
|
||||||
@navigate 'ticket/zoom/' + id
|
@navigate 'ticket/zoom/' + id
|
||||||
|
|
|
@ -59,12 +59,12 @@ class App.DashboardTicket extends App.Controller
|
||||||
|
|
||||||
App.Overview.unbind('local:rerender')
|
App.Overview.unbind('local:rerender')
|
||||||
App.Overview.bind 'local:rerender', (record) =>
|
App.Overview.bind 'local:rerender', (record) =>
|
||||||
@log 'rerender...', record
|
@log 'notice', 'rerender...', record
|
||||||
@render(data)
|
@render(data)
|
||||||
|
|
||||||
App.Overview.unbind('local:refetch')
|
App.Overview.unbind('local:refetch')
|
||||||
App.Overview.bind 'local:refetch', (record) =>
|
App.Overview.bind 'local:refetch', (record) =>
|
||||||
@log 'refetch...', record
|
@log 'notice', 'refetch...', record
|
||||||
@fetch()
|
@fetch()
|
||||||
|
|
||||||
@render( data )
|
@render( data )
|
||||||
|
@ -123,7 +123,6 @@ class App.DashboardTicket extends App.Controller
|
||||||
@Config.set('LastOverviewPosition', position )
|
@Config.set('LastOverviewPosition', position )
|
||||||
@Config.set('LastOverviewTotal', @tickets_count )
|
@Config.set('LastOverviewTotal', @tickets_count )
|
||||||
|
|
||||||
@log 'goto zoom!', id, position
|
|
||||||
@navigate 'ticket/zoom/' + id + '/nav/true'
|
@navigate 'ticket/zoom/' + id + '/nav/true'
|
||||||
|
|
||||||
settings: (e) =>
|
settings: (e) =>
|
||||||
|
|
|
@ -46,7 +46,7 @@ class App.TicketCreate extends App.Controller
|
||||||
|
|
||||||
# lisen if view need to be rerendert
|
# lisen if view need to be rerendert
|
||||||
App.Event.bind 'ticket_create_rerender', (defaults) =>
|
App.Event.bind 'ticket_create_rerender', (defaults) =>
|
||||||
@log 'AgentTicketPhone', 'error', defaults
|
@log 'notice', 'error', defaults
|
||||||
@render(defaults)
|
@render(defaults)
|
||||||
|
|
||||||
# start auto save
|
# start auto save
|
||||||
|
@ -90,7 +90,7 @@ class App.TicketCreate extends App.Controller
|
||||||
diff = difference( @autosaveLast, data )
|
diff = difference( @autosaveLast, data )
|
||||||
if !@autosaveLast || ( diff && !_.isEmpty( diff ) )
|
if !@autosaveLast || ( diff && !_.isEmpty( diff ) )
|
||||||
@autosaveLast = data
|
@autosaveLast = data
|
||||||
console.log('form hash changed', diff, data)
|
@log 'notice', 'form hash changed', diff, data
|
||||||
App.TaskManager.update( @task_key, { 'state': data })
|
App.TaskManager.update( @task_key, { 'state': data })
|
||||||
@interval( update, 10000, @id, @auto_save_key )
|
@interval( update, 10000, @id, @auto_save_key )
|
||||||
|
|
||||||
|
@ -145,7 +145,6 @@ class App.TicketCreate extends App.Controller
|
||||||
t.customer_id_autocompletion = a.from
|
t.customer_id_autocompletion = a.from
|
||||||
t.subject = a.subject || t.title
|
t.subject = a.subject || t.title
|
||||||
t.body = a.body
|
t.body = a.body
|
||||||
@log '11111', t
|
|
||||||
@render( options: t )
|
@render( options: t )
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -286,7 +285,7 @@ class App.TicketCreate extends App.Controller
|
||||||
|
|
||||||
# show errors in form
|
# show errors in form
|
||||||
if errors
|
if errors
|
||||||
console.log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
|
|
||||||
# save ticket, create article
|
# save ticket, create article
|
||||||
|
@ -346,7 +345,7 @@ class UserNew extends App.ControllerModal
|
||||||
@modalShow()
|
@modalShow()
|
||||||
|
|
||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
@log 'submit'
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
|
|
||||||
|
@ -359,12 +358,12 @@ class UserNew extends App.ControllerModal
|
||||||
# find role_id
|
# find role_id
|
||||||
role = App.Collection.findByAttribute( 'Role', 'name', 'Customer' )
|
role = App.Collection.findByAttribute( 'Role', 'name', 'Customer' )
|
||||||
params.role_ids = role.id
|
params.role_ids = role.id
|
||||||
@log 'updateAttributes', params
|
@log 'notice', 'updateAttributes', params
|
||||||
user.load(params)
|
user.load(params)
|
||||||
|
|
||||||
errors = user.validate()
|
errors = user.validate()
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -391,7 +390,6 @@ class UserNew extends App.ControllerModal
|
||||||
class TicketCreateRouter extends App.ControllerPermanent
|
class TicketCreateRouter extends App.ControllerPermanent
|
||||||
constructor: (params) ->
|
constructor: (params) ->
|
||||||
super
|
super
|
||||||
@log 'create router', params
|
|
||||||
|
|
||||||
# create new uniq form id
|
# create new uniq form id
|
||||||
if !params['id']
|
if !params['id']
|
||||||
|
|
|
@ -58,7 +58,7 @@ class App.TicketHistory extends App.ControllerModal
|
||||||
sortorder: (e) ->
|
sortorder: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
isSorted = @el.find('.sorted')
|
isSorted = @el.find('.sorted')
|
||||||
@log 'is sorted?', isSorted
|
|
||||||
if isSorted.length
|
if isSorted.length
|
||||||
@sortstate = 'notsorted'
|
@sortstate = 'notsorted'
|
||||||
@html App.view('agent_ticket_history')(
|
@html App.view('agent_ticket_history')(
|
||||||
|
|
|
@ -124,7 +124,7 @@ class App.TicketMerge extends App.ControllerModal
|
||||||
@modalHide()
|
@modalHide()
|
||||||
|
|
||||||
# view ticket
|
# view ticket
|
||||||
@log 'nav...', App.Collection.find( 'Ticket', data.master_ticket['id'] )
|
@log 'notice', 'nav...', App.Collection.find( 'Ticket', data.master_ticket['id'] )
|
||||||
@navigate '#ticket/zoom/' + data.master_ticket['id']
|
@navigate '#ticket/zoom/' + data.master_ticket['id']
|
||||||
|
|
||||||
# notify UI
|
# notify UI
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Index extends App.ControllerContent
|
||||||
return if !@authenticate()
|
return if !@authenticate()
|
||||||
|
|
||||||
@view_mode = localStorage.getItem( "mode:#{@view}" ) || 's'
|
@view_mode = localStorage.getItem( "mode:#{@view}" ) || 's'
|
||||||
@log 'view:', @view, @view_mode
|
@log 'notice', 'view:', @view, @view_mode
|
||||||
|
|
||||||
# set title
|
# set title
|
||||||
@title ''
|
@title ''
|
||||||
|
@ -78,12 +78,12 @@ class Index extends App.ControllerContent
|
||||||
|
|
||||||
App.Overview.unbind('local:rerender')
|
App.Overview.unbind('local:rerender')
|
||||||
App.Overview.bind 'local:rerender', (record) =>
|
App.Overview.bind 'local:rerender', (record) =>
|
||||||
@log 'rerender...', record
|
@log 'notice', 'rerender...', record
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
App.Overview.unbind('local:refetch')
|
App.Overview.unbind('local:refetch')
|
||||||
App.Overview.bind 'local:refetch', (record) =>
|
App.Overview.bind 'local:refetch', (record) =>
|
||||||
@log 'refetch...', record
|
@log 'notice', 'refetch...', record
|
||||||
@fetch()
|
@fetch()
|
||||||
|
|
||||||
# # bind render after a change is done
|
# # bind render after a change is done
|
||||||
|
@ -286,7 +286,7 @@ class Index extends App.ControllerContent
|
||||||
@bulk_count = @el.find('.table-overview').find('[name="bulk"]:checked').length
|
@bulk_count = @el.find('.table-overview').find('[name="bulk"]:checked').length
|
||||||
@bulk_count_index = 0
|
@bulk_count_index = 0
|
||||||
@el.find('.table-overview').find('[name="bulk"]:checked').each( (index, element) =>
|
@el.find('.table-overview').find('[name="bulk"]:checked').each( (index, element) =>
|
||||||
@log '@bulk_count_index', @bulk_count, @bulk_count_index
|
@log 'notice', '@bulk_count_index', @bulk_count, @bulk_count_index
|
||||||
ticket_id = $(element).val()
|
ticket_id = $(element).val()
|
||||||
ticket = App.Ticket.find(ticket_id)
|
ticket = App.Ticket.find(ticket_id)
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
|
@ -297,7 +297,7 @@ class Index extends App.ControllerContent
|
||||||
if params[item] != ''
|
if params[item] != ''
|
||||||
ticket_update[item] = params[item]
|
ticket_update[item] = params[item]
|
||||||
|
|
||||||
# @log 'update', params, ticket_update, ticket
|
# @log 'notice', 'update', params, ticket_update, ticket
|
||||||
|
|
||||||
ticket.load(ticket_update)
|
ticket.load(ticket_update)
|
||||||
ticket.save(
|
ticket.save(
|
||||||
|
|
|
@ -114,7 +114,6 @@ class App.ChatWidget extends App.Controller
|
||||||
@el.find('div.well').addClass('alert-success')
|
@el.find('div.well').addClass('alert-success')
|
||||||
@delay( =>
|
@delay( =>
|
||||||
@el.find('div.well').removeClass('alert-success')
|
@el.find('div.well').removeClass('alert-success')
|
||||||
@log 'DELAY rm'
|
|
||||||
|
|
||||||
App.Event.trigger(
|
App.Event.trigger(
|
||||||
'ws:send'
|
'ws:send'
|
||||||
|
|
|
@ -82,13 +82,13 @@ class Index extends App.ControllerContent
|
||||||
else
|
else
|
||||||
@params.role_ids = [0]
|
@params.role_ids = [0]
|
||||||
|
|
||||||
@log 'updateAttributes', @params
|
@log 'notice', 'updateAttributes', @params
|
||||||
user = new App.User
|
user = new App.User
|
||||||
user.load(@params)
|
user.load(@params)
|
||||||
|
|
||||||
errors = user.validate()
|
errors = user.validate()
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate( form: e.target, errors: errors )
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ class Index extends App.ControllerContent
|
||||||
)
|
)
|
||||||
|
|
||||||
relogin: (data, status, xhr) =>
|
relogin: (data, status, xhr) =>
|
||||||
@log 'login:success', data
|
@log 'notice', 'relogin:success', data
|
||||||
|
|
||||||
# login check
|
# login check
|
||||||
App.Auth.loginCheck()
|
App.Auth.loginCheck()
|
||||||
|
|
|
@ -121,7 +121,6 @@ class App.LinkAdd extends App.ControllerModal
|
||||||
submit: (e) =>
|
submit: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
@log 'link', params
|
|
||||||
|
|
||||||
# get data
|
# get data
|
||||||
App.Com.ajax(
|
App.Com.ajax(
|
||||||
|
@ -139,4 +138,4 @@ class App.LinkAdd extends App.ControllerModal
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
@modalHide()
|
@modalHide()
|
||||||
@parent.fetch()
|
@parent.fetch()
|
||||||
)
|
)
|
||||||
|
|
|
@ -74,7 +74,6 @@ class Index extends App.ControllerContent
|
||||||
)
|
)
|
||||||
|
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
@log 'login:success', data
|
|
||||||
|
|
||||||
# rebuild navbar with ticket overview counter
|
# rebuild navbar with ticket overview counter
|
||||||
App.WebSocket.send( event: 'navupdate_ticket_overview' )
|
App.WebSocket.send( event: 'navupdate_ticket_overview' )
|
||||||
|
@ -88,13 +87,13 @@ class Index extends App.ControllerContent
|
||||||
# redirect to #
|
# redirect to #
|
||||||
requested_url = @Config.get( 'requested_url' )
|
requested_url = @Config.get( 'requested_url' )
|
||||||
if requested_url && requested_url isnt '#login'
|
if requested_url && requested_url isnt '#login'
|
||||||
console.log("REDIRECT to '#{requested_url}'")
|
@log 'notice', "REDIRECT to '#{requested_url}'"
|
||||||
@navigate requested_url
|
@navigate requested_url
|
||||||
|
|
||||||
# reset
|
# reset
|
||||||
@Config.set( 'requested_url', '' )
|
@Config.set( 'requested_url', '' )
|
||||||
else
|
else
|
||||||
console.log("REDIRECT to -#/-")
|
@log 'notice', "REDIRECT to -#/-"
|
||||||
@navigate '#/'
|
@navigate '#/'
|
||||||
|
|
||||||
error: (xhr, statusText, error) =>
|
error: (xhr, statusText, error) =>
|
||||||
|
|
|
@ -19,10 +19,10 @@ class Index extends App.ControllerContent
|
||||||
networks = App.Network.all()
|
networks = App.Network.all()
|
||||||
network_categories = App.NetworkCategory.all()
|
network_categories = App.NetworkCategory.all()
|
||||||
for network in networks
|
for network in networks
|
||||||
@log 'f', network for network in networks
|
@log 'notice', network for network in networks
|
||||||
|
|
||||||
for network_category in network_categories
|
for network_category in network_categories
|
||||||
@log 'fc', network_category
|
@log 'notice', network_category
|
||||||
|
|
||||||
@html App.view('network')(
|
@html App.view('network')(
|
||||||
networks: App.Network.all(),
|
networks: App.Network.all(),
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Index extends App.ControllerContent
|
||||||
@params.login = @params.email
|
@params.login = @params.email
|
||||||
|
|
||||||
@params.role_ids = [0]
|
@params.role_ids = [0]
|
||||||
@log 'updateAttributes', @params
|
@log 'notice', 'updateAttributes', @params
|
||||||
user = new App.User
|
user = new App.User
|
||||||
user.load(@params)
|
user.load(@params)
|
||||||
|
|
||||||
|
@ -96,4 +96,4 @@ class Index extends App.ControllerContent
|
||||||
msg: 'Wrong Username and Password combination.'
|
msg: 'Wrong Username and Password combination.'
|
||||||
removeAll: true
|
removeAll: true
|
||||||
|
|
||||||
App.Config.set( 'signup', Index, 'Routes' )
|
App.Config.set( 'signup', Index, 'Routes' )
|
||||||
|
|
|
@ -18,7 +18,7 @@ class App.TemplateUI extends App.Controller
|
||||||
|
|
||||||
reload: =>
|
reload: =>
|
||||||
App.Template.bind 'refresh', =>
|
App.Template.bind 'refresh', =>
|
||||||
@log 'loading....'
|
@log 'notice', 'loading...'
|
||||||
@render()
|
@render()
|
||||||
App.Template.unbind 'refresh'
|
App.Template.unbind 'refresh'
|
||||||
App.Collection.fetch( 'Template' )
|
App.Collection.fetch( 'Template' )
|
||||||
|
@ -85,7 +85,7 @@ class App.TemplateUI extends App.Controller
|
||||||
|
|
||||||
# show errors in form
|
# show errors in form
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
else
|
else
|
||||||
ui = @
|
ui = @
|
||||||
template.save(
|
template.save(
|
||||||
|
@ -94,5 +94,5 @@ class App.TemplateUI extends App.Controller
|
||||||
ui.render()
|
ui.render()
|
||||||
|
|
||||||
error: =>
|
error: =>
|
||||||
@log 'save failed!'
|
@log 'error', 'save failed!'
|
||||||
)
|
)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class App.TextModuleUIOld extends App.Controller
|
||||||
|
|
||||||
reload: =>
|
reload: =>
|
||||||
App.TextModule.bind 'refresh', =>
|
App.TextModule.bind 'refresh', =>
|
||||||
@log 'loading....'
|
@log 'notice', 'loading....'
|
||||||
@render()
|
@render()
|
||||||
App.TextModule.unbind 'refresh'
|
App.TextModule.unbind 'refresh'
|
||||||
App.Collection.fetch( 'TextModule' )
|
App.Collection.fetch( 'TextModule' )
|
||||||
|
@ -262,7 +262,7 @@ class App.TextModuleUIOld extends App.Controller
|
||||||
|
|
||||||
# show errors in form
|
# show errors in form
|
||||||
if errors
|
if errors
|
||||||
@log 'error new', errors
|
@log 'error', errors
|
||||||
else
|
else
|
||||||
ui = @
|
ui = @
|
||||||
text_module.save(
|
text_module.save(
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class App.TicketZoom extends App.Controller
|
class App.TicketZoom extends App.Controller
|
||||||
constructor: (params) ->
|
constructor: (params) ->
|
||||||
super
|
super
|
||||||
# console.log 'zoom', params
|
|
||||||
|
|
||||||
# check authentication
|
# check authentication
|
||||||
return if !@authenticate()
|
return if !@authenticate()
|
||||||
|
@ -20,7 +19,7 @@ class App.TicketZoom extends App.Controller
|
||||||
@load(cache)
|
@load(cache)
|
||||||
update = =>
|
update = =>
|
||||||
@fetch( @ticket_id, false )
|
@fetch( @ticket_id, false )
|
||||||
@interval( update, 120000, @key, 'ticket_zoom' )
|
@interval( update, 300000, @key, 'ticket_zoom' )
|
||||||
|
|
||||||
# fetch new data if triggered
|
# fetch new data if triggered
|
||||||
App.Event.bind(
|
App.Event.bind(
|
||||||
|
@ -29,7 +28,7 @@ class App.TicketZoom extends App.Controller
|
||||||
update = =>
|
update = =>
|
||||||
if data.id.toString() is @ticket_id.toString()
|
if data.id.toString() is @ticket_id.toString()
|
||||||
ticket = App.Collection.find( 'Ticket', @ticket_id )
|
ticket = App.Collection.find( 'Ticket', @ticket_id )
|
||||||
console.log('TRY', data.updated_at, ticket.updated_at)
|
@log 'notice', 'TRY', data.updated_at, ticket.updated_at
|
||||||
if data.updated_at isnt ticket.updated_at
|
if data.updated_at isnt ticket.updated_at
|
||||||
@fetch( @ticket_id, false )
|
@fetch( @ticket_id, false )
|
||||||
@delay( update, 2000, 'ticket-zoom-' + @ticket_id )
|
@delay( update, 2000, 'ticket-zoom-' + @ticket_id )
|
||||||
|
@ -69,7 +68,7 @@ class App.TicketZoom extends App.Controller
|
||||||
diff = difference( @autosaveLast, data )
|
diff = difference( @autosaveLast, data )
|
||||||
if !@autosaveLast || ( diff && !_.isEmpty( diff ) )
|
if !@autosaveLast || ( diff && !_.isEmpty( diff ) )
|
||||||
@autosaveLast = data
|
@autosaveLast = data
|
||||||
console.log('form hash changed', diff, data)
|
@log 'notice', 'form hash changed', diff, data
|
||||||
App.TaskManager.update( @task_key, { 'state': data })
|
App.TaskManager.update( @task_key, { 'state': data })
|
||||||
@interval( update, 10000, @id, @auto_save_key )
|
@interval( update, 10000, @id, @auto_save_key )
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ class App.TicketZoom extends App.Controller
|
||||||
|
|
||||||
# trigger task notify
|
# trigger task notify
|
||||||
diff = difference( @dataLastCall.ticket, data.ticket )
|
diff = difference( @dataLastCall.ticket, data.ticket )
|
||||||
console.log('diff', diff)
|
@log 'diff', diff
|
||||||
|
|
||||||
# notify if ticket changed not by my self
|
# notify if ticket changed not by my self
|
||||||
if !_.isEmpty(diff) && data.ticket.updated_by_id isnt @Session.all().id
|
if !_.isEmpty(diff) && data.ticket.updated_by_id isnt @Session.all().id
|
||||||
|
@ -425,7 +424,7 @@ class Edit extends App.Controller
|
||||||
|
|
||||||
ticket = App.Collection.find( 'Ticket', @ticket.id )
|
ticket = App.Collection.find( 'Ticket', @ticket.id )
|
||||||
|
|
||||||
@log 'TicketZoom', 'notice', 'update', params, ticket
|
@log 'notice', 'update', params, ticket
|
||||||
article_type = App.Collection.find( 'TicketArticleType', params['ticket_article_type_id'] )
|
article_type = App.Collection.find( 'TicketArticleType', params['ticket_article_type_id'] )
|
||||||
|
|
||||||
# update ticket
|
# update ticket
|
||||||
|
@ -463,14 +462,14 @@ class Edit extends App.Controller
|
||||||
return if !confirm( App.i18n.translateContent('You use attachment in text but no attachment is attached. Do you want to continue?') )
|
return if !confirm( App.i18n.translateContent('You use attachment in text but no attachment is attached. Do you want to continue?') )
|
||||||
|
|
||||||
ticket.load( ticket_update )
|
ticket.load( ticket_update )
|
||||||
@log 'TicketZoom', 'notice', 'update ticket', ticket_update, ticket
|
@log 'notice', 'update ticket', ticket_update, ticket
|
||||||
|
|
||||||
# disable form
|
# disable form
|
||||||
@formDisable(e)
|
@formDisable(e)
|
||||||
|
|
||||||
errors = ticket.validate()
|
errors = ticket.validate()
|
||||||
if errors
|
if errors
|
||||||
@log 'TicketZoom', 'error', 'update', errors
|
@log 'error', 'update', errors
|
||||||
@formEnable(e)
|
@formEnable(e)
|
||||||
|
|
||||||
ticket.save(
|
ticket.save(
|
||||||
|
@ -494,16 +493,16 @@ class Edit extends App.Controller
|
||||||
else
|
else
|
||||||
sender = App.Collection.findByAttribute( 'TicketArticleSender', 'name', 'Agent' )
|
sender = App.Collection.findByAttribute( 'TicketArticleSender', 'name', 'Agent' )
|
||||||
params.ticket_article_sender_id = sender.id
|
params.ticket_article_sender_id = sender.id
|
||||||
@log 'TicketZoom', 'notice', 'update article', params, sender
|
@log 'notice', 'update article', params, sender
|
||||||
article.load(params)
|
article.load(params)
|
||||||
errors = article.validate()
|
errors = article.validate()
|
||||||
if errors
|
if errors
|
||||||
@log 'TicketZoom', 'error', 'update article', errors
|
@log 'error', 'update article', errors
|
||||||
article.save(
|
article.save(
|
||||||
success: (r) =>
|
success: (r) =>
|
||||||
@ui.fetch( ticket.id, true )
|
@ui.fetch( ticket.id, true )
|
||||||
error: (r) =>
|
error: (r) =>
|
||||||
@log 'TicketZoom', 'error', 'update article', r
|
@log 'error', 'update article', r
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@ui.fetch( ticket.id, true )
|
@ui.fetch( ticket.id, true )
|
||||||
|
@ -634,7 +633,6 @@ class ArticleView extends App.Controller
|
||||||
|
|
||||||
else if article_type.name is 'email'
|
else if article_type.name is 'email'
|
||||||
@ui.el.find('[name="to"]').val(article.from)
|
@ui.el.find('[name="to"]').val(article.from)
|
||||||
# @log 'reply ', article, @el.find('[name="to"]')
|
|
||||||
|
|
||||||
# add quoted text if needed
|
# add quoted text if needed
|
||||||
selectedText = App.ClipBoard.getSelected()
|
selectedText = App.ClipBoard.getSelected()
|
||||||
|
@ -777,7 +775,6 @@ class TicketActionRow extends App.Controller
|
||||||
class TicketZoomRouter extends App.ControllerPermanent
|
class TicketZoomRouter extends App.ControllerPermanent
|
||||||
constructor: (params) ->
|
constructor: (params) ->
|
||||||
super
|
super
|
||||||
@log 'zoom router', params
|
|
||||||
|
|
||||||
# cleanup params
|
# cleanup params
|
||||||
clean_params =
|
clean_params =
|
||||||
|
|
|
@ -45,7 +45,7 @@ class App.UserInfo extends App.Controller
|
||||||
user = App.Collection.find( 'User', @user_id )
|
user = App.Collection.find( 'User', @user_id )
|
||||||
if user.note isnt note
|
if user.note isnt note
|
||||||
user.updateAttributes( note: note )
|
user.updateAttributes( note: note )
|
||||||
@log 'update', e, note, user
|
@log 'notice', 'update', e, note, user
|
||||||
|
|
||||||
edit: (e) =>
|
edit: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
|
@ -2,24 +2,24 @@ class App.Config
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@init: ->
|
@init: ->
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _configSingleton
|
||||||
|
|
||||||
@get: ( key, group ) ->
|
@get: ( key, group ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _configSingleton
|
||||||
_instance.get( key, group )
|
_instance.get( key, group )
|
||||||
|
|
||||||
@set: ( key, value, group ) ->
|
@set: ( key, value, group ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _configSingleton
|
||||||
_instance.set( key, value, group )
|
_instance.set( key, value, group )
|
||||||
|
|
||||||
@_all: ->
|
@_all: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _configSingleton
|
||||||
_instance._all()
|
_instance._all()
|
||||||
|
|
||||||
class _Singleton
|
class _configSingleton
|
||||||
constructor: ->
|
constructor: ->
|
||||||
@config = {}
|
@config = {}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,26 @@
|
||||||
class App.Log
|
class App.Log
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@log: ( module, level, args... ) ->
|
@log: ( level, args... ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _Singleton
|
||||||
|
module = @constructor.name
|
||||||
_instance.log( module, level, args )
|
_instance.log( module, level, args )
|
||||||
|
|
||||||
@debug: ( module, level, args... ) ->
|
@debug: ( module, args... ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _Singleton
|
||||||
_instance.log( module, level, args )
|
_instance.log( module, 'debug', args )
|
||||||
|
|
||||||
|
@notice: ( module, args... ) ->
|
||||||
|
if _instance == undefined
|
||||||
|
_instance ?= new _Singleton
|
||||||
|
_instance.log( module, 'notice', args )
|
||||||
|
|
||||||
|
@error: ( module, args... ) ->
|
||||||
|
if _instance == undefined
|
||||||
|
_instance ?= new _Singleton
|
||||||
|
_instance.log( module, 'error', args )
|
||||||
|
|
||||||
class _Singleton
|
class _Singleton
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
|
|
@ -2,25 +2,25 @@ class App.Session
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@init: ->
|
@init: ->
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _sessionSingleton
|
||||||
_instance.clear()
|
_instance.clear()
|
||||||
|
|
||||||
@get: ( key ) ->
|
@get: ( key ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _sessionSingleton
|
||||||
_instance.get( key )
|
_instance.get( key )
|
||||||
|
|
||||||
@set: ( key, value ) ->
|
@set: ( key, value ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _sessionSingleton
|
||||||
_instance.set( key, value )
|
_instance.set( key, value )
|
||||||
|
|
||||||
@all: ->
|
@all: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _sessionSingleton
|
||||||
_instance.all()
|
_instance.all()
|
||||||
|
|
||||||
class _Singleton extends Spine.Module
|
class _sessionSingleton extends Spine.Module
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -30,11 +30,11 @@ class _Singleton extends Spine.Module
|
||||||
@data = {}
|
@data = {}
|
||||||
|
|
||||||
get: ( key ) ->
|
get: ( key ) ->
|
||||||
@log 'Session', 'debug', key, @data[key]
|
@log 'debug', key, @data[key]
|
||||||
return @data[key]
|
return @data[key]
|
||||||
|
|
||||||
set: ( key, value ) ->
|
set: ( key, value ) ->
|
||||||
@log 'Session', 'debug', 'set', key, value
|
@log 'debug', 'set', key, value
|
||||||
@data[key] = value
|
@data[key] = value
|
||||||
|
|
||||||
all: ->
|
all: ->
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class App.Auth
|
class App.Auth
|
||||||
|
|
||||||
@login: (params) ->
|
@login: (params) ->
|
||||||
App.Log.log 'Auth', 'notice', 'login', params
|
App.Log.notice 'Auth', 'login', params
|
||||||
App.Com.ajax(
|
App.Com.ajax(
|
||||||
id: 'login',
|
id: 'login',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
@ -21,7 +21,7 @@ class App.Auth
|
||||||
)
|
)
|
||||||
|
|
||||||
@loginCheck: ->
|
@loginCheck: ->
|
||||||
App.Log.log 'Auth', 'notice', 'loginCheck'
|
App.Log.notice 'Auth', 'loginCheck'
|
||||||
App.Com.ajax(
|
App.Com.ajax(
|
||||||
id: 'login_check'
|
id: 'login_check'
|
||||||
async: false
|
async: false
|
||||||
|
@ -37,7 +37,7 @@ class App.Auth
|
||||||
)
|
)
|
||||||
|
|
||||||
@logout: ->
|
@logout: ->
|
||||||
App.Log.log 'Auth', 'notice', 'logout'
|
App.Log.notice 'Auth', 'logout'
|
||||||
App.Com.ajax(
|
App.Com.ajax(
|
||||||
id: 'logout'
|
id: 'logout'
|
||||||
type: 'DELETE'
|
type: 'DELETE'
|
||||||
|
@ -52,7 +52,7 @@ class App.Auth
|
||||||
)
|
)
|
||||||
|
|
||||||
@_login: (data) ->
|
@_login: (data) ->
|
||||||
App.Log.log 'Auth', 'notice', '_login:success', data
|
App.Log.notice 'Auth', '_login:success', data
|
||||||
|
|
||||||
# if session is not valid
|
# if session is not valid
|
||||||
if data.error
|
if data.error
|
||||||
|
@ -102,7 +102,7 @@ class App.Auth
|
||||||
|
|
||||||
|
|
||||||
@_logout: (data) ->
|
@_logout: (data) ->
|
||||||
App.Log.log 'Auth', 'notice', '_logout'
|
App.Log.notice 'Auth', '_logout'
|
||||||
|
|
||||||
# empty session
|
# empty session
|
||||||
App.Session.init()
|
App.Session.init()
|
||||||
|
@ -112,7 +112,7 @@ class App.Auth
|
||||||
App.Event.trigger( 'ui:rerender' )
|
App.Event.trigger( 'ui:rerender' )
|
||||||
|
|
||||||
@_loginError: (xhr, statusText, error) ->
|
@_loginError: (xhr, statusText, error) ->
|
||||||
App.Log.log 'Auth', 'notice', '_loginError:error'
|
App.Log.notice 'Auth', '_loginError:error'
|
||||||
|
|
||||||
# empty session
|
# empty session
|
||||||
App.Session.init()
|
App.Session.init()
|
||||||
|
|
|
@ -2,69 +2,69 @@ class App.Collection
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@init: ->
|
@init: ->
|
||||||
_instance = new _Singleton
|
_instance = new _collectionSingleton
|
||||||
|
|
||||||
@load: ( args ) ->
|
@load: ( args ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.load( args )
|
_instance.load( args )
|
||||||
|
|
||||||
@reset: ( args ) ->
|
@reset: ( args ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.reset( args )
|
_instance.reset( args )
|
||||||
|
|
||||||
@find: ( type, id, callback, force ) ->
|
@find: ( type, id, callback, force ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.find( type, id, callback, force )
|
_instance.find( type, id, callback, force )
|
||||||
|
|
||||||
@get: ( args ) ->
|
@get: ( args ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.get( args )
|
_instance.get( args )
|
||||||
|
|
||||||
@all: ( args ) ->
|
@all: ( args ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.all( args )
|
_instance.all( args )
|
||||||
|
|
||||||
@deleteAll: ( type ) ->
|
@deleteAll: ( type ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.deleteAll( type )
|
_instance.deleteAll( type )
|
||||||
|
|
||||||
@findByAttribute: ( type, key, value ) ->
|
@findByAttribute: ( type, key, value ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.findByAttribute( type, key, value )
|
_instance.findByAttribute( type, key, value )
|
||||||
|
|
||||||
@count: ( type ) ->
|
@count: ( type ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.count( type )
|
_instance.count( type )
|
||||||
|
|
||||||
@fetch: ( type ) ->
|
@fetch: ( type ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.fetch( type )
|
_instance.fetch( type )
|
||||||
|
|
||||||
@observe: (args) ->
|
@observe: (args) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.observe(args)
|
_instance.observe(args)
|
||||||
|
|
||||||
@observeUnbindLevel: (level) ->
|
@observeUnbindLevel: (level) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance.observeUnbindLevel(level)
|
_instance.observeUnbindLevel(level)
|
||||||
|
|
||||||
@_observeStats: ->
|
@_observeStats: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _collectionSingleton
|
||||||
_instance._observeStats()
|
_instance._observeStats()
|
||||||
|
|
||||||
class _Singleton extends Spine.Module
|
class _collectionSingleton extends Spine.Module
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
constructor: (@args) ->
|
constructor: (@args) ->
|
||||||
|
@ -76,7 +76,7 @@ class _Singleton extends Spine.Module
|
||||||
if data.collections
|
if data.collections
|
||||||
for type of data.collections
|
for type of data.collections
|
||||||
|
|
||||||
@log 'Collection', 'debug', 'loadCollection:trigger', type, data.collections[type]
|
@log 'debug', 'loadCollection:trigger', type, data.collections[type]
|
||||||
@load( localStorage: data.localStorage, type: type, data: data.collections[type] )
|
@load( localStorage: data.localStorage, type: type, data: data.collections[type] )
|
||||||
|
|
||||||
# add trigger - bind new events
|
# add trigger - bind new events
|
||||||
|
@ -86,7 +86,7 @@ class _Singleton extends Spine.Module
|
||||||
if data.collections
|
if data.collections
|
||||||
for type of data.collections
|
for type of data.collections
|
||||||
|
|
||||||
@log 'Collection', 'debug', 'resetCollection:trigger', type, data.collections[type]
|
@log 'debug', 'resetCollection:trigger', type, data.collections[type]
|
||||||
@reset( localStorage: data.localStorage, type: type, data: data.collections[type] )
|
@reset( localStorage: data.localStorage, type: type, data: data.collections[type] )
|
||||||
|
|
||||||
# find collections to load
|
# find collections to load
|
||||||
|
@ -99,14 +99,14 @@ class _Singleton extends Spine.Module
|
||||||
if parts[0] is 'collection'
|
if parts[0] is 'collection'
|
||||||
data = App.Store.get( key )
|
data = App.Store.get( key )
|
||||||
if data && data.localStorage
|
if data && data.localStorage
|
||||||
@log 'Collection', 'debug', 'load INIT', data
|
@log 'debug', 'load INIT', data
|
||||||
@load( data )
|
@load( data )
|
||||||
|
|
||||||
reset: (params) ->
|
reset: (params) ->
|
||||||
if !App[ params.type ]
|
if !App[ params.type ]
|
||||||
@log 'Collection', 'error', 'reset', 'no such collection', params
|
@log 'error', 'reset', 'no such collection', params
|
||||||
return
|
return
|
||||||
@log 'Collection', 'debug', 'reset', params
|
@log 'debug', 'reset', params
|
||||||
|
|
||||||
# empty in-memory
|
# empty in-memory
|
||||||
App[ params.type ].refresh( [], { clear: true } )
|
App[ params.type ].refresh( [], { clear: true } )
|
||||||
|
@ -122,7 +122,7 @@ class _Singleton extends Spine.Module
|
||||||
@load(params)
|
@load(params)
|
||||||
|
|
||||||
load: (params) ->
|
load: (params) ->
|
||||||
@log 'Collection', 'debug', 'load', params
|
@log 'debug', 'load', params
|
||||||
|
|
||||||
return if _.isEmpty( params.data )
|
return if _.isEmpty( params.data )
|
||||||
|
|
||||||
|
@ -160,9 +160,9 @@ class _Singleton extends Spine.Module
|
||||||
return data
|
return data
|
||||||
else
|
else
|
||||||
if force
|
if force
|
||||||
@log 'Collection', 'debug', 'find forced to load!', type, id
|
@log 'debug', 'find forced to load!', type, id
|
||||||
else
|
else
|
||||||
@log 'Collection', 'debug', 'find not loaded!', type, id
|
@log 'debug', 'find not loaded!', type, id
|
||||||
if callback
|
if callback
|
||||||
|
|
||||||
# execute callback if record got loaded
|
# execute callback if record got loaded
|
||||||
|
@ -180,7 +180,7 @@ class _Singleton extends Spine.Module
|
||||||
callback( data )
|
callback( data )
|
||||||
|
|
||||||
# fetch object
|
# fetch object
|
||||||
@log 'Collection', 'debug', 'loading..' + type + '..', id
|
@log 'debug', 'loading..' + type + '..', id
|
||||||
App[type].fetch( id: id )
|
App[type].fetch( id: id )
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
@ -265,15 +265,15 @@ class _Singleton extends Spine.Module
|
||||||
|
|
||||||
get: (params) ->
|
get: (params) ->
|
||||||
if !App[ params.type ]
|
if !App[ params.type ]
|
||||||
@log 'Collection', 'error', 'get', 'no such collection', params
|
@log 'error', 'get', 'no such collection', params
|
||||||
return
|
return
|
||||||
|
|
||||||
@log 'Collection', 'debug', 'get', params
|
@log 'debug', 'get', params
|
||||||
App[ params.type ].refresh( object, options: { clear: true } )
|
App[ params.type ].refresh( object, options: { clear: true } )
|
||||||
|
|
||||||
all: (params) ->
|
all: (params) ->
|
||||||
if !App[ params.type ]
|
if !App[ params.type ]
|
||||||
@log 'Collection', 'error', 'all', 'no such collection', params
|
@log 'error', 'all', 'no such collection', params
|
||||||
return
|
return
|
||||||
|
|
||||||
all = App[ params.type ].all()
|
all = App[ params.type ].all()
|
||||||
|
@ -301,23 +301,23 @@ class _Singleton extends Spine.Module
|
||||||
|
|
||||||
findByAttribute: ( type, key, value ) ->
|
findByAttribute: ( type, key, value ) ->
|
||||||
if !App[type]
|
if !App[type]
|
||||||
@log 'Collection', 'error', 'findByAttribute', 'no such collection', type, key, value
|
@log 'error', 'findByAttribute', 'no such collection', type, key, value
|
||||||
return
|
return
|
||||||
item = App[type].findByAttribute( key, value )
|
item = App[type].findByAttribute( key, value )
|
||||||
if !item
|
if !item
|
||||||
@log 'Collection', 'error', 'findByAttribute', 'no such item in collection', type, key, value
|
@log 'error', 'findByAttribute', 'no such item in collection', type, key, value
|
||||||
return
|
return
|
||||||
item
|
item
|
||||||
|
|
||||||
count: ( type ) ->
|
count: ( type ) ->
|
||||||
if !App[type]
|
if !App[type]
|
||||||
@log 'Collection', 'error', 'count', 'no such collection', type, key, value
|
@log 'error', 'count', 'no such collection', type, key, value
|
||||||
return
|
return
|
||||||
App[type].count()
|
App[type].count()
|
||||||
|
|
||||||
fetch: ( type ) ->
|
fetch: ( type ) ->
|
||||||
if !App[type]
|
if !App[type]
|
||||||
@log 'Collection', 'error', 'fetch', 'no such collection', type, key, value
|
@log 'error', 'fetch', 'no such collection', type, key, value
|
||||||
return
|
return
|
||||||
App[type].fetch()
|
App[type].fetch()
|
||||||
|
|
||||||
|
@ -394,4 +394,4 @@ class _Singleton extends Spine.Module
|
||||||
App[ observe.collection ].unbind( event, observe.callback )
|
App[ observe.collection ].unbind( event, observe.callback )
|
||||||
|
|
||||||
_observeStats: ->
|
_observeStats: ->
|
||||||
@observeCurrent
|
@observeCurrent
|
||||||
|
|
|
@ -3,30 +3,30 @@ class App.Delay
|
||||||
|
|
||||||
@set: ( callback, timeout, key, level ) ->
|
@set: ( callback, timeout, key, level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _delaySingleton
|
||||||
_instance.set( callback, timeout, key, level )
|
_instance.set( callback, timeout, key, level )
|
||||||
|
|
||||||
@clear: ( key, level ) ->
|
@clear: ( key, level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _delaySingleton
|
||||||
_instance.clear( key, level )
|
_instance.clear( key, level )
|
||||||
|
|
||||||
@clearLevel: ( level ) ->
|
@clearLevel: ( level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _delaySingleton
|
||||||
_instance.clearLevel( level )
|
_instance.clearLevel( level )
|
||||||
|
|
||||||
@reset: ( level ) ->
|
@reset: ( level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _delaySingleton
|
||||||
_instance.reset( level )
|
_instance.reset( level )
|
||||||
|
|
||||||
@_all: ->
|
@_all: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _delaySingleton
|
||||||
_instance._all()
|
_instance._all()
|
||||||
|
|
||||||
class _Singleton extends Spine.Module
|
class _delaySingleton extends Spine.Module
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -47,9 +47,9 @@ class _Singleton extends Spine.Module
|
||||||
key = Math.floor( Math.random() * 99999 )
|
key = Math.floor( Math.random() * 99999 )
|
||||||
|
|
||||||
# setTimeout
|
# setTimeout
|
||||||
@log 'Delay', 'debug', 'set', key, timeout, level, callback
|
@log 'debug', 'set', key, timeout, level, callback
|
||||||
call = =>
|
call = =>
|
||||||
@clear( key )
|
@clear( key )
|
||||||
callback()
|
callback()
|
||||||
delay_id = setTimeout( call, timeout )
|
delay_id = setTimeout( call, timeout )
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class _Singleton extends Spine.Module
|
||||||
data = @levelStack[ level ][ key.toString() ]
|
data = @levelStack[ level ][ key.toString() ]
|
||||||
return if !data
|
return if !data
|
||||||
|
|
||||||
@log 'Delay', 'debug', 'clear', data
|
@log 'debug', 'clear', data
|
||||||
clearTimeout( data['delay_id'] )
|
clearTimeout( data['delay_id'] )
|
||||||
|
|
||||||
clearLevel: (level) ->
|
clearLevel: (level) ->
|
||||||
|
|
|
@ -2,34 +2,34 @@ class App.Event
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@init: ->
|
@init: ->
|
||||||
_instance = new _Singleton
|
_instance = new _eventSingleton
|
||||||
|
|
||||||
@bind: ( events, callback, level ) ->
|
@bind: ( events, callback, level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _eventSingleton
|
||||||
_instance.bind( events, callback, level )
|
_instance.bind( events, callback, level )
|
||||||
|
|
||||||
@unbind: ( events, callback, level ) ->
|
@unbind: ( events, callback, level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _eventSingleton
|
||||||
_instance.unbind( events, callback, level )
|
_instance.unbind( events, callback, level )
|
||||||
|
|
||||||
@trigger: ( events, data ) ->
|
@trigger: ( events, data ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _eventSingleton
|
||||||
_instance.trigger( events, data )
|
_instance.trigger( events, data )
|
||||||
|
|
||||||
@unbindLevel: (level) ->
|
@unbindLevel: (level) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _eventSingleton
|
||||||
_instance.unbindLevel(level)
|
_instance.unbindLevel(level)
|
||||||
|
|
||||||
@_allBindings: ->
|
@_allBindings: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _eventSingleton
|
||||||
_instance._allBindings()
|
_instance._allBindings()
|
||||||
|
|
||||||
class _Singleton extends Spine.Module
|
class _eventSingleton extends Spine.Module
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -60,7 +60,7 @@ class _Singleton extends Spine.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
# bind
|
# bind
|
||||||
@log 'Event', 'debug', 'bind', event, callback
|
@log 'debug', 'bind', event, callback
|
||||||
Spine.bind( event, callback )
|
Spine.bind( event, callback )
|
||||||
|
|
||||||
unbind: ( events, callback, level ) ->
|
unbind: ( events, callback, level ) ->
|
||||||
|
@ -81,14 +81,14 @@ class _Singleton extends Spine.Module
|
||||||
else
|
else
|
||||||
return item if item.event isnt event
|
return item if item.event isnt event
|
||||||
)
|
)
|
||||||
@log 'Event', 'debug', 'unbind', event, callback
|
@log 'debug', 'unbind', event, callback
|
||||||
Spine.unbind( event, callback )
|
Spine.unbind( event, callback )
|
||||||
|
|
||||||
trigger: ( events, data ) ->
|
trigger: ( events, data ) ->
|
||||||
eventList = events.split(' ')
|
eventList = events.split(' ')
|
||||||
for event in eventList
|
for event in eventList
|
||||||
@log 'Event', 'debug', 'trigger', event, data
|
@log 'debug', 'trigger', event, data
|
||||||
Spine.trigger event, data
|
Spine.trigger event, data
|
||||||
|
|
||||||
_allBindings: ->
|
_allBindings: ->
|
||||||
@eventCurrent
|
@eventCurrent
|
||||||
|
|
|
@ -2,44 +2,44 @@ class App.i18n
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@init: ( args ) ->
|
@init: ( args ) ->
|
||||||
_instance ?= new _Singleton( args )
|
_instance ?= new _i18nSingleton( args )
|
||||||
|
|
||||||
@translateContent: ( string, args... ) ->
|
@translateContent: ( string, args... ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _i18nSingleton
|
||||||
_instance.translateContent( string, args )
|
_instance.translateContent( string, args )
|
||||||
|
|
||||||
@translatePlain: ( string, args... ) ->
|
@translatePlain: ( string, args... ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _i18nSingleton
|
||||||
_instance.translatePlain( string, args )
|
_instance.translatePlain( string, args )
|
||||||
|
|
||||||
@translateInline: ( string, args... ) ->
|
@translateInline: ( string, args... ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _i18nSingleton
|
||||||
_instance.translateInline( string, args )
|
_instance.translateInline( string, args )
|
||||||
|
|
||||||
@translateTimestamp: ( args ) ->
|
@translateTimestamp: ( args ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _i18nSingleton
|
||||||
_instance.timestamp( args )
|
_instance.timestamp( args )
|
||||||
|
|
||||||
@get: ->
|
@get: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _i18nSingleton
|
||||||
_instance.get()
|
_instance.get()
|
||||||
|
|
||||||
@set: ( args ) ->
|
@set: ( args ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton( args )
|
_instance ?= new _i18nSingleton( args )
|
||||||
_instance.set( args )
|
_instance.set( args )
|
||||||
|
|
||||||
@escape: ( args ) ->
|
@escape: ( args ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton( args )
|
_instance ?= new _i18nSingleton( args )
|
||||||
_instance.escape( args )
|
_instance.escape( args )
|
||||||
|
|
||||||
class _Singleton extends Spine.Module
|
class _i18nSingleton extends Spine.Module
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
constructor: ( locale ) ->
|
constructor: ( locale ) ->
|
||||||
|
@ -67,7 +67,7 @@ class _Singleton extends Spine.Module
|
||||||
|
|
||||||
# update translation
|
# update translation
|
||||||
return if $this.data('before') is translation_new
|
return if $this.data('before') is translation_new
|
||||||
@log 'i18n', 'debug', 'translate Update', translation_new, $this.data, 'before'
|
@log 'debug', 'translate Update', translation_new, $this.data, 'before'
|
||||||
$this.data 'before', translation_new
|
$this.data 'before', translation_new
|
||||||
|
|
||||||
# update runtime translation map
|
# update runtime translation map
|
||||||
|
@ -155,7 +155,7 @@ class _Singleton extends Spine.Module
|
||||||
for arg in args
|
for arg in args
|
||||||
translated = translated.replace(/%s/, arg)
|
translated = translated.replace(/%s/, arg)
|
||||||
|
|
||||||
@log 'i18n', 'debug', 'translate', string, args, translated
|
@log 'debug', 'translate', string, args, translated
|
||||||
|
|
||||||
# return translated string
|
# return translated string
|
||||||
return translated
|
return translated
|
||||||
|
|
|
@ -57,7 +57,7 @@ class App.Content extends App.Controller
|
||||||
do (route, callback) =>
|
do (route, callback) =>
|
||||||
@route(route, (params) ->
|
@route(route, (params) ->
|
||||||
|
|
||||||
@log 'Content', 'notice', 'execute page controller', route, params
|
@log 'notice', 'execute page controller', route, params
|
||||||
|
|
||||||
# remove observers for page
|
# remove observers for page
|
||||||
App.Collection.observeUnbindLevel('page')
|
App.Collection.observeUnbindLevel('page')
|
||||||
|
|
|
@ -3,30 +3,30 @@ class App.Interval
|
||||||
|
|
||||||
@set: ( callback, timeout, key, level ) ->
|
@set: ( callback, timeout, key, level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _intervalSingleton
|
||||||
_instance.set( callback, timeout, key, level )
|
_instance.set( callback, timeout, key, level )
|
||||||
|
|
||||||
@clear: ( key, level ) ->
|
@clear: ( key, level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _intervalSingleton
|
||||||
_instance.clear( key, level )
|
_instance.clear( key, level )
|
||||||
|
|
||||||
@clearLevel: ( level ) ->
|
@clearLevel: ( level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _intervalSingleton
|
||||||
_instance.clearLevel( level )
|
_instance.clearLevel( level )
|
||||||
|
|
||||||
@reset: ( level ) ->
|
@reset: ( level ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _intervalSingleton
|
||||||
_instance.reset( level )
|
_instance.reset( level )
|
||||||
|
|
||||||
@_all: ->
|
@_all: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _intervalSingleton
|
||||||
_instance._all()
|
_instance._all()
|
||||||
|
|
||||||
class _Singleton extends Spine.Module
|
class _intervalSingleton extends Spine.Module
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
@ -47,7 +47,7 @@ class _Singleton extends Spine.Module
|
||||||
key = Math.floor( Math.random() * 99999 )
|
key = Math.floor( Math.random() * 99999 )
|
||||||
|
|
||||||
# setTimeout
|
# setTimeout
|
||||||
@log 'Interval', 'debug', 'set', key, timeout, level, callback
|
@log 'debug', 'set', key, timeout, level, callback
|
||||||
callback()
|
callback()
|
||||||
interval_id = setInterval( callback, timeout )
|
interval_id = setInterval( callback, timeout )
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class _Singleton extends Spine.Module
|
||||||
data = @levelStack[ level ][ key.toString() ]
|
data = @levelStack[ level ][ key.toString() ]
|
||||||
return if !data
|
return if !data
|
||||||
|
|
||||||
@log 'Interval', 'debug', 'clear', data
|
@log 'debug', 'clear', data
|
||||||
clearInterval( data['interval_id'] )
|
clearInterval( data['interval_id'] )
|
||||||
|
|
||||||
clearLevel: (level) ->
|
clearLevel: (level) ->
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
class App.Store
|
class App.Store
|
||||||
_instance = undefined # Must be declared here to force the closure on the class
|
_instance = undefined # Must be declared here to force the closure on the class
|
||||||
@renew: ->
|
@renew: ->
|
||||||
_instance = new _Singleton
|
_instance = new _storeSingleton
|
||||||
|
|
||||||
@write: (key, value) ->
|
@write: (key, value) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _storeSingleton
|
||||||
_instance.write(key, value)
|
_instance.write(key, value)
|
||||||
|
|
||||||
@get: (args) ->
|
@get: (args) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _storeSingleton
|
||||||
_instance.get(args)
|
_instance.get(args)
|
||||||
|
|
||||||
@delete: (args) ->
|
@delete: (args) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _storeSingleton
|
||||||
_instance.delete(args)
|
_instance.delete(args)
|
||||||
|
|
||||||
@clear: ->
|
@clear: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _storeSingleton
|
||||||
_instance.clear()
|
_instance.clear()
|
||||||
|
|
||||||
@list: () ->
|
@list: () ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _storeSingleton
|
||||||
_instance.list()
|
_instance.list()
|
||||||
|
|
||||||
# The actual Singleton class
|
# The actual Singleton class
|
||||||
class _Singleton
|
class _storeSingleton
|
||||||
store: {}
|
store: {}
|
||||||
constructor: ->
|
constructor: ->
|
||||||
@support = true
|
@support = true
|
||||||
|
@ -51,7 +51,7 @@ class _Singleton
|
||||||
catch e
|
catch e
|
||||||
if e is QUOTA_EXCEEDED_ERR
|
if e is QUOTA_EXCEEDED_ERR
|
||||||
# do something nice to notify your users
|
# do something nice to notify your users
|
||||||
App.Log.log 'App.Store', 'error', 'Local storage quote exceeded, please relogin!'
|
App.Log.error 'App.Store', 'Local storage quote exceeded, please relogin!'
|
||||||
|
|
||||||
# get item
|
# get item
|
||||||
get: (key) ->
|
get: (key) ->
|
||||||
|
|
|
@ -2,64 +2,64 @@ class App.TaskManager
|
||||||
_instance = undefined
|
_instance = undefined
|
||||||
|
|
||||||
@init: ->
|
@init: ->
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
|
|
||||||
@all: ->
|
@all: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.all()
|
_instance.all()
|
||||||
|
|
||||||
@add: ( key, callback, params, to_not_show, state ) ->
|
@add: ( key, callback, params, to_not_show, state ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.add( key, callback, params, to_not_show, state )
|
_instance.add( key, callback, params, to_not_show, state )
|
||||||
|
|
||||||
@get: ( key ) ->
|
@get: ( key ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.get( key )
|
_instance.get( key )
|
||||||
|
|
||||||
@update: ( key, params ) ->
|
@update: ( key, params ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.update( key, params )
|
_instance.update( key, params )
|
||||||
|
|
||||||
@remove: ( key ) ->
|
@remove: ( key ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.remove( key )
|
_instance.remove( key )
|
||||||
|
|
||||||
@notify: ( key ) ->
|
@notify: ( key ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.notify( key )
|
_instance.notify( key )
|
||||||
|
|
||||||
@reorder: ( order ) ->
|
@reorder: ( order ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.reorder( order )
|
_instance.reorder( order )
|
||||||
|
|
||||||
@reset: ->
|
@reset: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.reset()
|
_instance.reset()
|
||||||
|
|
||||||
@worker: ( key ) ->
|
@worker: ( key ) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.worker( key )
|
_instance.worker( key )
|
||||||
|
|
||||||
@workerAll: ->
|
@workerAll: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.workerAll()
|
_instance.workerAll()
|
||||||
|
|
||||||
@TaskbarId: ->
|
@TaskbarId: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _taskManagerSingleton
|
||||||
_instance.TaskbarId()
|
_instance.TaskbarId()
|
||||||
|
|
||||||
class _Singleton extends App.Controller
|
class _taskManagerSingleton extends App.Controller
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
|
|
|
@ -2,36 +2,36 @@ class App.WebSocket
|
||||||
_instance = undefined # Must be declared here to force the closure on the class
|
_instance = undefined # Must be declared here to force the closure on the class
|
||||||
@connect: (args) -> # Must be a static method
|
@connect: (args) -> # Must be a static method
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _webSocketSingleton
|
||||||
_instance
|
_instance
|
||||||
|
|
||||||
@close: (args) ->
|
@close: (args) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _webSocketSingleton
|
||||||
_instance.close(args)
|
_instance.close(args)
|
||||||
|
|
||||||
@send: (args) ->
|
@send: (args) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _webSocketSingleton
|
||||||
_instance.send(args)
|
_instance.send(args)
|
||||||
|
|
||||||
@auth: (args) ->
|
@auth: (args) ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _webSocketSingleton
|
||||||
_instance.auth(args)
|
_instance.auth(args)
|
||||||
|
|
||||||
@channel: ->
|
@channel: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _webSocketSingleton
|
||||||
_instance.channel()
|
_instance.channel()
|
||||||
|
|
||||||
@_spool: ->
|
@_spool: ->
|
||||||
if _instance == undefined
|
if _instance == undefined
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _webSocketSingleton
|
||||||
_instance.spool()
|
_instance.spool()
|
||||||
|
|
||||||
# The actual Singleton class
|
# The actual Singleton class
|
||||||
class _Singleton extends App.Controller
|
class _webSocketSingleton extends App.Controller
|
||||||
@include App.Log
|
@include App.Log
|
||||||
|
|
||||||
queue: []
|
queue: []
|
||||||
|
@ -44,6 +44,7 @@ class _Singleton extends App.Controller
|
||||||
tryToConnect: false
|
tryToConnect: false
|
||||||
backend: 'websocket'
|
backend: 'websocket'
|
||||||
client_id: undefined
|
client_id: undefined
|
||||||
|
error: false
|
||||||
|
|
||||||
constructor: (@args) ->
|
constructor: (@args) ->
|
||||||
super
|
super
|
||||||
|
@ -84,8 +85,6 @@ class _Singleton extends App.Controller
|
||||||
@_ajaxSend(data)
|
@_ajaxSend(data)
|
||||||
else
|
else
|
||||||
|
|
||||||
# console.log 'ws:send trying', data, @ws, @ws.readyState
|
|
||||||
|
|
||||||
# A value of 0 indicates that the connection has not yet been established.
|
# A value of 0 indicates that the connection has not yet been established.
|
||||||
# A value of 1 indicates that the connection is established and communication is possible.
|
# A value of 1 indicates that the connection is established and communication is possible.
|
||||||
# A value of 2 indicates that the connection is going through the closing handshake.
|
# A value of 2 indicates that the connection is going through the closing handshake.
|
||||||
|
@ -115,7 +114,7 @@ class _Singleton extends App.Controller
|
||||||
if @lastSpoolMessage
|
if @lastSpoolMessage
|
||||||
data['timestamp'] = @lastSpoolMessage
|
data['timestamp'] = @lastSpoolMessage
|
||||||
|
|
||||||
@log 'Websocket', 'debug', 'spool', data
|
@log 'debug', 'spool', data
|
||||||
|
|
||||||
# reset @sentSpoolFinished if spool:sent will not return
|
# reset @sentSpoolFinished if spool:sent will not return
|
||||||
reset = =>
|
reset = =>
|
||||||
|
@ -139,20 +138,20 @@ class _Singleton extends App.Controller
|
||||||
ping: =>
|
ping: =>
|
||||||
return if @backend is 'ajax'
|
return if @backend is 'ajax'
|
||||||
|
|
||||||
@log 'Websocket', 'debug', 'send websockend ping'
|
@log 'debug', 'send websockend ping'
|
||||||
@send( { action: 'ping' } )
|
@send( { action: 'ping' } )
|
||||||
|
|
||||||
# check if ping is back within 2 min
|
# check if ping is back within 2 min
|
||||||
@clearDelay('websocket-ping-check', 'ws')
|
@clearDelay('websocket-ping-check', 'ws')
|
||||||
check = =>
|
check = =>
|
||||||
@log 'Websocket', 'notice', 'no websockend ping response, reconnect...'
|
@log 'notice', 'no websockend ping response, reconnect...'
|
||||||
@close()
|
@close()
|
||||||
@delay check, 90000, 'websocket-ping-check', 'ws'
|
@delay check, 90000, 'websocket-ping-check', 'ws'
|
||||||
|
|
||||||
pong: ->
|
pong: ->
|
||||||
return if @backend is 'ajax'
|
return if @backend is 'ajax'
|
||||||
|
|
||||||
@log 'Websocket', 'debug', 'received websockend ping'
|
@log 'debug', 'received websockend ping'
|
||||||
|
|
||||||
# test again after 1 min
|
# test again after 1 min
|
||||||
@delay @ping, 60000, 'websocket-pong', 'ws'
|
@delay @ping, 60000, 'websocket-pong', 'ws'
|
||||||
|
@ -162,7 +161,7 @@ class _Singleton extends App.Controller
|
||||||
|
|
||||||
if !window.WebSocket
|
if !window.WebSocket
|
||||||
@backend = 'ajax'
|
@backend = 'ajax'
|
||||||
@log 'WebSocket', 'notice', 'no support of websocket, use ajax long polling'
|
@log 'notice', 'no support of websocket, use ajax long polling'
|
||||||
@_ajaxInit()
|
@_ajaxInit()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -174,7 +173,7 @@ class _Singleton extends App.Controller
|
||||||
|
|
||||||
# Set event handlers.
|
# Set event handlers.
|
||||||
@ws.onopen = =>
|
@ws.onopen = =>
|
||||||
@log 'Websocket', 'notice', 'new websocket connection open'
|
@log 'notice', 'new websocket connection open'
|
||||||
|
|
||||||
@connectionEstablished = true
|
@connectionEstablished = true
|
||||||
@connectionWasEstablished = true
|
@connectionWasEstablished = true
|
||||||
|
@ -190,7 +189,7 @@ class _Singleton extends App.Controller
|
||||||
|
|
||||||
# empty queue
|
# empty queue
|
||||||
for item in @queue
|
for item in @queue
|
||||||
@log 'Websocket', 'debug', 'empty ws queue', item
|
@log 'debug', 'empty ws queue', item
|
||||||
@send(item)
|
@send(item)
|
||||||
@queue = []
|
@queue = []
|
||||||
|
|
||||||
|
@ -199,11 +198,11 @@ class _Singleton extends App.Controller
|
||||||
|
|
||||||
@ws.onmessage = (e) =>
|
@ws.onmessage = (e) =>
|
||||||
pipe = JSON.parse( e.data )
|
pipe = JSON.parse( e.data )
|
||||||
@log 'Websocket', 'debug', 'ws:onmessage', pipe
|
@log 'debug', 'ws:onmessage', pipe
|
||||||
@_receiveMessage(pipe)
|
@_receiveMessage(pipe)
|
||||||
|
|
||||||
@ws.onclose = (e) =>
|
@ws.onclose = (e) =>
|
||||||
@log 'Websocket', 'notice', 'close websocket connection'
|
@log 'notice', 'close websocket connection'
|
||||||
|
|
||||||
# take connection down and keep it down
|
# take connection down and keep it down
|
||||||
return if @connectionKeepDown
|
return if @connectionKeepDown
|
||||||
|
@ -222,7 +221,7 @@ class _Singleton extends App.Controller
|
||||||
# use fallback if no connection was possible
|
# use fallback if no connection was possible
|
||||||
if !@connectionWasEstablished
|
if !@connectionWasEstablished
|
||||||
@backend = 'ajax'
|
@backend = 'ajax'
|
||||||
@log 'WebSocket', 'notice', 'No connection to websocket, use ajax long polling as fallback'
|
@log 'notice', 'No connection to websocket, use ajax long polling as fallback'
|
||||||
@_ajaxInit()
|
@_ajaxInit()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -242,7 +241,7 @@ class _Singleton extends App.Controller
|
||||||
@delay @connect, 4500, 'websocket-try-reconnect-after-x-sec', 'ws'
|
@delay @connect, 4500, 'websocket-try-reconnect-after-x-sec', 'ws'
|
||||||
|
|
||||||
@ws.onerror = (e) =>
|
@ws.onerror = (e) =>
|
||||||
@log 'Websocket', 'debug', "ws:onerror", e
|
@log 'debug', "ws:onerror", e
|
||||||
|
|
||||||
_receiveMessage: (data = []) =>
|
_receiveMessage: (data = []) =>
|
||||||
|
|
||||||
|
@ -255,17 +254,17 @@ class _Singleton extends App.Controller
|
||||||
|
|
||||||
# fill collection
|
# fill collection
|
||||||
if item['collection']
|
if item['collection']
|
||||||
@log 'Websocket', 'debug', "onmessage collection:" + item['collection']
|
@log 'debug', "onmessage collection:" + item['collection']
|
||||||
App.Store.write( item['collection'], item['data'] )
|
App.Store.write( item['collection'], item['data'] )
|
||||||
|
|
||||||
# fire event
|
# fire event
|
||||||
if item['event']
|
if item['event']
|
||||||
if typeof item['event'] is 'object'
|
if typeof item['event'] is 'object'
|
||||||
for event in item['event']
|
for event in item['event']
|
||||||
@log 'Websocket', 'debug', "onmessage event:" + event
|
@log 'debug', "onmessage event:" + event
|
||||||
App.Event.trigger( event, item['data'] )
|
App.Event.trigger( event, item['data'] )
|
||||||
else
|
else
|
||||||
@log 'Websocket', 'debug', "onmessage event:" + item['event']
|
@log 'debug', "onmessage event:" + item['event']
|
||||||
App.Event.trigger( item['event'], item['data'] )
|
App.Event.trigger( item['event'], item['data'] )
|
||||||
|
|
||||||
_ajaxInit: (data = {}) =>
|
_ajaxInit: (data = {}) =>
|
||||||
|
@ -285,7 +284,7 @@ class _Singleton extends App.Controller
|
||||||
queue: false
|
queue: false
|
||||||
success: (data) =>
|
success: (data) =>
|
||||||
if data.client_id
|
if data.client_id
|
||||||
@log 'Websocket', 'notice', 'ajax:new client_id', data.client_id
|
@log 'notice', 'ajax:new client_id', data.client_id
|
||||||
@client_id = data.client_id
|
@client_id = data.client_id
|
||||||
@_ajaxReceive()
|
@_ajaxReceive()
|
||||||
@_ajaxSendQueue()
|
@_ajaxSendQueue()
|
||||||
|
@ -302,7 +301,7 @@ class _Singleton extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
_ajaxSend: (data) =>
|
_ajaxSend: (data) =>
|
||||||
@log 'Websocket', 'debug', 'ajax:sendmessage', data
|
@log 'debug', 'ajax:sendmessage', data
|
||||||
if !@client_id || @client_id is undefined || !@_ajaxInitDone
|
if !@client_id || @client_id is undefined || !@_ajaxInitDone
|
||||||
@_ajaxInit()
|
@_ajaxInit()
|
||||||
@queue.push data
|
@queue.push data
|
||||||
|
@ -339,7 +338,7 @@ class _Singleton extends App.Controller
|
||||||
data: JSON.stringify({ client_id: @client_id })
|
data: JSON.stringify({ client_id: @client_id })
|
||||||
processData: false
|
processData: false
|
||||||
success: (data) =>
|
success: (data) =>
|
||||||
@log 'Websocket', 'notice', 'ajax:onmessage', data
|
@log 'notice', 'ajax:onmessage', data
|
||||||
@_receiveMessage(data)
|
@_receiveMessage(data)
|
||||||
if data && data.error
|
if data && data.error
|
||||||
@client_id = undefined
|
@client_id = undefined
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2013-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'cache'
|
require 'cache'
|
||||||
require 'user_info'
|
require 'user_info'
|
||||||
|
@ -15,12 +15,12 @@ class ApplicationModel < ActiveRecord::Base
|
||||||
|
|
||||||
@@import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::Priority', 'Group', 'User' ]
|
@@import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::Priority', 'Group', 'User' ]
|
||||||
|
|
||||||
# for import other objects, remove 'id'
|
# for import of other objects, remove 'id'
|
||||||
def self.attributes_protected_by_default
|
def self.attributes_protected_by_default
|
||||||
if Setting.get('import_mode') && @@import_class_list.include?( self.name.to_s )
|
if Setting.get('import_mode') && @@import_class_list.include?( self.name.to_s )
|
||||||
['type']
|
['type']
|
||||||
else
|
else
|
||||||
['id','type']
|
['id','type', 'created_at', 'updated_at']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue