Rewrite for form generation. Added REST docu. Moved api to /api/*.
This commit is contained in:
parent
fb214adc6f
commit
ee726eb591
91 changed files with 2670 additions and 1379 deletions
|
@ -20,6 +20,12 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
@delay( a, 0 )
|
||||
|
||||
reBind: (name, callback) =>
|
||||
Spine.one name, (data) =>
|
||||
@log 'rebind', name, data
|
||||
callback(data)
|
||||
@reBind(name, callback)
|
||||
|
||||
isRole: (name) ->
|
||||
return false if !window.Session.roles
|
||||
for role in window.Session.roles
|
||||
|
@ -292,7 +298,7 @@ class App.Controller extends Spine.Controller
|
|||
tickets = {}
|
||||
App.Com.ajax(
|
||||
type: 'GET',
|
||||
url: '/ticket_customer',
|
||||
url: '/api/ticket_customer',
|
||||
data: {
|
||||
customer_id: data.user_id,
|
||||
}
|
||||
|
@ -329,6 +335,20 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
loadCollection: (params) ->
|
||||
|
||||
# remember in store if not already requested
|
||||
if !params.localStorage
|
||||
if params.type == 'User'
|
||||
for user_id, user of params.data
|
||||
data = {}
|
||||
data[params.type] = {}
|
||||
data[params.type][ user_id ] = user
|
||||
App.Store.write( 'collection::' + params.type + '::' + user_id, { type: params.type, localStorage: true, collections: data } )
|
||||
else
|
||||
for object in params.data
|
||||
data = {}
|
||||
data[params.type] = [ object ]
|
||||
App.Store.write( 'collection::' + params.type + '::' + object.id, { type: params.type, localStorage: true, collections: data } )
|
||||
|
||||
# users
|
||||
if params.type == 'User'
|
||||
for user_id, user of params.data
|
||||
|
@ -344,7 +364,7 @@ class App.Controller extends Spine.Controller
|
|||
# set image url
|
||||
if user && !user['image']
|
||||
user['image'] = 'http://placehold.it/48x48'
|
||||
|
||||
|
||||
# set realname
|
||||
user['realname'] = ''
|
||||
if user['firstname']
|
||||
|
@ -367,18 +387,18 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
# priority
|
||||
ticket.ticket_priority = App.TicketPriority.find(ticket.ticket_priority_id)
|
||||
|
||||
|
||||
# state
|
||||
ticket.ticket_state = App.TicketState.find(ticket.ticket_state_id)
|
||||
|
||||
|
||||
# group
|
||||
ticket.group = App.Group.find(ticket.group_id)
|
||||
|
||||
|
||||
# customer
|
||||
if ticket.customer_id and App.User.exists(ticket.customer_id)
|
||||
user = App.User.find(ticket.customer_id)
|
||||
ticket.customer = user
|
||||
|
||||
|
||||
# owner
|
||||
if ticket.owner_id and App.User.exists(ticket.owner_id)
|
||||
user = App.User.find(ticket.owner_id)
|
||||
|
@ -391,13 +411,13 @@ class App.Controller extends Spine.Controller
|
|||
# articles
|
||||
else if params.type == 'TicketArticle'
|
||||
for article in params.data
|
||||
|
||||
|
||||
# add user
|
||||
article.created_by = App.User.find(article.created_by_id)
|
||||
|
||||
|
||||
# set human time
|
||||
article.humanTime = @humanTime(article.created_at)
|
||||
|
||||
|
||||
# add possible actions
|
||||
article.article_type = App.TicketArticleType.find( article.ticket_article_type_id )
|
||||
article.article_sender = App.TicketArticleSender.find( article.ticket_article_sender_id )
|
||||
|
@ -409,13 +429,13 @@ class App.Controller extends Spine.Controller
|
|||
# history
|
||||
else if params.type == 'History'
|
||||
for histroy in params.data
|
||||
|
||||
|
||||
# add user
|
||||
histroy.created_by = App.User.find(histroy.created_by_id)
|
||||
|
||||
|
||||
# set human time
|
||||
histroy.humanTime = @humanTime(histroy.created_at)
|
||||
|
||||
|
||||
# add possible actions
|
||||
if histroy.history_attribute_id
|
||||
histroy.attribute = App.HistoryAttribute.find( histroy.history_attribute_id )
|
||||
|
|
|
@ -204,11 +204,11 @@ class App.ControllerForm extends App.Controller
|
|||
@callback( params )
|
||||
###
|
||||
$(@local_attribute_full).tagsInput(
|
||||
autocomplete_url: '/user_search',
|
||||
autocomplete_url: '/users/search',
|
||||
height: '30px',
|
||||
width: '530px',
|
||||
auto: {
|
||||
source: '/user_search',
|
||||
source: '/users/search',
|
||||
minLength: 2,
|
||||
select: ( event, ui ) =>
|
||||
@log 'selected', event, ui
|
||||
|
@ -218,7 +218,7 @@ class App.ControllerForm extends App.Controller
|
|||
###
|
||||
@log '111111', @local_attribute_full, item
|
||||
$(@local_attribute_full).autocomplete(
|
||||
source: '/user_search',
|
||||
source: '/api/users/search',
|
||||
minLength: 2,
|
||||
select: ( event, ui ) =>
|
||||
@log 'selected', event, ui
|
||||
|
@ -312,7 +312,7 @@ class App.ControllerForm extends App.Controller
|
|||
|
||||
options_by_name = []
|
||||
for i in attribute.options
|
||||
options_by_name.push i['name'].toLowerCase()
|
||||
options_by_name.push i['name'].toString().toLowerCase()
|
||||
options_by_name = options_by_name.sort()
|
||||
|
||||
options_new = []
|
||||
|
@ -422,6 +422,11 @@ class App.ControllerForm extends App.Controller
|
|||
record.selected = 'selected'
|
||||
record.checked = 'checked'
|
||||
|
||||
validate: (params) ->
|
||||
App.Model.validate(
|
||||
model: @model,
|
||||
params: params,
|
||||
)
|
||||
|
||||
# get all params of the form
|
||||
@params: (form) ->
|
||||
|
|
|
@ -37,7 +37,7 @@ class App.ControllerGenericNew extends App.ControllerModal
|
|||
object.load(params)
|
||||
|
||||
# validate
|
||||
errors = object.validate( form: true )
|
||||
errors = object.validate()
|
||||
if errors
|
||||
@log 'error new', errors
|
||||
@formValidate( form: e.target, errors: errors )
|
||||
|
@ -87,7 +87,7 @@ class App.ControllerGenericEdit extends App.ControllerModal
|
|||
@item.load(params)
|
||||
|
||||
# validate
|
||||
errors = @item.validate( form: true )
|
||||
errors = @item.validate()
|
||||
if errors
|
||||
@log 'error new', errors
|
||||
@formValidate( form: e.target, errors: errors )
|
||||
|
|
|
@ -20,6 +20,10 @@ class App.ChannelEmail extends App.ControllerTabs
|
|||
target: 'c-outbound',
|
||||
controller: App.ChannelEmailOutbound,
|
||||
},
|
||||
{
|
||||
name: 'Sigantures',
|
||||
target: 'c-signature',
|
||||
},
|
||||
{
|
||||
name: 'Adresses',
|
||||
target: 'c-address',
|
||||
|
@ -31,79 +35,12 @@ class App.ChannelEmail extends App.ControllerTabs
|
|||
{
|
||||
name: 'Settings',
|
||||
target: 'c-setting',
|
||||
controller: App.SettingsArea, params: { area: 'Email::Base' },
|
||||
controller: App.SettingsArea,
|
||||
params: { area: 'Email::Base' },
|
||||
},
|
||||
]
|
||||
|
||||
@render()
|
||||
|
||||
class App.ChannelEmailInboundEdit extends App.ControllerModal
|
||||
constructor: ->
|
||||
super
|
||||
@render(@object)
|
||||
|
||||
render: (data = {}) ->
|
||||
|
||||
configure_attributes = [
|
||||
{ name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: { IMAP: 'IMAP', POP3: 'POP3' } , class: 'span4', default: data['adapter'] },
|
||||
{ name: 'host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, class: 'span4', autocapitalize: false, default: (data['options']&&data['options']['host']) },
|
||||
{ name: 'user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, class: 'span4', autocapitalize: false, default: (data['options']&&data['options']['user']) },
|
||||
{ name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, class: 'span4', autocapitalize: false, default: (data['options']&&data['options']['password']) },
|
||||
{ name: 'ssl', display: 'SSL', tag: 'select', multiple: false, null: false, options: { true: 'yes', false: 'no' } , class: 'span4', default: (data['options']&&data['options']['ssl']) },
|
||||
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: false, filter: @edit_form, nulloption: false, relation: 'Group', class: 'span4', default: data['group_id'] },
|
||||
{ name: 'active', display: 'Active', tag: 'select', multiple: false, null: false, options: { true: 'yes', false: 'no' } , class: 'span4', default: data['active'] },
|
||||
]
|
||||
@html App.view('generic/admin/new')(
|
||||
head: 'New Channel'
|
||||
)
|
||||
new App.ControllerForm(
|
||||
el: @el.find('#object_new'),
|
||||
model: { configure_attributes: configure_attributes, className: '' },
|
||||
autofocus: true,
|
||||
)
|
||||
@modalShow()
|
||||
|
||||
submit: (e) =>
|
||||
e.preventDefault()
|
||||
|
||||
# get params
|
||||
params = @formParam(e.target)
|
||||
|
||||
object = @object || new App.Channel
|
||||
object.load(
|
||||
area: 'Email::Inbound',
|
||||
adapter: params['adapter'],
|
||||
group_id: params['group_id'],
|
||||
options: {
|
||||
host: params['host'],
|
||||
user: params['user'],
|
||||
password: params['password'],
|
||||
ssl: params['ssl'],
|
||||
},
|
||||
host: params['host'],
|
||||
user: params['user'],
|
||||
password: params['password'],
|
||||
active: params['active'],
|
||||
)
|
||||
|
||||
# validate form
|
||||
errors = object.validate()
|
||||
|
||||
# show errors in form
|
||||
if errors
|
||||
@log 'error new', errors
|
||||
@formValidate( form: e.target, errors: errors )
|
||||
return false
|
||||
|
||||
# save object
|
||||
object.save(
|
||||
success: =>
|
||||
@modalHide()
|
||||
error: =>
|
||||
@log 'errors'
|
||||
@modalHide()
|
||||
)
|
||||
|
||||
|
||||
class App.ChannelEmailInbound extends App.Controller
|
||||
events:
|
||||
|
@ -147,6 +84,69 @@ class App.ChannelEmailInbound extends App.Controller
|
|||
new App.ChannelEmailInboundEdit( object: item )
|
||||
|
||||
|
||||
class App.ChannelEmailInboundEdit extends App.ControllerModal
|
||||
constructor: ->
|
||||
super
|
||||
@render(@object)
|
||||
|
||||
render: (data = {}) ->
|
||||
|
||||
configure_attributes = [
|
||||
{ name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: { IMAP: 'IMAP', POP3: 'POP3' } , class: 'span4', default: data['adapter'] },
|
||||
{ name: 'host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, class: 'span4', autocapitalize: false, default: (data['options']&&data['options']['host']) },
|
||||
{ name: 'user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, class: 'span4', autocapitalize: false, default: (data['options']&&data['options']['user']) },
|
||||
{ name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, class: 'span4', autocapitalize: false, default: (data['options']&&data['options']['password']) },
|
||||
{ name: 'ssl', display: 'SSL', tag: 'select', multiple: false, null: false, options: { true: 'yes', false: 'no' } , class: 'span4', default: (data['options']&&data['options']['ssl']) },
|
||||
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: false, filter: @edit_form, nulloption: false, relation: 'Group', class: 'span4', default: data['group_id'] },
|
||||
{ name: 'active', display: 'Active', tag: 'select', multiple: false, null: false, options: { true: 'yes', false: 'no' } , class: 'span4', default: data['active'] },
|
||||
]
|
||||
@html App.view('generic/admin/new')(
|
||||
head: 'New Channel'
|
||||
)
|
||||
@form = new App.ControllerForm(
|
||||
el: @el.find('#object_new'),
|
||||
model: { configure_attributes: configure_attributes, className: '' },
|
||||
autofocus: true,
|
||||
)
|
||||
@modalShow()
|
||||
|
||||
submit: (e) =>
|
||||
e.preventDefault()
|
||||
|
||||
# get params
|
||||
params = @formParam(e.target)
|
||||
|
||||
object = @object || new App.Channel
|
||||
object.load(
|
||||
area: 'Email::Inbound',
|
||||
adapter: params['adapter'],
|
||||
group_id: params['group_id'],
|
||||
options: {
|
||||
host: params['host'],
|
||||
user: params['user'],
|
||||
password: params['password'],
|
||||
ssl: params['ssl'],
|
||||
},
|
||||
)
|
||||
|
||||
# validate form
|
||||
errors = @form.validate( params )
|
||||
|
||||
# show errors in form
|
||||
if errors
|
||||
@log 'error new', errors
|
||||
@formValidate( form: e.target, errors: errors )
|
||||
return false
|
||||
|
||||
# save object
|
||||
object.save(
|
||||
success: =>
|
||||
@modalHide()
|
||||
error: =>
|
||||
@log 'errors'
|
||||
@modalHide()
|
||||
)
|
||||
|
||||
class App.ChannelEmailOutbound extends App.Controller
|
||||
events:
|
||||
'change #_adapter': 'toggle'
|
||||
|
@ -159,15 +159,17 @@ class App.ChannelEmailOutbound extends App.Controller
|
|||
App.Channel.fetch()
|
||||
|
||||
render: =>
|
||||
|
||||
@html App.view('channel/email_outbound')()
|
||||
|
||||
# get current Email::Outbound channel
|
||||
channels = App.Channel.all()
|
||||
data = []
|
||||
adapters = {}
|
||||
adapter_used = undefined
|
||||
channel_used = undefined
|
||||
for channel in channels
|
||||
if channel.area is 'Email::Outbound'
|
||||
|
||||
data.push channel
|
||||
adapters[channel.adapter] = channel.adapter
|
||||
if @adapter_used
|
||||
if @adapter_used is channel.adapter
|
||||
|
@ -177,16 +179,15 @@ class App.ChannelEmailOutbound extends App.Controller
|
|||
adapter_used = channel.adapter
|
||||
channel_used = channel
|
||||
|
||||
@html App.view('channel/email_outbound')()
|
||||
|
||||
configure_attributes = [
|
||||
{ name: 'adapter', display: 'Send Mails via', tag: 'select', multiple: false, null: false, options: adapters , class: 'span4', default: adapter_used },
|
||||
]
|
||||
new App.ControllerForm(
|
||||
el: @el.find('#form-email-adapter'),
|
||||
model: { configure_attributes: configure_attributes, className: '' },
|
||||
autofocus: true,
|
||||
)
|
||||
if adapter_used is 'Sendmail'
|
||||
configure_attributes = [
|
||||
{ name: 'adapter', display: 'Send Mails via', tag: 'select', multiple: false, null: false, options: adapters , class: 'span4', default: adapter_used },
|
||||
]
|
||||
@form = new App.ControllerForm(
|
||||
el: @el.find('#form-email-adapter'),
|
||||
model: { configure_attributes: configure_attributes, className: '' },
|
||||
autofocus: true,
|
||||
)
|
||||
|
||||
if adapter_used is 'SMTP'
|
||||
configure_attributes = [
|
||||
|
@ -195,25 +196,30 @@ class App.ChannelEmailOutbound extends App.Controller
|
|||
{ name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, class: 'span4', autocapitalize: false, default: (channel_used['options']&&channel_used['options']['password']) },
|
||||
{ name: 'ssl', display: 'SSL', tag: 'select', multiple: false, null: false, options: { true: 'yes', false: 'no' } , class: 'span4', default: (channel_used['options']&&channel_used['options']['ssl']) },
|
||||
]
|
||||
new App.ControllerForm(
|
||||
@form = new App.ControllerForm(
|
||||
el: @el.find('#form-email-adapter-settings'),
|
||||
model: { configure_attributes: configure_attributes, className: '' },
|
||||
autofocus: true,
|
||||
)
|
||||
|
||||
|
||||
toggle: (e) =>
|
||||
|
||||
# get params
|
||||
params = @formParam(e.target)
|
||||
|
||||
# set selected adapter
|
||||
@adapter_used = params['adapter']
|
||||
|
||||
# render page with new selected adapter
|
||||
@render()
|
||||
|
||||
|
||||
update: (e) =>
|
||||
e.preventDefault()
|
||||
params = @formParam(e.target)
|
||||
|
||||
# errors = @form.validate( params )
|
||||
|
||||
# update Email::Outbound adapter
|
||||
channels = App.Channel.all()
|
||||
for channel in channels
|
||||
if channel.area is 'Email::Outbound' && channel.adapter is params['adapter']
|
||||
|
@ -227,11 +233,11 @@ class App.ChannelEmailOutbound extends App.Controller
|
|||
active: true,
|
||||
)
|
||||
|
||||
# set all other to inactive
|
||||
# set all other Email::Outbound adapters to inactive
|
||||
channels = App.Channel.all()
|
||||
for channel in channels
|
||||
if channel.area is 'Email::Outbound' && channel.adapter isnt params['adapter']
|
||||
channel.updateAttributes( active: false )
|
||||
|
||||
# rerender
|
||||
# rerender page
|
||||
@render()
|
||||
|
|
|
@ -11,9 +11,8 @@ class App.DashboardActivityStream extends App.Controller
|
|||
# refresh list ever 140 sec.
|
||||
# @interval( @fetch, 1400000, 'dashboard_activity_stream' )
|
||||
@fetch()
|
||||
Spine.bind 'activity_stream_rebuild', (data) =>
|
||||
@log 'a_stream', data
|
||||
@fetch()
|
||||
|
||||
@reBind( 'activity_stream_rebuild', @load )
|
||||
|
||||
fetch: =>
|
||||
|
||||
|
@ -26,7 +25,7 @@ class App.DashboardActivityStream extends App.Controller
|
|||
# App.Com.ajax(
|
||||
# id: 'dashoard_activity_stream',
|
||||
# type: 'GET',
|
||||
# url: '/activity_stream',
|
||||
# url: '/api/activity_stream',
|
||||
# data: {
|
||||
# limit: @limit,
|
||||
# }
|
||||
|
|
|
@ -7,14 +7,14 @@ class App.DashboardRecentViewed extends App.Controller
|
|||
constructor: ->
|
||||
super
|
||||
# @log 'aaaa', @el
|
||||
|
||||
|
||||
@items = []
|
||||
|
||||
|
||||
# get data
|
||||
App.Com.ajax(
|
||||
id: 'dashboard_recent_viewed',
|
||||
type: 'GET',
|
||||
url: '/recent_viewed',
|
||||
url: '/api/recent_viewed',
|
||||
data: {
|
||||
limit: 5,
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ class App.DashboardRecentViewed extends App.Controller
|
|||
@render()
|
||||
)
|
||||
|
||||
|
||||
render: ->
|
||||
|
||||
# load user data
|
||||
|
@ -44,13 +43,13 @@ class App.DashboardRecentViewed extends App.Controller
|
|||
for item in @items
|
||||
# @log 'load', item.o_id
|
||||
item.ticket = App.Ticket.find(item.o_id)
|
||||
|
||||
|
||||
html = App.view('dashboard/recent_viewed')(
|
||||
head: 'Recent Viewed',
|
||||
items: @items
|
||||
)
|
||||
html = $(html)
|
||||
|
||||
|
||||
@html html
|
||||
|
||||
# start user popups
|
||||
|
|
|
@ -4,11 +4,14 @@ class App.DashboardRss extends App.Controller
|
|||
constructor: ->
|
||||
super
|
||||
|
||||
# refresh list ever 600 sec.
|
||||
Spine.bind 'rss_rebuild', (data) =>
|
||||
@load(data)
|
||||
|
||||
# use cache of first page
|
||||
# bind to new events
|
||||
@reBind( 'rss_rebuild', @load )
|
||||
|
||||
# refresh list ever 600 sec.
|
||||
@fetch()
|
||||
|
||||
fetch: =>
|
||||
cache = App.Store.get( 'dashboard_rss' )
|
||||
if cache
|
||||
@load( cache )
|
||||
|
|
|
@ -11,19 +11,17 @@ class App.DashboardTicket extends App.Controller
|
|||
@start_page = 1
|
||||
@navupdate '#'
|
||||
|
||||
# set new key
|
||||
@key = 'ticket_overview_' + @view
|
||||
|
||||
# bind new events
|
||||
Spine.bind 'ticket_overview_rebuild', (data) =>
|
||||
@log 'ticket_overview_rebuild', data
|
||||
@fetch()
|
||||
@reBind('ticket_overview_rebuild', @fetch )
|
||||
|
||||
# render
|
||||
@fetch()
|
||||
|
||||
fetch: =>
|
||||
|
||||
# set new key
|
||||
@key = 'ticket_overview_' + @view
|
||||
|
||||
# use cache of first page
|
||||
cache = App.Store.get( @key )
|
||||
if cache
|
||||
|
@ -34,7 +32,7 @@ class App.DashboardTicket extends App.Controller
|
|||
# App.Com.ajax(
|
||||
# id: 'dashboard_ticket_' + @key,
|
||||
# type: 'GET',
|
||||
# url: '/ticket_overviews',
|
||||
# url: '/api/ticket_overviews',
|
||||
# data: {
|
||||
# view: @view,
|
||||
# view_mode: 'd',
|
||||
|
|
|
@ -44,7 +44,7 @@ class Index extends App.Controller
|
|||
App.Com.ajax(
|
||||
id: 'ticket_create',
|
||||
type: 'GET',
|
||||
url: '/ticket_create',
|
||||
url: '/api/ticket_create',
|
||||
data: {
|
||||
ticket_id: params.ticket_id,
|
||||
article_id: params.article_id,
|
||||
|
|
|
@ -8,7 +8,7 @@ class App.TicketHistory extends App.ControllerModal
|
|||
App.Com.ajax(
|
||||
id: 'ticket_history',
|
||||
type: 'GET',
|
||||
url: '/ticket_history/' + ticket_id,
|
||||
url: '/api/ticket_history/' + ticket_id,
|
||||
success: (data, status, xhr) =>
|
||||
# remember ticket
|
||||
@ticket = data.ticket
|
||||
|
|
|
@ -16,7 +16,7 @@ class App.TicketMerge extends App.ControllerModal
|
|||
App.Com.ajax(
|
||||
id: 'ticket_merge',
|
||||
type: 'GET',
|
||||
url: '/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'],
|
||||
url: '/api/ticket_merge/' + @ticket_id + '/' + params['master_ticket_number'],
|
||||
data: {
|
||||
# view: @view
|
||||
}
|
||||
|
|
|
@ -26,19 +26,17 @@ class Index extends App.Controller
|
|||
# set controller to active
|
||||
Config['ActiveController'] = '#ticket_overview_' + @view
|
||||
|
||||
# set new key
|
||||
@key = 'ticket_overview_' + @view
|
||||
|
||||
# bind new events
|
||||
Spine.bind 'ticket_overview_rebuild', (data) =>
|
||||
@log 'ticket_overview_rebuild', data
|
||||
@fetch()
|
||||
@reBind( 'ticket_overview_rebuild', @fetch )
|
||||
|
||||
# render
|
||||
@fetch()
|
||||
|
||||
fetch: =>
|
||||
|
||||
# set new key
|
||||
@key = 'ticket_overview_' + @view
|
||||
|
||||
# use cache of first page
|
||||
cache = App.Store.get( @key )
|
||||
if cache
|
||||
|
@ -51,7 +49,7 @@ class Index extends App.Controller
|
|||
# App.Com.ajax(
|
||||
# id: 'ticket_overview_' + @start_page,
|
||||
# type: 'GET',
|
||||
# url: '/ticket_overviews',
|
||||
# url: '/api/ticket_overviews',
|
||||
# data: {
|
||||
# view: @view,
|
||||
# view_mode: @view_mode,
|
||||
|
@ -423,7 +421,7 @@ class Router extends App.Controller
|
|||
else
|
||||
App.Com.ajax(
|
||||
type: 'GET',
|
||||
url: '/ticket_overviews',
|
||||
url: '/api/ticket_overviews',
|
||||
data: {
|
||||
view: @view,
|
||||
array: true,
|
||||
|
|
|
@ -35,7 +35,7 @@ class Index extends App.Controller
|
|||
App.Com.ajax(
|
||||
id: 'ticket_zoom',
|
||||
type: 'GET',
|
||||
url: '/ticket_full/' + ticket_id,
|
||||
url: '/api/ticket_full/' + ticket_id,
|
||||
data: {
|
||||
view: @view
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class Index extends App.Controller
|
|||
u: =>
|
||||
uploader = new qq.FileUploader(
|
||||
element: document.getElementById('file-uploader'),
|
||||
action: 'ticket_attachment_new',
|
||||
action: '/api/ticket_attachment_new',
|
||||
params: {
|
||||
form: 'TicketZoom',
|
||||
form_id: @ticket.id,
|
||||
|
|
|
@ -38,7 +38,7 @@ class Index extends App.Controller
|
|||
App.Com.ajax(
|
||||
id: 'ticket_create',
|
||||
type: 'GET',
|
||||
url: '/ticket_create',
|
||||
url: '/api/ticket_create',
|
||||
data: {
|
||||
ticket_id: params.ticket_id,
|
||||
article_id: params.article_id,
|
||||
|
|
|
@ -24,7 +24,7 @@ class Index extends App.Controller
|
|||
App.Com.ajax(
|
||||
id: 'getting_started',
|
||||
type: 'GET',
|
||||
url: '/getting_started',
|
||||
url: '/api/getting_started',
|
||||
data: {
|
||||
# view: @view,
|
||||
}
|
||||
|
|
|
@ -13,15 +13,26 @@ class App.Navigation extends App.Controller
|
|||
# rebuild nav bar with given user data
|
||||
Spine.bind 'navrebuild', (user) =>
|
||||
@log 'navbarrebuild', user
|
||||
|
||||
if !_.isEmpty( user )
|
||||
cache = App.Store.get( 'navupdate_ticket_overview' )
|
||||
@ticket_overview_build( cache ) if cache
|
||||
|
||||
if !_.isEmpty( user )
|
||||
cache = App.Store.get( 'update_recent_viewed' )
|
||||
@recent_viewed_build( cache ) if cache
|
||||
|
||||
@render(user)
|
||||
|
||||
# rebuild ticket overview data
|
||||
Spine.bind 'navupdate_ticket_overview', (data) =>
|
||||
@ticket_overview_build(data)
|
||||
@render( window.Session )
|
||||
|
||||
# rebuild recent viewd data
|
||||
Spine.bind 'update_recent_viewed', (data) =>
|
||||
@recent_viewed_build(data)
|
||||
@render( window.Session )
|
||||
|
||||
render: (user) ->
|
||||
nav_left = @getItems( navbar: Config.NavBar )
|
||||
|
@ -134,6 +145,8 @@ class App.Navigation extends App.Controller
|
|||
|
||||
ticket_overview_build: (data) =>
|
||||
|
||||
App.Store.write( 'navupdate_ticket_overview', data )
|
||||
|
||||
# remove old views
|
||||
for key of Config.NavBar
|
||||
if Config.NavBar[key].parent is '#ticket_view'
|
||||
|
@ -150,11 +163,10 @@ class App.Navigation extends App.Controller
|
|||
role: ['Agent'],
|
||||
}
|
||||
|
||||
# rebuild navbar
|
||||
Spine.trigger 'navrebuild', window.Session
|
||||
|
||||
recent_viewed_build: (data) =>
|
||||
|
||||
App.Store.write( 'update_recent_viewed', data )
|
||||
|
||||
items = data.recent_viewed
|
||||
|
||||
# load user collection
|
||||
|
@ -189,6 +201,3 @@ class App.Navigation extends App.Controller
|
|||
divider: divider,
|
||||
navheader: navheader
|
||||
}
|
||||
|
||||
# rebuild navbar
|
||||
Spine.trigger 'navrebuild', window.Session
|
|
@ -6,6 +6,7 @@ class Index extends App.Controller
|
|||
events:
|
||||
'submit form': 'submit',
|
||||
'click .submit': 'submit',
|
||||
'click .retry': 'rerender',
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
@ -29,6 +30,10 @@ class Index extends App.Controller
|
|||
autofocus: true,
|
||||
)
|
||||
|
||||
rerender: (e) ->
|
||||
e.preventDefault()
|
||||
@render()
|
||||
|
||||
submit: (e) ->
|
||||
e.preventDefault()
|
||||
params = @formParam(e.target)
|
||||
|
@ -40,13 +45,20 @@ class Index extends App.Controller
|
|||
url: '/users/password_reset',
|
||||
data: JSON.stringify(params),
|
||||
processData: true,
|
||||
success: @success
|
||||
success: @success,
|
||||
error: @error,
|
||||
)
|
||||
|
||||
success: (data, status, xhr) =>
|
||||
@html App.view('generic/hero_message')(
|
||||
head: 'We\'ve sent password reset instructions to your email address',
|
||||
message: 'If you don\'t receive instructions within a minute or two, check your email\'s spam and junk filters, or try <a href="#reset_password">resending your request</a>.'
|
||||
message: 'If you don\'t receive instructions within a minute or two, check your email\'s spam and junk filters, or try <a href="#" class="retry">resending your request</a>.'
|
||||
);
|
||||
|
||||
error: (data, status, xhr) =>
|
||||
@html App.view('generic/hero_message')(
|
||||
head: 'Problem',
|
||||
message: 'Username or email address invalid, please go back and try <a href="#" class="retry">again</a>.'
|
||||
);
|
||||
|
||||
Config.Routes['reset_password'] = Index
|
||||
|
|
|
@ -40,13 +40,6 @@ class Index extends App.Controller
|
|||
@log 'submit'
|
||||
e.preventDefault()
|
||||
@params = @formParam(e.target)
|
||||
###
|
||||
for num in [1..199]
|
||||
user = new App.User
|
||||
params.login = 'login_c' + num
|
||||
user.updateAttributes(params)
|
||||
return false
|
||||
###
|
||||
|
||||
# if no login is given, use emails as fallback
|
||||
if !@params.login && @params.email
|
||||
|
|
|
@ -6,12 +6,19 @@ class App.Auth
|
|||
console.log 'login(...)', params
|
||||
App.Com.ajax(
|
||||
id: 'login',
|
||||
# params,
|
||||
type: 'POST',
|
||||
url: '/signin',
|
||||
data: JSON.stringify(params.data),
|
||||
success: params.success,
|
||||
error: params.error,
|
||||
success: (data, status, xhr) =>
|
||||
|
||||
# clear store
|
||||
App.Store.clear('all')
|
||||
|
||||
# execute callback
|
||||
params.success(data, status, xhr)
|
||||
|
||||
error: (xhr, statusText, error) =>
|
||||
params.error(xhr, statusText, error)
|
||||
)
|
||||
|
||||
@loginCheck: ->
|
||||
|
@ -56,14 +63,15 @@ class App.Auth
|
|||
|
||||
# update websocked auth info
|
||||
App.WebSocket.auth()
|
||||
|
||||
|
||||
# refresh/load default collections
|
||||
controller = new App.Controller
|
||||
for key, value of data.default_collections
|
||||
App[key].refresh( value, options: { clear: true } )
|
||||
controller.loadCollection( type: key, data: value )
|
||||
|
||||
# rebuild navbar with new navbar items
|
||||
Spine.trigger 'navrebuild', data.session
|
||||
|
||||
|
||||
# rebuild navbar with updated ticket count of overviews
|
||||
Spine.trigger 'navupdate_remote'
|
||||
|
||||
|
@ -73,6 +81,9 @@ class App.Auth
|
|||
# empty session
|
||||
window.Session = {}
|
||||
|
||||
# clear store
|
||||
App.Store.clear('all')
|
||||
|
||||
# update websocked auth info
|
||||
App.WebSocket.auth()
|
||||
)
|
||||
|
@ -88,6 +99,9 @@ class App.Auth
|
|||
# update websocked auth info
|
||||
App.WebSocket.auth()
|
||||
|
||||
# clear store
|
||||
App.Store.clear('all')
|
||||
|
||||
error: (xhr, statusText, error) =>
|
||||
|
||||
# update websocked auth info
|
||||
|
|
|
@ -11,12 +11,6 @@ class App.Run extends App.Controller
|
|||
# init of i18n
|
||||
new App.i18n
|
||||
|
||||
# start navigation controller
|
||||
new App.Navigation( el: @el.find('#navigation') );
|
||||
|
||||
# check if session already exists/try to get session data from server
|
||||
App.Auth.loginCheck()
|
||||
|
||||
# bind new events
|
||||
Spine.bind 'loadCollection', (data) =>
|
||||
|
||||
|
@ -25,7 +19,16 @@ class App.Run extends App.Controller
|
|||
for key of data.collections
|
||||
|
||||
@log 'loadCollection', key, data.collections[key]
|
||||
@loadCollection( type: key, data: data.collections[key] )
|
||||
@loadCollection( localStorage: data.localStorage, type: key, data: data.collections[key] )
|
||||
|
||||
# load collections
|
||||
App.Store.load()
|
||||
|
||||
# start navigation controller
|
||||
new App.Navigation( el: @el.find('#navigation') );
|
||||
|
||||
# check if session already exists/try to get session data from server
|
||||
App.Auth.loginCheck()
|
||||
|
||||
# start notify controller
|
||||
new App.Notify( el: @el.find('#notify') );
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
class App.Store
|
||||
_instance = undefined # Must be declared here to force the closure on the class
|
||||
@renew: ->
|
||||
_instance = new _Singleton
|
||||
|
||||
@load: ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _Singleton
|
||||
|
||||
@write: (key, value) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _Singleton
|
||||
|
@ -15,6 +22,11 @@ class App.Store
|
|||
_instance ?= new _Singleton
|
||||
_instance.delete(args)
|
||||
|
||||
@clear: (args) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _Singleton
|
||||
_instance.clear(args)
|
||||
|
||||
@list: () ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _Singleton
|
||||
|
@ -26,15 +38,88 @@ class _Singleton
|
|||
|
||||
constructor: (@args) ->
|
||||
|
||||
# find collections to load
|
||||
@_loadCollectionAll()
|
||||
@_loadCollectionType('TicketPriority')
|
||||
@_loadCollectionType('TicketStateType')
|
||||
@_loadCollectionType('TicketState')
|
||||
@_loadCollectionType('TicketArticleSender')
|
||||
@_loadCollectionType('TicketArticleType')
|
||||
@_loadCollectionType('Group')
|
||||
@_loadCollectionType('Role')
|
||||
@_loadCollectionType('Organization')
|
||||
@_loadCollectionType('User')
|
||||
@_loadCollectionType()
|
||||
|
||||
_loadCollectionAll: ->
|
||||
@all = {}
|
||||
@rest = {}
|
||||
logLength = localStorage.length-1;
|
||||
for count in [0..logLength]
|
||||
key = localStorage.key( count )
|
||||
if key
|
||||
value = localStorage.getItem( key )
|
||||
data = JSON.parse( value )
|
||||
@all[key] = data
|
||||
|
||||
_loadCollectionType: (type) ->
|
||||
# console.log('STORE NEW' + logLength)
|
||||
toGo = @all
|
||||
if !_.isEmpty( @rest )
|
||||
toGo = _.clone( @rest )
|
||||
@rest = {}
|
||||
for key, data of toGo
|
||||
# console.log('STORE NEW' + count + '-' + key, data)
|
||||
if data['collections']
|
||||
data['localStorage'] = true
|
||||
|
||||
if type
|
||||
if data['type'] is type
|
||||
@_loadCollection(data)
|
||||
else
|
||||
@rest[key] = data
|
||||
else
|
||||
@_loadCollection(data)
|
||||
|
||||
_loadCollection: (data) ->
|
||||
console.log('fire', 'loadCollection', data )
|
||||
Spine.trigger( 'loadCollection', data )
|
||||
|
||||
write: (key, value) ->
|
||||
|
||||
# write to instance
|
||||
@store[ key ] = value
|
||||
|
||||
# write to local storage
|
||||
localStorage.setItem( key, JSON.stringify( value ) )
|
||||
|
||||
get: (key) ->
|
||||
@store[ key ]
|
||||
|
||||
# return from instance
|
||||
return @store[ key ] if @store[ key ]
|
||||
|
||||
# if not, return from local storage
|
||||
value = localStorage.getItem( key )
|
||||
object = JSON.parse( value )
|
||||
return object if object
|
||||
|
||||
# return undefined if not in storage
|
||||
return undefined
|
||||
|
||||
delete: (key) ->
|
||||
delete @store[ key ]
|
||||
|
||||
clear: (action) ->
|
||||
|
||||
console.log 'Store:clear', action
|
||||
|
||||
# clear instance data
|
||||
@store = {}
|
||||
|
||||
# clear local storage
|
||||
if action is 'all'
|
||||
localStorage.clear()
|
||||
|
||||
list: () ->
|
||||
list = []
|
||||
for key of @store
|
||||
|
|
|
@ -1,32 +1,33 @@
|
|||
class App.Model extends Spine.Model
|
||||
|
||||
validate: (data = {}) ->
|
||||
# console.log 'vali', @
|
||||
# console.log 'vali', params, '@', @
|
||||
# console.log 'validate', params, @configure_attributes, @, App.User.configure_attributes
|
||||
# check if @constructor.configure_attributes is used
|
||||
return if !@constructor.configure_attributes
|
||||
|
||||
@validate: ( data = {} ) ->
|
||||
return if !data['model'].configure_attributes
|
||||
|
||||
errors = {}
|
||||
for attribute in @constructor.configure_attributes
|
||||
for attribute in data['model'].configure_attributes
|
||||
if !attribute.readonly
|
||||
|
||||
# check required
|
||||
if 'null' of attribute && !attribute[null] && !@[attribute.name]
|
||||
if 'null' of attribute && !attribute[null] && !data['params'][attribute.name]
|
||||
errors[attribute.name] = 'is required'
|
||||
|
||||
# check confirm password
|
||||
if data.form && attribute.type is 'password' && @[attribute.name]
|
||||
if attribute.type is 'password' && data['params'][attribute.name] && "#{attribute.name}_confirm" of data['params']
|
||||
|
||||
# get confirm password
|
||||
if @[attribute.name] isnt @["#{attribute.name}_confirm"]
|
||||
console.log 'aaa', @[attribute.name], @["#{attribute.name}_confirm"], attribute[null]
|
||||
if data['params'][attribute.name] isnt data['params']["#{attribute.name}_confirm"]
|
||||
console.log 'aaa', data['params'][attribute.name], data['params']["#{attribute.name}_confirm"], attribute[null]
|
||||
errors[attribute.name] = 'didn\'t match'
|
||||
errors["#{attribute.name}_confirm"] = ''
|
||||
|
||||
# return error object
|
||||
for key, msg of errors
|
||||
# console.log 'e', errors
|
||||
return errors
|
||||
|
||||
return
|
||||
return errors if !_.isEmpty(errors)
|
||||
|
||||
# return no errors
|
||||
return
|
||||
|
||||
validate: ->
|
||||
App.Model.validate(
|
||||
model: @constructor,
|
||||
params: @,
|
||||
)
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
class App.Channel extends App.Model
|
||||
@configure 'Channel', 'adapter', 'area', 'options', 'group_id', 'active'
|
||||
@extend Spine.Model.Ajax
|
||||
|
||||
@configure_attributes = [
|
||||
{ name: 'adapter', display: 'Adapter', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'xlarge' },
|
||||
{ name: 'area', display: 'Area', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'xlarge' },
|
||||
# { name: 'host', display: 'Host', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'xlarge' },
|
||||
# { name: 'user', display: 'User', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'xlarge' },
|
||||
# { name: 'password', display: 'Password', tag: 'input', type: 'text', limit: 100, null: fa, 'class': 'xlarge' },
|
||||
{ name: 'options', display: 'Area', tag: 'input', type: 'text', limit: 100, null: false, 'class': 'xlarge' },
|
||||
{ name: 'group_id', display: 'Group', tag: 'option', type: 'text', limit: 100, null: true, 'class': 'xlarge' },
|
||||
{ name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, null: true, 'class': 'xlarge' },
|
||||
]
|
||||
@url: '/api/channels'
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class App.Group extends App.Model
|
||||
@configure 'Group', 'name', 'note', 'active'
|
||||
@configure 'Group', 'name', 'assignment_timeout', 'follow_up_possible', 'follow_up_assignment', 'note', 'active'
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/api/groups'
|
||||
|
||||
@configure_attributes = [
|
||||
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
|
||||
{ name: 'assignment_timeout', display: 'Assignment Timout', tag: 'input', note: 'Assignment timout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class App.Organization extends App.Model
|
||||
@configure 'Organization', 'name', 'shared', 'note', 'active'
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/api/organizations'
|
||||
@configure_attributes = [
|
||||
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
|
||||
{ name: 'shared', display: 'Shared organiztion', tag: 'boolean', note: 'Customers in the organiztion can view each other items.', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
class App.Overview extends Spine.Model
|
||||
@configure 'Overview', 'name', 'meta', 'condition', 'order', 'view', 'user_id', 'group_ids'
|
||||
@extend Spine.Model.Ajax
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/api/overviews'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class App.Role extends App.Model
|
||||
@configure 'Role', 'name', 'note', 'active'
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/api/roles'
|
||||
@configure_attributes = [
|
||||
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, 'null': false, 'class': 'span4' },
|
||||
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, 'class': 'span4' },
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
class App.Session extends App.Model
|
||||
@configure 'Session', 'data'
|
||||
@extend Spine.Model.Ajax
|
|
@ -1,3 +1,4 @@
|
|||
class App.Setting extends App.Model
|
||||
@configure 'Setting', 'name', 'state'
|
||||
@extend Spine.Model.Ajax
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/api/settings'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
class App.Template extends App.Model
|
||||
@configure 'Template', 'name', 'options', 'group_ids', 'user_id'
|
||||
@extend Spine.Model.Ajax
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/api/templates'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class App.Ticket extends App.Model
|
||||
@configure 'Ticket', 'number', 'title', 'group_id', 'owner_id', 'customer_id', 'ticket_state_id', 'ticket_priority_id', 'article'
|
||||
@extend Spine.Model.Ajax
|
||||
# @url: '/tickets'
|
||||
@url: '/api/tickets'
|
||||
@configure_attributes = [
|
||||
{ name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, read_only: true },
|
||||
{ name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', autocapitalize: false, help: 'Select the customer of the Ticket or create one.', link: '<a href="" class="customer_new">»</a>' },
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class App.TicketArticle extends App.Model
|
||||
@configure 'TicketArticle', 'from', 'to', 'cc', 'subject', 'body', 'ticket_id', 'ticket_article_type_id', 'ticket_article_sender_id', 'internal', 'in_reply_to'
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/ticket_articles'
|
||||
@url: '/api/ticket_articles'
|
||||
@configure_attributes = [
|
||||
{ name: 'ticket_id', display: 'TicketID', null: false, readonly: 1, },
|
||||
{ name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class App.TicketPriority extends App.Model
|
||||
@configure 'TicketPriority', 'name', 'note', 'active'
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/ticket_priorities'
|
||||
@url: '/api/ticket_priorities'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class App.TicketState extends App.Model
|
||||
@configure 'TicketState', 'name', 'note', 'active'
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/ticket_states'
|
||||
@url: '/api/ticket_states'
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class App.User extends App.Model
|
||||
@configure 'User', 'login', 'firstname', 'lastname', 'email', 'web', 'password', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'organization_id', 'note', 'role_ids', 'group_ids', 'active', 'invite'
|
||||
@extend Spine.Model.Ajax
|
||||
@url: '/api/users'
|
||||
|
||||
# @hasMany 'roles', 'App.Role'
|
||||
@configure_attributes = [
|
||||
{ name: 'login', display: 'Login', tag: 'input', type: 'text', limit: 100, null: false, class: 'span4', autocapitalize: false, signup: false, quick: false },
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<img class="thumbnail user-data" data-id="<%= article.created_by_id %>" src="<%= article.created_by.image %>" alt="">
|
||||
<ul>
|
||||
<li style="font-size: 10px;"><%- T(article.article_type.name) %></li>
|
||||
<% if article.article_type.name is 'email': %><li style="font-size: 10px;"><a href="/ticket_article_plain/<%= article.id %>"><%- T('raw') %></a></li><% end %>
|
||||
<% if article.article_type.name is 'email': %><li style="font-size: 10px;"><a href="/api/ticket_article_plain/<%= article.id %>"><%- T('raw') %></a></li><% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span8 well-muted article-message <% if article.internal is true: %> internal<% end %>">
|
||||
|
@ -63,7 +63,7 @@
|
|||
<% if article.attachments: %>
|
||||
<div>
|
||||
<% for attachment in article.attachments: %>
|
||||
<a href="ticket_attachment/<%= article.ticket_id %>/<%= article.id %>/<%= attachment.id %>" target="_blank" data-type="attachment" class="" title="<%= attachment.size %>"><%= attachment.filename %></a>
|
||||
<a href="/api/ticket_attachment/<%= article.ticket_id %>/<%= article.id %>/<%= attachment.id %>" target="_blank" data-type="attachment" class="" title="<%= attachment.size %>"><%= attachment.filename %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -3,6 +3,10 @@ body {
|
|||
font-size: 13px;
|
||||
}
|
||||
|
||||
label, input, button, select, textarea {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
float: left;
|
||||
background:url("/assets/spinner.gif") no-repeat;
|
||||
|
@ -25,9 +29,21 @@ body {
|
|||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 0 0 10px;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 34px;
|
||||
line-height: 38px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 28px;
|
||||
line-height: 36px;
|
||||
}
|
||||
h3 {
|
||||
font-size: 22px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.navbar .nav > li > a {
|
||||
padding: 10px 12px 10px;
|
||||
}
|
||||
|
@ -65,6 +81,12 @@ h1, h2, h3, h4, h5, h6 {
|
|||
margin: 20px 0 20px
|
||||
}
|
||||
|
||||
.form-horizontal .help-inline, .form-horizontal .help-block {
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
|
||||
/* replace music icon with attachment */
|
||||
.icon-attachment {
|
||||
background-position: -24px 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class ActivityController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /activity_stream
|
||||
# GET /api/activity_stream
|
||||
def activity_stream
|
||||
activity_stream = History.activity_stream_fulldata(current_user, params[:limit])
|
||||
|
||||
|
|
|
@ -2,7 +2,16 @@ class ApplicationController < ActionController::Base
|
|||
include UserInfo
|
||||
# http_basic_authenticate_with :name => "test", :password => "ttt"
|
||||
|
||||
helper_method :current_user, :authentication_check, :config_frontend, :user_data_full, :is_role
|
||||
helper_method :current_user,
|
||||
:authentication_check,
|
||||
:config_frontend,
|
||||
:user_data_full,
|
||||
:is_role,
|
||||
:model_create_render,
|
||||
:model_update_render,
|
||||
:model_restory_render,
|
||||
:mode_show_rendeder,
|
||||
:model_index_render
|
||||
|
||||
before_filter :set_user
|
||||
before_filter :cors_preflight_check
|
||||
|
@ -55,9 +64,8 @@ class ApplicationController < ActionController::Base
|
|||
set_user
|
||||
end
|
||||
|
||||
def authentication_check
|
||||
def authentication_check_only
|
||||
puts 'authentication_check'
|
||||
|
||||
# puts params.inspect
|
||||
|
||||
# check http basic auth
|
||||
|
@ -75,41 +83,57 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# return auth ok
|
||||
if message == ''
|
||||
|
||||
|
||||
# set basic auth user to current user
|
||||
current_user_set(userdata)
|
||||
return true
|
||||
return {
|
||||
:auth => true
|
||||
}
|
||||
end
|
||||
|
||||
# return auth not ok
|
||||
render(
|
||||
:json => {
|
||||
:error => message,
|
||||
},
|
||||
:status => :unauthorized
|
||||
)
|
||||
return false
|
||||
return {
|
||||
:auth => false,
|
||||
:message => message,
|
||||
}
|
||||
end
|
||||
|
||||
# check logon session
|
||||
if params['logon_session']
|
||||
logon_session = ActiveRecord::SessionStore::Session.where( :session_id => params['logon_session'] ).first
|
||||
if logon_session
|
||||
userdata = User.find( user_id = logon_session.data[:user_id] )
|
||||
userdata = User.find( logon_session.data[:user_id] )
|
||||
end
|
||||
|
||||
# set logon session user to current user
|
||||
current_user_set(userdata)
|
||||
return true
|
||||
return {
|
||||
:auth => true
|
||||
}
|
||||
end
|
||||
|
||||
# return auth not ok (no session exists)
|
||||
if !session[:user_id]
|
||||
message = 'no valid session, user_id'
|
||||
puts message
|
||||
return {
|
||||
:auth => false,
|
||||
:message => message,
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
:auth => true
|
||||
}
|
||||
end
|
||||
|
||||
def authentication_check
|
||||
result = authentication_check_only
|
||||
|
||||
# return auth not ok
|
||||
if result[:auth] == false
|
||||
render(
|
||||
:json => {
|
||||
:error => message,
|
||||
:json => {
|
||||
:error => result[:message],
|
||||
},
|
||||
:status => :unauthorized
|
||||
)
|
||||
|
@ -175,4 +199,73 @@ class ApplicationController < ActionController::Base
|
|||
return config
|
||||
end
|
||||
|
||||
# model helper
|
||||
def model_create_render (object, params)
|
||||
begin
|
||||
|
||||
# create object
|
||||
generic_object = object.new( object.param_cleanup(params) )
|
||||
|
||||
# set created_by_id and updated_by_id
|
||||
generic_object.created_by_id = current_user.id
|
||||
generic_object.updated_by_id = current_user.id
|
||||
|
||||
# save object
|
||||
generic_object.save
|
||||
render :json => generic_object, :status => :created
|
||||
rescue Exception => e
|
||||
logger.error e.message
|
||||
render :json => { :error => e.message }, :status => :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_update_render (object, params)
|
||||
begin
|
||||
|
||||
# find object
|
||||
generic_object = object.find( params[:id] )
|
||||
|
||||
# set created_by_id and updated_by_id
|
||||
params['updated_by_id'] = current_user.id
|
||||
|
||||
# save object
|
||||
generic_object.update_attributes( object.param_cleanup(params) )
|
||||
render :json => generic_object, :status => :ok
|
||||
rescue Exception => e
|
||||
logger.error e.message
|
||||
render :json => { :error => e.message }, :status => :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_destory_render (object, params)
|
||||
begin
|
||||
generic_object = object.find( params[:id] )
|
||||
generic_object.destroy
|
||||
head :ok
|
||||
rescue Exception => e
|
||||
logger.error e.message
|
||||
render :json => { :error => e.message }, :status => :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_show_render (object, params)
|
||||
begin
|
||||
generic_object = object.find( params[:id] )
|
||||
render :json => generic_object, :status => :ok
|
||||
rescue Exception => e
|
||||
logger.error e.message
|
||||
render :json => { :error => e.message }, :status => :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_index_render (object, params)
|
||||
begin
|
||||
generic_object = object.all
|
||||
render :json => generic_object, :status => :ok
|
||||
rescue Exception => e
|
||||
logger.error e.message
|
||||
render :json => { :error => e.message }, :status => :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,49 +1,207 @@
|
|||
class ChannelsController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /channels
|
||||
=begin
|
||||
|
||||
Format:
|
||||
JSON
|
||||
|
||||
Example:
|
||||
{
|
||||
"id":1,
|
||||
"area":"Email::Inbound",
|
||||
"adapter":"IMAP",
|
||||
"group_id:": 1,
|
||||
"options":{
|
||||
"host":"mail.example.com",
|
||||
"user":"some_user",
|
||||
"password":"some_password",
|
||||
"ssl":true
|
||||
},
|
||||
"active":true,
|
||||
"updated_at":"2012-09-14T17:51:53Z",
|
||||
"created_at":"2012-09-14T17:51:53Z",
|
||||
"updated_by_id":2.
|
||||
"created_by_id":2,
|
||||
}
|
||||
|
||||
{
|
||||
"id":1,
|
||||
"area":"Twitter::Inbound",
|
||||
"adapter":"Twitter2",
|
||||
"group_id:": 1,
|
||||
"options":{
|
||||
"consumer_key":"PJ4c3dYYRtSZZZdOKo8ow",
|
||||
"consumer_secret":"ggAdnJE2Al1Vv0cwwvX5bdvKOieFs0vjCIh5M8Dxk",
|
||||
"oauth_token":"293437546-xxRa9g74CercnU5AvY1uQwLLGIYrV1ezYtpX8oKW",
|
||||
"oauth_token_secret":"ju0E4l9OdY2Lh1iTKMymAu6XVfOaU2oGxmcbIMRZQK4",
|
||||
"search":[
|
||||
{
|
||||
"item":"#otrs",
|
||||
"group_id":1,
|
||||
},
|
||||
{
|
||||
"item":"#zombie42",
|
||||
"group_id":1,
|
||||
},
|
||||
{
|
||||
"item":"#otterhub",
|
||||
"group_id":1,
|
||||
}
|
||||
],
|
||||
"mentions" {
|
||||
"group_id":1,
|
||||
},
|
||||
"direct_messages": {
|
||||
"group_id":1,
|
||||
}
|
||||
},
|
||||
"active":true,
|
||||
"updated_at":"2012-09-14T17:51:53Z",
|
||||
"created_at":"2012-09-14T17:51:53Z",
|
||||
"updated_by_id":2.
|
||||
"created_by_id":2,
|
||||
}
|
||||
|
||||
=end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/channels.json
|
||||
|
||||
Response:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"area":"Email::Inbound",
|
||||
"adapter":"IMAP",
|
||||
...
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"area":"Email::Inbound",
|
||||
"adapter":"IMAP",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/channels.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
@channels = Channel.all
|
||||
|
||||
render :json => @channels
|
||||
model_index_render(Channel, params)
|
||||
end
|
||||
|
||||
# GET /channels/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/channels/#{id}.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"area":"Email::Inbound",
|
||||
"adapter":"IMAP",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/channels/#{id}.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def show
|
||||
@channel = Channel.find(params[:id])
|
||||
|
||||
render :json => @channel
|
||||
model_show_render(Channel, params)
|
||||
end
|
||||
|
||||
# POST /channels
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
POST /api/channels.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"area":"Email::Inbound",
|
||||
"adapter":"IMAP",
|
||||
"group_id:": 1,
|
||||
"options":{
|
||||
"host":"mail.example.com",
|
||||
"user":"some_user",
|
||||
"password":"some_password",
|
||||
"ssl":true
|
||||
},
|
||||
"active":true,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"area":"Email::Inbound",
|
||||
"adapter":"IMAP",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def create
|
||||
|
||||
@channel = Channel.new(params[:channel])
|
||||
@channel.created_by_id = current_user.id
|
||||
|
||||
if @channel.save
|
||||
render :json => @channel, :status => :created
|
||||
else
|
||||
render :json => @channel.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Channel, params)
|
||||
end
|
||||
|
||||
# PUT /channels/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
PUT /api/channels/{id}.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"id":1,
|
||||
"area":"Email::Inbound",
|
||||
"adapter":"IMAP",
|
||||
"group_id:": 1,
|
||||
"options":{
|
||||
"host":"mail.example.com",
|
||||
"user":"some_user",
|
||||
"password":"some_password",
|
||||
"ssl":true
|
||||
},
|
||||
"active":true,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def update
|
||||
@channel = Channel.find(params[:id])
|
||||
|
||||
if @channel.update_attributes(params[:channel])
|
||||
render :json => @channel, :status => :ok
|
||||
else
|
||||
render :json => @channel.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Channel, params)
|
||||
end
|
||||
|
||||
# DELETE /channels/1
|
||||
def destroy
|
||||
@channel = Channel.find(params[:id])
|
||||
@channel.destroy
|
||||
=begin
|
||||
|
||||
head :ok
|
||||
Resource:
|
||||
DELETE /api/channels/{id}.json
|
||||
|
||||
Response:
|
||||
{}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/channels.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE
|
||||
|
||||
=end
|
||||
|
||||
def destroy
|
||||
model_destory_render(Channel, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,30 @@
|
|||
class GettingStartedController < ApplicationController
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/getting_started.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"master_user": 1,
|
||||
"groups": [
|
||||
{
|
||||
"name": "group1",
|
||||
"active":true
|
||||
},
|
||||
{
|
||||
"name": "group2",
|
||||
"active":true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/getting_started.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
|
||||
# check if first user already exists
|
||||
|
@ -9,13 +34,18 @@ class GettingStartedController < ApplicationController
|
|||
master_user = 1
|
||||
end
|
||||
|
||||
# if master user already exists, we need to be authenticated
|
||||
if master_user == 0
|
||||
return if !authentication_check
|
||||
end
|
||||
|
||||
# get all groups
|
||||
@groups = Group.where( :active => true )
|
||||
groups = Group.where( :active => true )
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:master_user => master_user,
|
||||
:groups => @groups,
|
||||
:groups => groups,
|
||||
}
|
||||
end
|
||||
end
|
|
@ -1,48 +1,149 @@
|
|||
class GroupsController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /groups
|
||||
=begin
|
||||
|
||||
Format:
|
||||
JSON
|
||||
|
||||
Example:
|
||||
{
|
||||
"id":1,
|
||||
"name":"some group",
|
||||
"assignment_timeout": null,
|
||||
"follow_up_assignment": true,
|
||||
"follow_up_possible": "yes",
|
||||
"note":"",
|
||||
"active":true,
|
||||
"updated_at":"2012-09-14T17:51:53Z",
|
||||
"created_at":"2012-09-14T17:51:53Z",
|
||||
"created_by_id":2,
|
||||
}
|
||||
|
||||
=end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/groups.json
|
||||
|
||||
Response:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name1",
|
||||
...
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "some_name2",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/groups.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
@groups = Group.all
|
||||
|
||||
render :json => @groups
|
||||
model_index_render(Group, params)
|
||||
end
|
||||
|
||||
# GET /groups/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/groups/#{id}.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "name_1",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/groups/#{id}.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def show
|
||||
@group = Group.find(params[:id])
|
||||
|
||||
render :json => @group
|
||||
model_show_render(Group, params)
|
||||
end
|
||||
|
||||
# POST /groups
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
POST /api/groups.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name": "some name",
|
||||
"assignment_timeout": null,
|
||||
"follow_up_assignment": true,
|
||||
"follow_up_possible": "yes",
|
||||
"note":"",
|
||||
"active":true,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/groups.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def create
|
||||
@group = Group.new(params[:group])
|
||||
@group.created_by_id = current_user.id
|
||||
|
||||
if @group.save
|
||||
render :json => @group, :status => :created
|
||||
else
|
||||
render :json => @group.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Group, params)
|
||||
end
|
||||
|
||||
# PUT /groups/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
PUT /api/groups/{id}.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name": "some name",
|
||||
"assignment_timeout": null,
|
||||
"follow_up_assignment": true,
|
||||
"follow_up_possible": "yes",
|
||||
"note":"",
|
||||
"active":true,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/groups.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def update
|
||||
@group = Group.find(params[:id])
|
||||
|
||||
if @group.update_attributes(params[:group])
|
||||
render :json => @group, :status => :ok
|
||||
else
|
||||
render :json => @group.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Group, params)
|
||||
end
|
||||
|
||||
# DELETE /groups/1
|
||||
def destroy
|
||||
@group = Group.find(params[:id])
|
||||
@group.destroy
|
||||
=begin
|
||||
|
||||
head :ok
|
||||
Resource:
|
||||
|
||||
Response:
|
||||
|
||||
Test:
|
||||
|
||||
=end
|
||||
|
||||
def destroy
|
||||
model_destory_render(Group, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,48 +1,144 @@
|
|||
class OrganizationsController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /organizations
|
||||
=begin
|
||||
|
||||
Format:
|
||||
JSON
|
||||
|
||||
Example:
|
||||
{
|
||||
"id":1,
|
||||
"name":"Znuny GmbH",
|
||||
"note":"",
|
||||
"active":true,
|
||||
"shared":true,
|
||||
"updated_at":"2012-09-14T17:51:53Z",
|
||||
"created_at":"2012-09-14T17:51:53Z",
|
||||
"created_by_id":2,
|
||||
}
|
||||
|
||||
=end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/organizations.json
|
||||
|
||||
Response:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name1",
|
||||
...
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "some_name2",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/organizations.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
@organizations = Organization.all
|
||||
|
||||
render :json => @organizations
|
||||
model_index_render(Organization, params)
|
||||
end
|
||||
|
||||
# GET /organizations/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/organizations/#{id}.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "name_1",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/organizations/#{id}.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def show
|
||||
@organization = Organization.find(params[:id])
|
||||
|
||||
render :json => @organization
|
||||
model_show_render(Organization, params)
|
||||
end
|
||||
|
||||
# POST /organizations
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
POST /api/organizations.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name": "some_name",
|
||||
"active": true,
|
||||
"note": "some note",
|
||||
"shared": true
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/organizations.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true,"shared": true,"note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def create
|
||||
@organization = Organization.new(params[:organization])
|
||||
@organization.created_by_id = current_user.id
|
||||
|
||||
if @organization.save
|
||||
render :json => @organization, :status => :created
|
||||
else
|
||||
render :json => @organization.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Organization, params)
|
||||
end
|
||||
|
||||
# PUT /organizations/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
PUT /api/organizations/{id}.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"id": 1
|
||||
"name": "some_name",
|
||||
"active": true,
|
||||
"note": "some note",
|
||||
"shared": true
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/organizations.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"id": 1,"name": "some_name","active": true,"shared": true,"note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def update
|
||||
@organization = Organization.find(params[:id])
|
||||
|
||||
if @organization.update_attributes(params[:organization])
|
||||
render :json => @organization, :status => :ok
|
||||
else
|
||||
render :json => @organization.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Organization, params)
|
||||
end
|
||||
|
||||
# DELETE /organizations/1
|
||||
def destroy
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.destroy
|
||||
=begin
|
||||
|
||||
head :ok
|
||||
Resource:
|
||||
|
||||
Response:
|
||||
|
||||
Test:
|
||||
|
||||
=end
|
||||
|
||||
def destroy
|
||||
model_destory_render(Organization, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,77 +1,156 @@
|
|||
class OverviewsController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /overviews
|
||||
# GET /overviews.json
|
||||
=begin
|
||||
|
||||
Format:
|
||||
JSON
|
||||
|
||||
Example:
|
||||
{
|
||||
"id":1,
|
||||
"name":"some overview",
|
||||
"meta":{"m_a":1,"m_b":2},
|
||||
"condition":{"c_a":1,"c_b":2},
|
||||
"order":{"o_a":1,"o_b":2},
|
||||
"view":{"v_a":1,"v_b":2},
|
||||
"user_id": null,
|
||||
"role_id": null,
|
||||
"updated_at":"2012-09-14T17:51:53Z",
|
||||
"created_at":"2012-09-14T17:51:53Z",
|
||||
"updated_by_id":2.
|
||||
"created_by_id":2,
|
||||
}
|
||||
|
||||
=end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/overviews.json
|
||||
|
||||
Response:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name1",
|
||||
...
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "some_name2",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/overviews.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
@overviews = Overview.all
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render :json => @overviews }
|
||||
end
|
||||
model_index_render(Overview, params)
|
||||
end
|
||||
|
||||
# GET /overviews/1
|
||||
# GET /overviews/1.json
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/overviews/#{id}.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "name_1",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/overviews/#{id}.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def show
|
||||
@overview = Overview.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render :json => @overview }
|
||||
end
|
||||
model_show_render(Overview, params)
|
||||
end
|
||||
|
||||
# GET /overviews/new
|
||||
# GET /overviews/new.json
|
||||
def new
|
||||
@overview = Overview.new
|
||||
=begin
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render :json => @overview }
|
||||
end
|
||||
end
|
||||
Resource:
|
||||
POST /api/overviews.json
|
||||
|
||||
# GET /overviews/1/edit
|
||||
def edit
|
||||
@overview = Overview.find(params[:id])
|
||||
end
|
||||
Payload:
|
||||
{
|
||||
"name":"some overview",
|
||||
"meta":{"m_a":1,"m_b":2},
|
||||
"condition":{"c_a":1,"c_b":2},
|
||||
"order":{"o_a":1,"o_b":2},
|
||||
"view":{"v_a":1,"v_b":2},
|
||||
"user_id": null,
|
||||
"role_id": null,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
# POST /overviews
|
||||
# POST /overviews.json
|
||||
def create
|
||||
@overview = Overview.new(params[:overview])
|
||||
|
||||
respond_to do |format|
|
||||
if @overview.save
|
||||
format.json { render :json => @overview, :status => :created }
|
||||
else
|
||||
format.json { render :json => @overview.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
model_create_render(Overview, params)
|
||||
end
|
||||
|
||||
# PUT /overviews/1
|
||||
# PUT /overviews/1.json
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
PUT /api/overviews/{id}.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name":"some overview",
|
||||
"meta":{"m_a":1,"m_b":2},
|
||||
"condition":{"c_a":1,"c_b":2},
|
||||
"order":{"o_a":1,"o_b":2},
|
||||
"view":{"v_a":1,"v_b":2},
|
||||
"user_id": null,
|
||||
"role_id": null,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def update
|
||||
@overview = Overview.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @overview.update_attributes(params[:overview])
|
||||
format.json { render :json => @overview, :status => :ok }
|
||||
else
|
||||
format.json { render :json => @overview.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
model_update_render(Overview, params)
|
||||
end
|
||||
|
||||
# DELETE /overviews/1
|
||||
# DELETE /overviews/1.json
|
||||
def destroy
|
||||
@overview = Overview.find(params[:id])
|
||||
@overview.destroy
|
||||
=begin
|
||||
|
||||
respond_to do |format|
|
||||
format.json { head :ok }
|
||||
end
|
||||
Resource:
|
||||
DELETE /api/overviews/{id}.json
|
||||
|
||||
Response:
|
||||
{}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/overviews.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE
|
||||
|
||||
=end
|
||||
|
||||
def destroy
|
||||
model_destory_render(Overview, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
class RecentViewedController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /recent_viewed
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/recent_viewed
|
||||
|
||||
Response:
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/recent_viewed.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X GET
|
||||
|
||||
=end
|
||||
|
||||
def recent_viewed
|
||||
recent_viewed = History.recent_viewed_fulldata(current_user)
|
||||
|
||||
# return result
|
||||
render :json => recent_viewed
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -1,55 +1,140 @@
|
|||
class RolesController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /roles
|
||||
=begin
|
||||
|
||||
Format:
|
||||
JSON
|
||||
|
||||
Example:
|
||||
{
|
||||
"id":1,
|
||||
"name":"some role",
|
||||
"note":"some note",
|
||||
"updated_at":"2012-09-14T17:51:53Z",
|
||||
"created_at":"2012-09-14T17:51:53Z",
|
||||
"updated_by_id":2,
|
||||
"created_by_id":2,
|
||||
}
|
||||
|
||||
=end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/roles.json
|
||||
|
||||
Response:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name1",
|
||||
...
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "some_name2",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/roles.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
@roles = Role.all
|
||||
|
||||
render :json => @roles
|
||||
model_index_render(Role, params)
|
||||
end
|
||||
|
||||
# GET /roles/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/roles/#{id}.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "name_1",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/roles/#{id}.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def show
|
||||
@role = Role.find(params[:id])
|
||||
|
||||
render :json => @role
|
||||
model_show_render(Role, params)
|
||||
end
|
||||
|
||||
# GET /roles/new
|
||||
def new
|
||||
@role = Role.new
|
||||
=begin
|
||||
|
||||
render :json => @role
|
||||
end
|
||||
Resource:
|
||||
POST /api/roles.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name": "some name",
|
||||
"note": "",
|
||||
"active":true,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/roles.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
# POST /roles
|
||||
def create
|
||||
@role = Role.new(params[:role])
|
||||
@role.created_by_id = current_user.id
|
||||
|
||||
if @role.save
|
||||
render :json => @role, :status => :created
|
||||
else
|
||||
render :json => @role.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Role, params)
|
||||
end
|
||||
|
||||
# PUT /roles/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
PUT /api/roles/{id}.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name": "some name",
|
||||
"note": "",
|
||||
"active":true,
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/roles.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def update
|
||||
@role = Role.find(params[:id])
|
||||
|
||||
if @role.update_attributes(params[:role])
|
||||
render :json => @role, :status => :ok
|
||||
else
|
||||
render :json => @role.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Role, params)
|
||||
end
|
||||
|
||||
# DELETE /roles/1
|
||||
def destroy
|
||||
@role = Role.find(params[:id])
|
||||
@role.destroy
|
||||
=begin
|
||||
|
||||
head :ok
|
||||
Resource:
|
||||
|
||||
Response:
|
||||
|
||||
Test:
|
||||
|
||||
=end
|
||||
|
||||
def destroy
|
||||
model_destory_render(Role, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,21 @@
|
|||
class RssController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /rss_fetch
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/rss_fetch
|
||||
|
||||
Response:
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/rss_fetch.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X GET
|
||||
|
||||
=end
|
||||
|
||||
def fetch
|
||||
items = RSS.fetch(params[:url], params[:limit])
|
||||
if items == nil
|
||||
|
|
|
@ -100,7 +100,7 @@ class SessionsController < ApplicationController
|
|||
|
||||
render :json => { }
|
||||
end
|
||||
|
||||
|
||||
def create_omniauth
|
||||
auth = request.env['omniauth.auth']
|
||||
|
||||
|
@ -127,13 +127,13 @@ class SessionsController < ApplicationController
|
|||
|
||||
private
|
||||
def default_collections
|
||||
|
||||
|
||||
# auto population of default collections
|
||||
default_collection = {}
|
||||
default_collection['Role'] = Role.all
|
||||
default_collection['Group'] = Group.all
|
||||
default_collection['Organization'] = Organization.all
|
||||
|
||||
|
||||
# load collections to deliver from external files
|
||||
dir = File.expand_path('../', __FILE__)
|
||||
files = Dir.glob( "#{dir}/sessions/collection_*.rb" )
|
||||
|
@ -141,7 +141,7 @@ class SessionsController < ApplicationController
|
|||
load file
|
||||
ExtraCollection.add(default_collection)
|
||||
end
|
||||
|
||||
|
||||
return default_collection
|
||||
end
|
||||
end
|
|
@ -3,45 +3,26 @@ class SettingsController < ApplicationController
|
|||
|
||||
# GET /settings
|
||||
def index
|
||||
@settings = Setting.all
|
||||
|
||||
render :json => @settings
|
||||
model_index_render(Setting, params)
|
||||
end
|
||||
|
||||
# GET /settings/1
|
||||
def show
|
||||
@setting = Setting.find(params[:id])
|
||||
|
||||
render :json => @setting
|
||||
model_show_render(Setting, params)
|
||||
end
|
||||
|
||||
# POST /settings
|
||||
def create
|
||||
@setting = Setting.new(params[:setting])
|
||||
|
||||
if @setting.save
|
||||
render :json => @setting, :status => :created
|
||||
else
|
||||
render :json => @setting.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Setting, params)
|
||||
end
|
||||
|
||||
# PUT /settings/1
|
||||
def update
|
||||
@setting = Setting.find(params[:id])
|
||||
|
||||
if @setting.update_attributes(params[:setting])
|
||||
render :json => @setting, :status => :ok
|
||||
else
|
||||
render :json => @setting.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Setting, params)
|
||||
end
|
||||
|
||||
# DELETE /settings/1
|
||||
def destroy
|
||||
@setting = Setting.find(params[:id])
|
||||
@setting.destroy
|
||||
|
||||
head :ok
|
||||
model_destory_render(Setting, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,48 +1,142 @@
|
|||
class TemplatesController < ApplicationController
|
||||
before_filter :authentication_check
|
||||
|
||||
# GET /templates
|
||||
=begin
|
||||
|
||||
Format:
|
||||
JSON
|
||||
|
||||
Example:
|
||||
{
|
||||
"id":1,
|
||||
"name":"some template",
|
||||
"user_id": null,
|
||||
"options":{"a":1,"b":2},
|
||||
"updated_at":"2012-09-14T17:51:53Z",
|
||||
"created_at":"2012-09-14T17:51:53Z",
|
||||
"updated_by_id":2.
|
||||
"created_by_id":2,
|
||||
}
|
||||
|
||||
=end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/templates.json
|
||||
|
||||
Response:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name1",
|
||||
...
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "some_name2",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/templates.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
@templates = Template.all
|
||||
|
||||
render :json => @templates
|
||||
model_index_render(Template, params)
|
||||
end
|
||||
|
||||
# GET /templates/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/templates/#{id}.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "name_1",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/templates/#{id}.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def show
|
||||
@template = Template.find(params[:id])
|
||||
|
||||
render :json => @template
|
||||
model_show_render(Template, params)
|
||||
end
|
||||
|
||||
# POST /templates
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
POST /api/templates.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name": "some name",
|
||||
"options":{"a":1,"b":2},
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def create
|
||||
@template = Template.new(params[:template])
|
||||
@template.created_by_id = current_user.id
|
||||
|
||||
if @template.save
|
||||
render :json => @template, :status => :created
|
||||
else
|
||||
render :json => @template.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Template, params)
|
||||
end
|
||||
|
||||
# PUT /templates/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
PUT /api/templates/{id}.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"name": "some name",
|
||||
"options":{"a":1,"b":2},
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"name": "some_name",
|
||||
...
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"name": "some_name","active": true, "note": "some note"}'
|
||||
|
||||
=end
|
||||
|
||||
def update
|
||||
@template = Template.find(params[:id])
|
||||
|
||||
if @template.update_attributes(params[:template])
|
||||
render :json => @template, :status => :ok
|
||||
else
|
||||
render :json => @template.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Template, params)
|
||||
end
|
||||
|
||||
# DELETE /templates/1
|
||||
def destroy
|
||||
@template = Template.find(params[:id])
|
||||
@template.destroy
|
||||
=begin
|
||||
|
||||
head :ok
|
||||
Resource:
|
||||
DELETE /api/templates/{id}.json
|
||||
|
||||
Response:
|
||||
{}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/templates.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X DELETE
|
||||
|
||||
=end
|
||||
|
||||
def destroy
|
||||
model_destory_render(Template, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -58,4 +58,101 @@ class TicketArticlesController < ApplicationController
|
|||
|
||||
head :ok
|
||||
end
|
||||
|
||||
|
||||
|
||||
# POST /ticket_attachment/new
|
||||
def attachment_new
|
||||
# puts '-------'
|
||||
# puts params.inspect
|
||||
|
||||
# store file
|
||||
# content_type = request.content_type
|
||||
content_type = request[:content_type]
|
||||
puts 'content_type: ' + content_type.inspect
|
||||
if !content_type || content_type == 'application/octet-stream'
|
||||
if MIME::Types.type_for(params[:qqfile]).first
|
||||
content_type = MIME::Types.type_for(params[:qqfile]).first.content_type
|
||||
else
|
||||
content_type = 'application/octet-stream'
|
||||
end
|
||||
end
|
||||
headers_store = {
|
||||
'Content-Type' => content_type
|
||||
}
|
||||
Store.add(
|
||||
:object => 'UploadCache::' + params[:form] + '::' + current_user.id.to_s,
|
||||
:o_id => params[:form_id],
|
||||
:data => request.body.read,
|
||||
:filename => params[:qqfile],
|
||||
:preferences => headers_store
|
||||
)
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:success => true,
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_attachment/1
|
||||
def attachment
|
||||
|
||||
# permissin check
|
||||
ticket = Ticket.find( params[:ticket_id] )
|
||||
if !ticket_permission(ticket)
|
||||
render( :json => 'No such ticket.', :status => :unauthorized )
|
||||
return
|
||||
end
|
||||
article = Ticket::Article.find( params[:article_id] )
|
||||
if ticket.id != article.ticket_id
|
||||
render( :json => 'No access, article_id/ticket_id is not matching.', :status => :unauthorized )
|
||||
return
|
||||
end
|
||||
|
||||
list = Store.list( :object => 'Ticket::Article', :o_id => params[:article_id] ) || []
|
||||
access = false
|
||||
list.each {|item|
|
||||
if item.id.to_i == params[:id].to_i
|
||||
access = true
|
||||
end
|
||||
}
|
||||
if !access
|
||||
render( :json => 'Requested file id is not linked with article_id.', :status => :unauthorized )
|
||||
return
|
||||
end
|
||||
|
||||
# find file
|
||||
file = Store.find(params[:id])
|
||||
send_data(
|
||||
file.store_file.data,
|
||||
:filename => file.filename,
|
||||
:type => file.preferences['Content-Type'] || file.preferences['Mime-Type'],
|
||||
:disposition => 'inline'
|
||||
)
|
||||
end
|
||||
|
||||
# GET /ticket_article_plain/1
|
||||
def article_plain
|
||||
|
||||
# permissin check
|
||||
article = Ticket::Article.find( params[:id] )
|
||||
return if !ticket_permission( article.ticket )
|
||||
|
||||
list = Store.list(
|
||||
:object => 'Ticket::Article::Mail',
|
||||
:o_id => params[:id],
|
||||
)
|
||||
|
||||
# find file
|
||||
if list
|
||||
file = Store.find(list.first)
|
||||
send_data(
|
||||
file.store_file.data,
|
||||
:filename => file.filename,
|
||||
:type => 'message/rfc822',
|
||||
:disposition => 'inline'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -93,432 +93,4 @@ class TicketOverviewsController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
|
||||
# GET /ticket_create/1
|
||||
def ticket_create
|
||||
|
||||
# get attributes
|
||||
create_attributes = Ticket.create_attributes(
|
||||
:current_user_id => current_user.id,
|
||||
)
|
||||
|
||||
# split data
|
||||
ticket = nil
|
||||
articles = nil
|
||||
users = {}
|
||||
if params[:ticket_id] && params[:article_id]
|
||||
ticket = Ticket.find( params[:ticket_id] )
|
||||
|
||||
# get related users
|
||||
if !users[ticket.owner_id]
|
||||
users[ticket.owner_id] = User.user_data_full(ticket.owner_id)
|
||||
end
|
||||
if !users[ticket.customer_id]
|
||||
users[ticket.customer_id] = User.user_data_full(ticket.customer_id)
|
||||
end
|
||||
if !users[ticket.created_by_id]
|
||||
users[ticket.created_by_id] = User.user_data_full(ticket.created_by_id)
|
||||
end
|
||||
|
||||
owner_ids = []
|
||||
ticket.agent_of_group.each { |user|
|
||||
owner_ids.push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
|
||||
# get related articles
|
||||
ticket[:article_ids] = [ params[:article_id] ]
|
||||
|
||||
article = Ticket::Article.find( params[:article_id] )
|
||||
|
||||
# add attachment list to article
|
||||
article['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => article.id )
|
||||
|
||||
# load users
|
||||
if !users[article.created_by_id]
|
||||
users[article.created_by_id] = User.user_data_full(article.created_by_id)
|
||||
end
|
||||
end
|
||||
|
||||
create_attributes[:owner_id].each {|user_id|
|
||||
if !users[user_id]
|
||||
users[user_id] = User.user_data_full(user_id)
|
||||
end
|
||||
}
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:ticket => ticket,
|
||||
:articles => [ article ],
|
||||
:users => users,
|
||||
:edit_form => create_attributes,
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_full/1
|
||||
def ticket_full
|
||||
|
||||
# permission check
|
||||
ticket = Ticket.find(params[:id])
|
||||
return if !ticket_permission(ticket)
|
||||
|
||||
# get related users
|
||||
users = {}
|
||||
if !users[ticket.owner_id]
|
||||
users[ticket.owner_id] = User.user_data_full(ticket.owner_id)
|
||||
end
|
||||
if !users[ticket.customer_id]
|
||||
users[ticket.customer_id] = User.user_data_full(ticket.customer_id)
|
||||
end
|
||||
if !users[ticket.created_by_id]
|
||||
users[ticket.created_by_id] = User.user_data_full(ticket.created_by_id)
|
||||
end
|
||||
|
||||
owner_ids = []
|
||||
ticket.agent_of_group.each { |user|
|
||||
owner_ids.push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
|
||||
# log object as viewed
|
||||
log_view(ticket)
|
||||
|
||||
# get related articles
|
||||
ticket = ticket.attributes
|
||||
ticket[:article_ids] = []
|
||||
articles = Ticket::Article.where( :ticket_id => params[:id] )
|
||||
|
||||
# get related users
|
||||
articles_used = []
|
||||
articles.each {|article|
|
||||
|
||||
# ignore internal article if customer is requesting
|
||||
next if article.internal == true && is_role('Customer')
|
||||
article_tmp = article.attributes
|
||||
|
||||
# load article ids
|
||||
ticket[:article_ids].push article_tmp['id']
|
||||
|
||||
# add attachment list to article
|
||||
article_tmp['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => article.id )
|
||||
|
||||
# remember article
|
||||
articles_used.push article_tmp
|
||||
|
||||
# load users
|
||||
if !users[article.created_by_id]
|
||||
users[article.created_by_id] = User.user_data_full(article.created_by_id)
|
||||
end
|
||||
}
|
||||
|
||||
# get groups
|
||||
group_ids = []
|
||||
Group.where( :active => true ).each { |group|
|
||||
group_ids.push group.id
|
||||
}
|
||||
agents = {}
|
||||
Ticket.agents.each { |user|
|
||||
agents[ user.id ] = 1
|
||||
}
|
||||
groups_users = {}
|
||||
group_ids.each {|group_id|
|
||||
groups_users[ group_id ] = []
|
||||
Group.find(group_id).users.each {|user|
|
||||
next if !agents[ user.id ]
|
||||
groups_users[ group_id ].push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:ticket => ticket,
|
||||
:articles => articles_used,
|
||||
:users => users,
|
||||
:edit_form => {
|
||||
:group_id__owner_id => groups_users,
|
||||
:owner_id => owner_ids,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
# POST /ticket_attachment/new
|
||||
def ticket_attachment_new
|
||||
# puts '-------'
|
||||
# puts params.inspect
|
||||
|
||||
# store file
|
||||
# content_type = request.content_type
|
||||
content_type = request[:content_type]
|
||||
puts 'content_type: ' + content_type.inspect
|
||||
if !content_type || content_type == 'application/octet-stream'
|
||||
if MIME::Types.type_for(params[:qqfile]).first
|
||||
content_type = MIME::Types.type_for(params[:qqfile]).first.content_type
|
||||
else
|
||||
content_type = 'application/octet-stream'
|
||||
end
|
||||
end
|
||||
headers_store = {
|
||||
'Content-Type' => content_type
|
||||
}
|
||||
Store.add(
|
||||
:object => 'UploadCache::' + params[:form] + '::' + current_user.id.to_s,
|
||||
:o_id => params[:form_id],
|
||||
:data => request.body.read,
|
||||
:filename => params[:qqfile],
|
||||
:preferences => headers_store
|
||||
)
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:success => true,
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_attachment/1
|
||||
def ticket_attachment
|
||||
|
||||
# permissin check
|
||||
ticket = Ticket.find( params[:ticket_id] )
|
||||
if !ticket_permission(ticket)
|
||||
render( :json => 'No such ticket.', :status => :unauthorized )
|
||||
return
|
||||
end
|
||||
article = Ticket::Article.find( params[:article_id] )
|
||||
if ticket.id != article.ticket_id
|
||||
render( :json => 'No access, article_id/ticket_id is not matching.', :status => :unauthorized )
|
||||
return
|
||||
end
|
||||
|
||||
list = Store.list( :object => 'Ticket::Article', :o_id => params[:article_id] ) || []
|
||||
access = false
|
||||
list.each {|item|
|
||||
if item.id.to_i == params[:id].to_i
|
||||
access = true
|
||||
end
|
||||
}
|
||||
if !access
|
||||
render( :json => 'Requested file id is not linked with article_id.', :status => :unauthorized )
|
||||
return
|
||||
end
|
||||
|
||||
# find file
|
||||
file = Store.find(params[:id])
|
||||
send_data(
|
||||
file.store_file.data,
|
||||
:filename => file.filename,
|
||||
:type => file.preferences['Content-Type'] || file.preferences['Mime-Type'],
|
||||
:disposition => 'inline'
|
||||
)
|
||||
end
|
||||
|
||||
# GET /ticket_article_plain/1
|
||||
def ticket_article_plain
|
||||
|
||||
# permissin check
|
||||
article = Ticket::Article.find( params[:id] )
|
||||
return if !ticket_permission( article.ticket )
|
||||
|
||||
list = Store.list(
|
||||
:object => 'Ticket::Article::Mail',
|
||||
:o_id => params[:id],
|
||||
)
|
||||
|
||||
# find file
|
||||
if list
|
||||
file = Store.find(list.first)
|
||||
send_data(
|
||||
file.store_file.data,
|
||||
:filename => file.filename,
|
||||
:type => 'message/rfc822',
|
||||
:disposition => 'inline'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# GET /ticket_customer
|
||||
# GET /tickets_customer
|
||||
def ticket_customer
|
||||
|
||||
# get closed/open states
|
||||
ticket_state_list_open = Ticket::State.where(
|
||||
:ticket_state_type_id => Ticket::StateType.where(:name => ['new','open', 'pending remidner', 'pending action'])
|
||||
)
|
||||
ticket_state_list_closed = Ticket::State.where(
|
||||
:ticket_state_type_id => Ticket::StateType.where(:name => ['closed'] )
|
||||
)
|
||||
|
||||
# get tickets
|
||||
tickets_open = Ticket.where(
|
||||
:customer_id => params[:customer_id],
|
||||
:ticket_state_id => ticket_state_list_open
|
||||
).limit(15).order('created_at DESC')
|
||||
|
||||
tickets_closed = Ticket.where(
|
||||
:customer_id => params[:customer_id],
|
||||
:ticket_state_id => ticket_state_list_closed
|
||||
).limit(15).order('created_at DESC')
|
||||
|
||||
# tickets = Ticket.where(:customer_id => user_id).limit(15).order('created_at DESC')
|
||||
# ticket_items = []
|
||||
# tickets.each do |ticket|
|
||||
# style = ''
|
||||
# ticket_state_type = ticket.ticket_state.ticket_state_type.name
|
||||
# if ticket_state_type == 'closed' || ticket_state_type == 'merged'
|
||||
# style = 'text-decoration: line-through'
|
||||
# end
|
||||
# item = {
|
||||
# :url => '#ticket/zoom/' + ticket.id.to_s,
|
||||
# :name => 'T:' + ticket.number.to_s,
|
||||
# :title => ticket.title,
|
||||
# :style => style
|
||||
# }
|
||||
# ticket_items.push item
|
||||
# end
|
||||
# if ticket_items[0]
|
||||
# topic = {
|
||||
# :title => 'Tickets',
|
||||
# :items => ticket_items
|
||||
# }
|
||||
# user['links'].push topic
|
||||
# end
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:tickets => {
|
||||
:open => tickets_open,
|
||||
:closed => tickets_closed
|
||||
}
|
||||
# :users => users,
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_history/1
|
||||
def ticket_history
|
||||
|
||||
# get ticket data
|
||||
ticket = Ticket.find(params[:id])
|
||||
|
||||
# permissin check
|
||||
return if !ticket_permission(ticket)
|
||||
|
||||
# get history of ticket
|
||||
history = History.history_list( 'Ticket', params[:id], 'Ticket::Article' )
|
||||
|
||||
# get related users
|
||||
users = {}
|
||||
history.each do |item|
|
||||
users[ item['created_by_id'] ] = User.user_data_full( item['created_by_id'] )
|
||||
if item['history_object'] == 'Ticket::Article'
|
||||
item['type'] = 'Article ' + item['type'].to_s
|
||||
else
|
||||
item['type'] = 'Ticket ' + item['type'].to_s
|
||||
end
|
||||
end
|
||||
|
||||
# fetch meta relations
|
||||
history_objects = History::Object.all()
|
||||
history_types = History::Type.all()
|
||||
history_attributes = History::Attribute.all()
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:ticket => ticket,
|
||||
:users => users,
|
||||
:history => history,
|
||||
:history_objects => history_objects,
|
||||
:history_types => history_types,
|
||||
:history_attributes => history_attributes
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_merge/1/1
|
||||
def ticket_merge
|
||||
|
||||
# check master ticket
|
||||
ticket_master = Ticket.where( :number => params[:master_ticket_number] ).first
|
||||
if !ticket_master
|
||||
render :json => {
|
||||
:result => 'faild',
|
||||
:message => 'No such master ticket number!',
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
# permissin check
|
||||
return if !ticket_permission(ticket_master)
|
||||
|
||||
# check slave ticket
|
||||
ticket_slave = Ticket.where( :id => params[:slave_ticket_id] ).first
|
||||
if !ticket_slave
|
||||
render :json => {
|
||||
:result => 'faild',
|
||||
:message => 'No such slave ticket!',
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
# permissin check
|
||||
return if !ticket_permission(ticket_slave)
|
||||
|
||||
# check diffetent ticket ids
|
||||
if ticket_slave.id == ticket_master.id
|
||||
render :json => {
|
||||
:result => 'faild',
|
||||
:message => 'Can\'t merge ticket with it self!',
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
# merge ticket
|
||||
success = ticket_slave.merge_to(
|
||||
{
|
||||
:ticket_id => ticket_master.id,
|
||||
:created_by_id => current_user.id,
|
||||
}
|
||||
)
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:result => 'success',
|
||||
:master_ticket => ticket_master.attributes,
|
||||
:slave_ticket => ticket_slave.attributes,
|
||||
}
|
||||
end
|
||||
|
||||
# GET /user_search
|
||||
def user_search
|
||||
|
||||
# get params
|
||||
query = params[:term]
|
||||
limit = params[:limit] || 18
|
||||
|
||||
# do query
|
||||
user_all = User.find(
|
||||
:all,
|
||||
:limit => limit,
|
||||
:conditions => ['firstname LIKE ? or lastname LIKE ? or email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%"],
|
||||
:order => 'firstname'
|
||||
)
|
||||
|
||||
# build result list
|
||||
users = []
|
||||
user_all.each do |user|
|
||||
realname = user.firstname.to_s + ' ' + user.lastname.to_s
|
||||
if user.email && user.email.to_s != ''
|
||||
realname = realname + ' <' + user.email.to_s + '>'
|
||||
end
|
||||
a = { :id => user.id, :label => realname, :value => realname }
|
||||
users.push a
|
||||
end
|
||||
|
||||
# return result
|
||||
render :json => users
|
||||
end
|
||||
end
|
|
@ -3,45 +3,26 @@ class TicketPrioritiesController < ApplicationController
|
|||
|
||||
# GET /ticket_priorities
|
||||
def index
|
||||
@ticket_priorities = Ticket::Priority.all
|
||||
|
||||
render :json => @ticket_priorities
|
||||
model_index_render(Ticket::Priority, params)
|
||||
end
|
||||
|
||||
# GET /ticket_priorities/1
|
||||
def show
|
||||
@ticket_priority = Ticket::Priority.find(params[:id])
|
||||
|
||||
render :json => @ticket_priority
|
||||
model_show_render(Ticket::Priority, params)
|
||||
end
|
||||
|
||||
# POST /ticket_priorities
|
||||
def create
|
||||
@ticket_priority = Ticket::Priority.new(params[:ticket_priority])
|
||||
|
||||
if @ticket_priority.save
|
||||
render :json => @ticket_priority, :status => :created
|
||||
else
|
||||
render :json => @ticket_priority.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Ticket::Priority, params)
|
||||
end
|
||||
|
||||
# PUT /ticket_priorities/1
|
||||
def update
|
||||
@ticket_priority = Ticket::Priority.find(params[:id])
|
||||
|
||||
if @ticket_priority.update_attributes(params[:ticket_priority])
|
||||
render :json => @ticket_priority, :status => :ok
|
||||
else
|
||||
render :json => @ticket_priority.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Ticket::Priority, params)
|
||||
end
|
||||
|
||||
# DELETE /ticket_priorities/1
|
||||
def destroy
|
||||
@ticket_priority = Ticket::Priority.find(params[:id])
|
||||
@ticket_priority.destroy
|
||||
|
||||
head :ok
|
||||
model_destory_render(Ticket::Priority, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,45 +3,26 @@ class TicketStatesController < ApplicationController
|
|||
|
||||
# GET /ticket_states
|
||||
def index
|
||||
@ticket_states = Ticket::State.all
|
||||
|
||||
render :json => @ticket_states
|
||||
model_index_render(Ticket::State, params)
|
||||
end
|
||||
|
||||
# GET /ticket_states/1
|
||||
def show
|
||||
@ticket_state = Ticket::State.find(params[:id])
|
||||
|
||||
render :json => @ticket_state
|
||||
model_show_render(Ticket::State, params)
|
||||
end
|
||||
|
||||
# POST /ticket_states
|
||||
def create
|
||||
@ticket_state = Ticket::State.new(params[:ticket_state])
|
||||
|
||||
if @ticket_state.save
|
||||
render :json => @ticket_state, :status => :created
|
||||
else
|
||||
render :json => @ticket_state.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Ticket::State, params)
|
||||
end
|
||||
|
||||
# PUT /ticket_states/1
|
||||
def update
|
||||
@ticket_state = Ticket::State.find(params[:id])
|
||||
|
||||
if @ticket_state.update_attributes(params[:ticket_state])
|
||||
render :json => @ticket_state, :status => :ok
|
||||
else
|
||||
render :json => @ticket_state.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Ticket::State, params)
|
||||
end
|
||||
|
||||
# DELETE /ticket_states/1
|
||||
def destroy
|
||||
@ticket_state = Ticket::State.find(params[:id])
|
||||
@ticket_state.destroy
|
||||
|
||||
head :ok
|
||||
model_destory_render(Ticket::State, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,4 +86,311 @@ class TicketsController < ApplicationController
|
|||
|
||||
head :ok
|
||||
end
|
||||
|
||||
|
||||
|
||||
# GET /ticket_customer
|
||||
# GET /tickets_customer
|
||||
def ticket_customer
|
||||
|
||||
# get closed/open states
|
||||
ticket_state_list_open = Ticket::State.where(
|
||||
:ticket_state_type_id => Ticket::StateType.where(:name => ['new','open', 'pending remidner', 'pending action'])
|
||||
)
|
||||
ticket_state_list_closed = Ticket::State.where(
|
||||
:ticket_state_type_id => Ticket::StateType.where(:name => ['closed'] )
|
||||
)
|
||||
|
||||
# get tickets
|
||||
tickets_open = Ticket.where(
|
||||
:customer_id => params[:customer_id],
|
||||
:ticket_state_id => ticket_state_list_open
|
||||
).limit(15).order('created_at DESC')
|
||||
|
||||
tickets_closed = Ticket.where(
|
||||
:customer_id => params[:customer_id],
|
||||
:ticket_state_id => ticket_state_list_closed
|
||||
).limit(15).order('created_at DESC')
|
||||
|
||||
# tickets = Ticket.where(:customer_id => user_id).limit(15).order('created_at DESC')
|
||||
# ticket_items = []
|
||||
# tickets.each do |ticket|
|
||||
# style = ''
|
||||
# ticket_state_type = ticket.ticket_state.ticket_state_type.name
|
||||
# if ticket_state_type == 'closed' || ticket_state_type == 'merged'
|
||||
# style = 'text-decoration: line-through'
|
||||
# end
|
||||
# item = {
|
||||
# :url => '#ticket/zoom/' + ticket.id.to_s,
|
||||
# :name => 'T:' + ticket.number.to_s,
|
||||
# :title => ticket.title,
|
||||
# :style => style
|
||||
# }
|
||||
# ticket_items.push item
|
||||
# end
|
||||
# if ticket_items[0]
|
||||
# topic = {
|
||||
# :title => 'Tickets',
|
||||
# :items => ticket_items
|
||||
# }
|
||||
# user['links'].push topic
|
||||
# end
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:tickets => {
|
||||
:open => tickets_open,
|
||||
:closed => tickets_closed
|
||||
}
|
||||
# :users => users,
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_history/1
|
||||
def ticket_history
|
||||
|
||||
# get ticket data
|
||||
ticket = Ticket.find(params[:id])
|
||||
|
||||
# permissin check
|
||||
return if !ticket_permission(ticket)
|
||||
|
||||
# get history of ticket
|
||||
history = History.history_list( 'Ticket', params[:id], 'Ticket::Article' )
|
||||
|
||||
# get related users
|
||||
users = {}
|
||||
history.each do |item|
|
||||
users[ item['created_by_id'] ] = User.user_data_full( item['created_by_id'] )
|
||||
if item['history_object'] == 'Ticket::Article'
|
||||
item['type'] = 'Article ' + item['type'].to_s
|
||||
else
|
||||
item['type'] = 'Ticket ' + item['type'].to_s
|
||||
end
|
||||
end
|
||||
|
||||
# fetch meta relations
|
||||
history_objects = History::Object.all()
|
||||
history_types = History::Type.all()
|
||||
history_attributes = History::Attribute.all()
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:ticket => ticket,
|
||||
:users => users,
|
||||
:history => history,
|
||||
:history_objects => history_objects,
|
||||
:history_types => history_types,
|
||||
:history_attributes => history_attributes
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_merge/1/1
|
||||
def ticket_merge
|
||||
|
||||
# check master ticket
|
||||
ticket_master = Ticket.where( :number => params[:master_ticket_number] ).first
|
||||
if !ticket_master
|
||||
render :json => {
|
||||
:result => 'faild',
|
||||
:message => 'No such master ticket number!',
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
# permissin check
|
||||
return if !ticket_permission(ticket_master)
|
||||
|
||||
# check slave ticket
|
||||
ticket_slave = Ticket.where( :id => params[:slave_ticket_id] ).first
|
||||
if !ticket_slave
|
||||
render :json => {
|
||||
:result => 'faild',
|
||||
:message => 'No such slave ticket!',
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
# permissin check
|
||||
return if !ticket_permission(ticket_slave)
|
||||
|
||||
# check diffetent ticket ids
|
||||
if ticket_slave.id == ticket_master.id
|
||||
render :json => {
|
||||
:result => 'faild',
|
||||
:message => 'Can\'t merge ticket with it self!',
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
# merge ticket
|
||||
success = ticket_slave.merge_to(
|
||||
{
|
||||
:ticket_id => ticket_master.id,
|
||||
:created_by_id => current_user.id,
|
||||
}
|
||||
)
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:result => 'success',
|
||||
:master_ticket => ticket_master.attributes,
|
||||
:slave_ticket => ticket_slave.attributes,
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_full/1
|
||||
def ticket_full
|
||||
|
||||
# permission check
|
||||
ticket = Ticket.find(params[:id])
|
||||
return if !ticket_permission(ticket)
|
||||
|
||||
# get related users
|
||||
users = {}
|
||||
if !users[ticket.owner_id]
|
||||
users[ticket.owner_id] = User.user_data_full(ticket.owner_id)
|
||||
end
|
||||
if !users[ticket.customer_id]
|
||||
users[ticket.customer_id] = User.user_data_full(ticket.customer_id)
|
||||
end
|
||||
if !users[ticket.created_by_id]
|
||||
users[ticket.created_by_id] = User.user_data_full(ticket.created_by_id)
|
||||
end
|
||||
|
||||
owner_ids = []
|
||||
ticket.agent_of_group.each { |user|
|
||||
owner_ids.push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
|
||||
# log object as viewed
|
||||
log_view(ticket)
|
||||
|
||||
# get related articles
|
||||
ticket = ticket.attributes
|
||||
ticket[:article_ids] = []
|
||||
articles = Ticket::Article.where( :ticket_id => params[:id] )
|
||||
|
||||
# get related users
|
||||
articles_used = []
|
||||
articles.each {|article|
|
||||
|
||||
# ignore internal article if customer is requesting
|
||||
next if article.internal == true && is_role('Customer')
|
||||
article_tmp = article.attributes
|
||||
|
||||
# load article ids
|
||||
ticket[:article_ids].push article_tmp['id']
|
||||
|
||||
# add attachment list to article
|
||||
article_tmp['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => article.id )
|
||||
|
||||
# remember article
|
||||
articles_used.push article_tmp
|
||||
|
||||
# load users
|
||||
if !users[article.created_by_id]
|
||||
users[article.created_by_id] = User.user_data_full(article.created_by_id)
|
||||
end
|
||||
}
|
||||
|
||||
# get groups
|
||||
group_ids = []
|
||||
Group.where( :active => true ).each { |group|
|
||||
group_ids.push group.id
|
||||
}
|
||||
agents = {}
|
||||
Ticket.agents.each { |user|
|
||||
agents[ user.id ] = 1
|
||||
}
|
||||
groups_users = {}
|
||||
group_ids.each {|group_id|
|
||||
groups_users[ group_id ] = []
|
||||
Group.find(group_id).users.each {|user|
|
||||
next if !agents[ user.id ]
|
||||
groups_users[ group_id ].push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:ticket => ticket,
|
||||
:articles => articles_used,
|
||||
:users => users,
|
||||
:edit_form => {
|
||||
:group_id__owner_id => groups_users,
|
||||
:owner_id => owner_ids,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
# GET /ticket_create/1
|
||||
def ticket_create
|
||||
|
||||
# get attributes
|
||||
create_attributes = Ticket.create_attributes(
|
||||
:current_user_id => current_user.id,
|
||||
)
|
||||
|
||||
# split data
|
||||
ticket = nil
|
||||
articles = nil
|
||||
users = {}
|
||||
if params[:ticket_id] && params[:article_id]
|
||||
ticket = Ticket.find( params[:ticket_id] )
|
||||
|
||||
# get related users
|
||||
if !users[ticket.owner_id]
|
||||
users[ticket.owner_id] = User.user_data_full(ticket.owner_id)
|
||||
end
|
||||
if !users[ticket.customer_id]
|
||||
users[ticket.customer_id] = User.user_data_full(ticket.customer_id)
|
||||
end
|
||||
if !users[ticket.created_by_id]
|
||||
users[ticket.created_by_id] = User.user_data_full(ticket.created_by_id)
|
||||
end
|
||||
|
||||
owner_ids = []
|
||||
ticket.agent_of_group.each { |user|
|
||||
owner_ids.push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
|
||||
# get related articles
|
||||
ticket[:article_ids] = [ params[:article_id] ]
|
||||
|
||||
article = Ticket::Article.find( params[:article_id] )
|
||||
|
||||
# add attachment list to article
|
||||
article['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => article.id )
|
||||
|
||||
# load users
|
||||
if !users[article.created_by_id]
|
||||
users[article.created_by_id] = User.user_data_full(article.created_by_id)
|
||||
end
|
||||
end
|
||||
|
||||
create_attributes[:owner_id].each {|user_id|
|
||||
if !users[user_id]
|
||||
users[user_id] = User.user_data_full(user_id)
|
||||
end
|
||||
}
|
||||
|
||||
# return result
|
||||
render :json => {
|
||||
:ticket => ticket,
|
||||
:articles => [ article ],
|
||||
:users => users,
|
||||
:edit_form => create_attributes,
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -20,45 +20,26 @@ class TranslationsController < ApplicationController
|
|||
|
||||
# GET /translations
|
||||
def index
|
||||
@translations = Translation.all
|
||||
|
||||
render :json => @translations
|
||||
model_index_render(Translation, params)
|
||||
end
|
||||
|
||||
# GET /translations/1
|
||||
def show
|
||||
@translation = Translation.find(params[:id])
|
||||
|
||||
render :json => @translation
|
||||
model_show_render(Translation, params)
|
||||
end
|
||||
|
||||
# POST /translations
|
||||
def create
|
||||
@translation = Translation.new(params[:translation])
|
||||
|
||||
if @translation.save
|
||||
render :json => @translation, :status => :created
|
||||
else
|
||||
render :json => @translation.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_create_render(Translation, params)
|
||||
end
|
||||
|
||||
# PUT /translations/1
|
||||
def update
|
||||
@translation = Translation.find(params[:id])
|
||||
|
||||
if @translation.update_attributes(params[:translation])
|
||||
render :json => @translation, :status => :ok
|
||||
else
|
||||
render :json => @translation.errors, :status => :unprocessable_entity
|
||||
end
|
||||
model_update_render(Translation, params)
|
||||
end
|
||||
|
||||
# DELETE /translations/1
|
||||
def destroy
|
||||
@translation = Translation.find(params[:id])
|
||||
@translation.destroy
|
||||
|
||||
head :ok
|
||||
model_destory_render(Translation, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,30 +1,128 @@
|
|||
class UsersController < ApplicationController
|
||||
before_filter :authentication_check, :except => [:create, :password_reset_send, :password_reset_verify]
|
||||
|
||||
# GET /users
|
||||
=begin
|
||||
|
||||
Format:
|
||||
JSON
|
||||
|
||||
Example:
|
||||
{
|
||||
"id":2,
|
||||
"organization_id":null,
|
||||
"login":"m@edenhofer.de",
|
||||
"firstname":"Marti",
|
||||
"lastname":"Ede",
|
||||
"email":"m@edenhofer.de",
|
||||
"image":"http://www.gravatar.com/avatar/1c38b099f2344976005de69965733465?s=48",
|
||||
"web":"http://127.0.0.1",
|
||||
"password":"123",
|
||||
"phone":"112",
|
||||
"fax":"211",
|
||||
"mobile":"",
|
||||
"street":"",
|
||||
"zip":"",
|
||||
"city":"",
|
||||
"country":null,
|
||||
"verified":false,
|
||||
"active":true,
|
||||
"note":"some note",
|
||||
"source":null,
|
||||
"role_ids":[1,2],
|
||||
"group_ids":[1,2,3,4],
|
||||
}
|
||||
|
||||
=end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/users.json
|
||||
|
||||
Response:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"login": "some_login1",
|
||||
...
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"login": "some_login2",
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/users.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def index
|
||||
@users = User.all
|
||||
@users_all = []
|
||||
@users.each {|user|
|
||||
@users_all.push User.user_data_full( user.id )
|
||||
users = User.all
|
||||
users_all = []
|
||||
users.each {|user|
|
||||
users_all.push User.user_data_full( user.id )
|
||||
}
|
||||
render :json => @users_all
|
||||
render :json => users_all
|
||||
end
|
||||
|
||||
# GET /users/1
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
GET /api/users/1.json
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"login": "some_login1",
|
||||
...
|
||||
},
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/users/#{id}.json -v -u #{login}:#{password}
|
||||
|
||||
=end
|
||||
|
||||
def show
|
||||
@user = User.user_data_full( params[:id] )
|
||||
render :json => @user
|
||||
user = User.user_data_full( params[:id] )
|
||||
render :json => user
|
||||
end
|
||||
|
||||
# POST /users
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
POST /api/users.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"login": "some_login",
|
||||
"firstname": "some firstname",
|
||||
"lastname": "some lastname",
|
||||
"email": "some@example.com"
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 1,
|
||||
"login": "some_login",
|
||||
...
|
||||
},
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/users.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"login": "some_login","firstname": "some firstname","lastname": "some lastname","email": "some@example.com"}'
|
||||
|
||||
=end
|
||||
|
||||
def create
|
||||
@user = User.new(params[:user])
|
||||
@user.created_by_id = (current_user && current_user.id) || 1
|
||||
if @user.save
|
||||
user = User.new( User.param_cleanup(params) )
|
||||
user.created_by_id = (current_user && current_user.id) || 1
|
||||
|
||||
begin
|
||||
user.save
|
||||
|
||||
# if it's a signup, add user to customer role
|
||||
if @user.created_by_id == 1
|
||||
if user.created_by_id == 1
|
||||
|
||||
# check if it's first user
|
||||
count = User.all.count()
|
||||
|
@ -44,16 +142,16 @@ class UsersController < ApplicationController
|
|||
else
|
||||
role_ids.push Role.where( :name => 'Customer' ).first.id
|
||||
end
|
||||
@user.role_ids = role_ids
|
||||
@user.group_ids = group_ids
|
||||
user.role_ids = role_ids
|
||||
user.group_ids = group_ids
|
||||
|
||||
# else do assignment as defined
|
||||
else
|
||||
if params[:role_ids]
|
||||
@user.role_ids = params[:role_ids]
|
||||
user.role_ids = params[:role_ids]
|
||||
end
|
||||
if params[:group_ids]
|
||||
@user.group_ids = params[:group_ids]
|
||||
user.group_ids = params[:group_ids]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -63,43 +161,113 @@ class UsersController < ApplicationController
|
|||
# logger.debug('IIIIIIIIIIIIIIIIIIIIIIIIIIIIII')
|
||||
# exit '123'
|
||||
end
|
||||
render :json => @user, :status => :created
|
||||
else
|
||||
render :json => @user.errors, :status => :unprocessable_entity
|
||||
render :json => user, :status => :created
|
||||
rescue Exception => e
|
||||
render :json => { :error => e.message }, :status => :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /users/1
|
||||
def update
|
||||
@user = User.find(params[:id])
|
||||
=begin
|
||||
|
||||
if @user.update_attributes(params[:user])
|
||||
Resource:
|
||||
PUT /api/users/#{id}.json
|
||||
|
||||
Payload:
|
||||
{
|
||||
"login": "some_login",
|
||||
"firstname": "some firstname",
|
||||
"lastname": "some lastname",
|
||||
"email": "some@example.com"
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
"id": 2,
|
||||
"login": "some_login",
|
||||
...
|
||||
},
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/users/2.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X PUT -d '{"login": "some_login","firstname": "some firstname","lastname": "some lastname","email": "some@example.com"}'
|
||||
|
||||
=end
|
||||
|
||||
def update
|
||||
user = User.find(params[:id])
|
||||
|
||||
begin
|
||||
user.update_attributes( User.param_cleanup(params) )
|
||||
if params[:role_ids]
|
||||
@user.role_ids = params[:role_ids]
|
||||
user.role_ids = params[:role_ids]
|
||||
end
|
||||
if params[:group_ids]
|
||||
@user.group_ids = params[:group_ids]
|
||||
user.group_ids = params[:group_ids]
|
||||
end
|
||||
if params[:organization_ids]
|
||||
@user.organization_ids = params[:organization_ids]
|
||||
user.organization_ids = params[:organization_ids]
|
||||
end
|
||||
|
||||
@user = User.user_data_full( params[:id] )
|
||||
render :json => @user, :status => :ok
|
||||
else
|
||||
render :json => @user.errors, :status => :unprocessable_entity
|
||||
user = User.user_data_full( params[:id] )
|
||||
render :json => user, :status => :ok
|
||||
rescue Exception => e
|
||||
render :json => { :error => e.message }, :status => :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /users/1
|
||||
def destroy
|
||||
@user = User.find(params[:id])
|
||||
@user.destroy
|
||||
|
||||
head :ok
|
||||
model_destory_render(User, params)
|
||||
end
|
||||
|
||||
# POST /users/reset_password
|
||||
# GET /user/search
|
||||
def search
|
||||
|
||||
# get params
|
||||
query = params[:term]
|
||||
limit = params[:limit] || 18
|
||||
|
||||
# do query
|
||||
user_all = User.find(
|
||||
:all,
|
||||
:limit => limit,
|
||||
:conditions => ['firstname LIKE ? or lastname LIKE ? or email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%"],
|
||||
:order => 'firstname'
|
||||
)
|
||||
|
||||
# build result list
|
||||
users = []
|
||||
user_all.each do |user|
|
||||
realname = user.firstname.to_s + ' ' + user.lastname.to_s
|
||||
if user.email && user.email.to_s != ''
|
||||
realname = realname + ' <' + user.email.to_s + '>'
|
||||
end
|
||||
a = { :id => user.id, :label => realname, :value => realname }
|
||||
users.push a
|
||||
end
|
||||
|
||||
# return result
|
||||
render :json => users
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
POST /api/users/password_reset
|
||||
|
||||
Payload:
|
||||
{
|
||||
"username": "some user name"
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
:message => 'ok'
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/users/password_reset.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"username": "some_username"}'
|
||||
|
||||
=end
|
||||
|
||||
def password_reset_send
|
||||
success = User.password_reset_send( params[:username] )
|
||||
if success
|
||||
|
@ -109,7 +277,27 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# get /users/verify_password/:hash
|
||||
=begin
|
||||
|
||||
Resource:
|
||||
POST /api/users/password_reset_verify
|
||||
|
||||
Payload:
|
||||
{
|
||||
"token": "SoMeToKeN",
|
||||
"password" "new_password"
|
||||
}
|
||||
|
||||
Response:
|
||||
{
|
||||
:message => 'ok'
|
||||
}
|
||||
|
||||
Test:
|
||||
curl http://localhost/api/users/password_reset_verify.json -v -u #{login}:#{password} -H "Content-Type: application/json" -X POST -d '{"token": "SoMeToKeN", "password" "new_password"}'
|
||||
|
||||
=end
|
||||
|
||||
def password_reset_verify
|
||||
if params[:password]
|
||||
success = User.password_reset_via_token( params[:token], params[:password] )
|
||||
|
|
|
@ -1,6 +1,24 @@
|
|||
class ApplicationModel < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
|
||||
def self.param_cleanup(params)
|
||||
data = {}
|
||||
self.new.attributes.each {|item|
|
||||
if params.has_key?(item[0])
|
||||
# puts 'use ' + item[0].to_s + '-' + params[item[0]].to_s
|
||||
data[item[0].to_sym] = params[item[0]]
|
||||
end
|
||||
}
|
||||
|
||||
# we do want to set this via database
|
||||
data.delete( :updated_at )
|
||||
data.delete( :created_at )
|
||||
data.delete( :updated_by_id )
|
||||
data.delete( :created_by_id )
|
||||
|
||||
data
|
||||
end
|
||||
|
||||
def cache_update(o)
|
||||
# puts 'u ' + self.class.to_s
|
||||
if self.respond_to?('cache_delete') then self.cache_delete end
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
class Channel < ActiveRecord::Base
|
||||
class Channel < ApplicationModel
|
||||
store :options
|
||||
|
||||
def self.send2
|
||||
# find outbound
|
||||
|
||||
end
|
||||
|
||||
def self.fetch
|
||||
channels = Channel.where( 'active = ? AND area LIKE ?', true, '%::Inbound' )
|
||||
channels.each { |channel|
|
||||
|
|
|
@ -15,10 +15,10 @@ class Channel::Twitter2
|
|||
def fetch (channel)
|
||||
|
||||
puts "fetching tweets (oauth_token#{channel[:options][:oauth_token]})"
|
||||
|
||||
@client = connect(channel)
|
||||
|
||||
# search results
|
||||
if channel[:options][:search]
|
||||
@client = connect(channel)
|
||||
channel[:options][:search].each { |search|
|
||||
puts " - searching for #{search[:item]}"
|
||||
tweets = @client.search( search[:item] )
|
||||
|
@ -29,7 +29,6 @@ class Channel::Twitter2
|
|||
|
||||
# mentions
|
||||
if channel[:options][:mentions]
|
||||
@client = connect(channel)
|
||||
puts " - searching for mentions"
|
||||
tweets = @client.mentions
|
||||
@article_type = 'twitter status'
|
||||
|
@ -38,7 +37,6 @@ class Channel::Twitter2
|
|||
|
||||
# direct messages
|
||||
if channel[:options][:direct_messages]
|
||||
@client = connect(channel)
|
||||
puts " - searching for direct_messages"
|
||||
tweets = @client.direct_messages
|
||||
@article_type = 'twitter direct-message'
|
||||
|
@ -49,8 +47,21 @@ class Channel::Twitter2
|
|||
|
||||
def fetch_loop(tweets, channel, group)
|
||||
|
||||
# get all tweets
|
||||
all_tweets = []
|
||||
result_class = tweets.class
|
||||
if result_class.to_s == 'Array'
|
||||
all_tweets = tweets
|
||||
elsif result_class.to_s == 'Twitter::SearchResults'
|
||||
tweets.results.map do |tweet|
|
||||
all_tweets.push tweet
|
||||
end
|
||||
else
|
||||
puts 'UNKNOWN: ' + result_class.to_s
|
||||
end
|
||||
|
||||
# find tweets
|
||||
tweets.each do |tweet|
|
||||
all_tweets.each do |tweet|
|
||||
|
||||
# check if tweet is already imported
|
||||
article = Ticket::Article.where( :message_id => tweet.id.to_s ).first
|
||||
|
@ -87,7 +98,7 @@ class Channel::Twitter2
|
|||
begin
|
||||
|
||||
# reconnect for #<Twitter::Error::NotFound: Sorry, that page does not exist> workaround
|
||||
@client = connect(channel)
|
||||
# @client = connect(channel)
|
||||
sender = @client.user(tweet.from_user_id)
|
||||
rescue Exception => e
|
||||
puts "Exception: twitter: " + e.inspect
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class Organization < ActiveRecord::Base
|
||||
class Organization < ApplicationModel
|
||||
has_and_belongs_to_many :users
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Overview < ActiveRecord::Base
|
||||
class Overview < ApplicationModel
|
||||
store :condition
|
||||
store :order
|
||||
store :meta
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Setting < ActiveRecord::Base
|
||||
class Setting < ApplicationModel
|
||||
store :options
|
||||
store :state
|
||||
store :state_initial
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class Template < ActiveRecord::Base
|
||||
class Template < ApplicationModel
|
||||
store :options
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Translation < ActiveRecord::Base
|
||||
class Translation < ApplicationModel
|
||||
before_create :set_initial
|
||||
|
||||
private
|
||||
|
|
|
@ -2,7 +2,7 @@ class User < ApplicationModel
|
|||
include Gmaps
|
||||
|
||||
before_create :check_name, :check_email, :check_image, :check_geo
|
||||
before_update :check_password, :check_geo
|
||||
before_update :check_password, :check_image, :check_geo
|
||||
after_create :cache_delete
|
||||
after_update :cache_delete
|
||||
after_destroy :cache_delete
|
||||
|
@ -52,9 +52,7 @@ class User < ApplicationModel
|
|||
end
|
||||
|
||||
# no user found
|
||||
if !user
|
||||
return nil
|
||||
end
|
||||
return nil if !user
|
||||
|
||||
# auth ok
|
||||
if user.password == password
|
||||
|
@ -97,6 +95,7 @@ class User < ApplicationModel
|
|||
end
|
||||
|
||||
# check if email address exists
|
||||
return if !user
|
||||
return if !user.email
|
||||
|
||||
# generate token
|
||||
|
@ -140,9 +139,8 @@ Your #{config.product_name} Team
|
|||
return true
|
||||
end
|
||||
|
||||
# check token
|
||||
def self.password_reset_check(token)
|
||||
|
||||
# check token
|
||||
token = Token.check( :action => 'PasswordReset', :name => token )
|
||||
return if !token
|
||||
return true
|
||||
|
|
8
config/routes/activity_stream.rb
Normal file
8
config/routes/activity_stream.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
map.match '/api/activity_stream', :to => 'activity#activity_stream'
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
|
@ -5,7 +5,6 @@ module ExtraRoutes
|
|||
map.match '/auth/:provider/callback', :to => 'sessions#create_omniauth'
|
||||
|
||||
# sessions
|
||||
map.resources :sessions, :only => [:create, :destroy, :show]
|
||||
map.match '/signin', :to => 'sessions#create'
|
||||
map.match '/signshow', :to => 'sessions#show'
|
||||
map.match '/signout', :to => 'sessions#destroy'
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# base objects
|
||||
map.resources :settings, :only => [:create, :show, :index, :update]
|
||||
|
||||
# users
|
||||
map.resources :users, :only => [:create, :show, :index, :update]
|
||||
map.match '/users/password_reset', :to => 'users#password_reset_send'
|
||||
map.match '/users/password_reset_verify', :to => 'users#password_reset_verify'
|
||||
|
||||
# groups
|
||||
map.resources :groups, :only => [:create, :show, :index, :update]
|
||||
|
||||
# roles
|
||||
map.resources :roles, :only => [:create, :show, :index, :update]
|
||||
|
||||
# organizations
|
||||
map.resources :organizations, :only => [:create, :show, :index, :update]
|
||||
|
||||
# templates
|
||||
map.resources :templates
|
||||
|
||||
# links
|
||||
map.match '/links', :to => 'links#index'
|
||||
map.match '/links/add', :to => 'links#add'
|
||||
map.match '/links/remove', :to => 'links#remove'
|
||||
|
||||
# overviews
|
||||
map.resources :overviews
|
||||
|
||||
# getting_started
|
||||
map.match '/getting_started', :to => 'getting_started#index'
|
||||
|
||||
# rss
|
||||
map.match '/rss_fetch', :to => 'rss#fetch'
|
||||
end
|
||||
module_function :add
|
||||
end
|
13
config/routes/channel.rb
Normal file
13
config/routes/channel.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# channels
|
||||
map.match '/api/channels', :to => 'channels#index', :via => :get
|
||||
map.match '/api/channels/:id', :to => 'channels#show', :via => :get
|
||||
map.match '/api/channels', :to => 'channels#create', :via => :post
|
||||
map.match '/api/channels/:id', :to => 'channels#update', :via => :put
|
||||
map.match '/api/channels/:id', :to => 'channels#destroy', :via => :delete
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
9
config/routes/getting_started.rb
Normal file
9
config/routes/getting_started.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# getting_started
|
||||
map.match '/api/getting_started', :to => 'getting_started#index'
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
12
config/routes/group.rb
Normal file
12
config/routes/group.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# groups
|
||||
map.match '/api/groups', :to => 'groups#index', :via => :get
|
||||
map.match '/api/groups/:id', :to => 'groups#show', :via => :get
|
||||
map.match '/api/groups', :to => 'groups#create', :via => :post
|
||||
map.match '/api/groups/:id', :to => 'groups#update', :via => :put
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
11
config/routes/link.rb
Normal file
11
config/routes/link.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# links
|
||||
map.match '/links', :to => 'links#index'
|
||||
map.match '/links/add', :to => 'links#add'
|
||||
map.match '/links/remove', :to => 'links#remove'
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
12
config/routes/organization.rb
Normal file
12
config/routes/organization.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# organizations
|
||||
map.match '/api/organizations', :to => 'organizations#index', :via => :get
|
||||
map.match '/api/organizations/:id', :to => 'organizations#show', :via => :get
|
||||
map.match '/api/organizations', :to => 'organizations#create', :via => :post
|
||||
map.match '/api/organizations/:id', :to => 'organizations#update', :via => :put
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
13
config/routes/overview.rb
Normal file
13
config/routes/overview.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# overviews
|
||||
map.match '/api/overviews', :to => 'overviews#index', :via => :get
|
||||
map.match '/api/overviews/:id', :to => 'overviews#show', :via => :get
|
||||
map.match '/api/overviews', :to => 'overviews#create', :via => :post
|
||||
map.match '/api/overviews/:id', :to => 'overviews#update', :via => :put
|
||||
map.match '/api/overviews/:id', :to => 'overviews#destroy', :via => :delete
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
8
config/routes/recent_viewed.rb
Normal file
8
config/routes/recent_viewed.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
map.match '/api/recent_viewed', :to => 'recent_viewed#recent_viewed'
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
12
config/routes/role.rb
Normal file
12
config/routes/role.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# roles
|
||||
map.match '/api/roles', :to => 'roles#index', :via => :get
|
||||
map.match '/api/roles/:id', :to => 'roles#show', :via => :get
|
||||
map.match '/api/roles', :to => 'roles#create', :via => :post
|
||||
map.match '/api/roles/:id', :to => 'roles#update', :via => :put
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
9
config/routes/rss.rb
Normal file
9
config/routes/rss.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# rss
|
||||
map.match '/api/rss_fetch', :to => 'rss#fetch'
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
13
config/routes/setting.rb
Normal file
13
config/routes/setting.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# base objects
|
||||
map.match '/api/settings', :to => 'settings#index', :via => :get
|
||||
map.match '/api/settings/:id', :to => 'settings#show', :via => :get
|
||||
map.match '/api/settings', :to => 'settings#create', :via => :post
|
||||
map.match '/api/settings/:id', :to => 'settings#update', :via => :put
|
||||
map.match '/api/settings/:id', :to => 'settings#destroy', :via => :delete
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
13
config/routes/template.rb
Normal file
13
config/routes/template.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# templates
|
||||
map.match '/api/templates', :to => 'templates#index', :via => :get
|
||||
map.match '/api/templates/:id', :to => 'templates#show', :via => :get
|
||||
map.match '/api/templates', :to => 'templates#create', :via => :post
|
||||
map.match '/api/templates/:id', :to => 'templates#update', :via => :put
|
||||
map.match '/api/templates/:id', :to => 'templates#destroy', :via => :delete
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
|
@ -2,25 +2,39 @@ module ExtraRoutes
|
|||
def add(map)
|
||||
|
||||
# tickets
|
||||
map.resources :channels, :only => [:create, :show, :index, :update, :destroy]
|
||||
map.resources :ticket_articles, :only => [:create, :show, :index, :update]
|
||||
map.resources :ticket_priorities, :only => [:create, :show, :index, :update]
|
||||
map.resources :ticket_states, :only => [:create, :show, :index, :update]
|
||||
map.resources :tickets, :only => [:create, :show, :index, :update]
|
||||
map.match '/ticket_full/:id', :to => 'ticket_overviews#ticket_full'
|
||||
map.match '/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_overviews#ticket_attachment'
|
||||
map.match '/ticket_attachment_new', :to => 'ticket_overviews#ticket_attachment_new'
|
||||
map.match '/ticket_article_plain/:id', :to => 'ticket_overviews#ticket_article_plain'
|
||||
map.match '/ticket_history/:id', :to => 'ticket_overviews#ticket_history'
|
||||
map.match '/ticket_customer', :to => 'ticket_overviews#ticket_customer'
|
||||
map.match '/ticket_overviews', :to => 'ticket_overviews#show'
|
||||
map.match '/ticket_create', :to => 'ticket_overviews#ticket_create'
|
||||
map.match '/user_search', :to => 'ticket_overviews#user_search'
|
||||
map.match '/api/tickets', :to => 'tickets#index', :via => :get
|
||||
map.match '/api/tickets/:id', :to => 'tickets#show', :via => :get
|
||||
map.match '/api/tickets', :to => 'tickets#create', :via => :post
|
||||
map.match '/api/tickets/:id', :to => 'tickets#update', :via => :put
|
||||
map.match '/api/ticket_create', :to => 'tickets#ticket_create', :via => :get
|
||||
map.match '/api/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get
|
||||
map.match '/api/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get
|
||||
map.match '/api/ticket_customer', :to => 'tickets#ticket_customer', :via => :get
|
||||
map.match '/api/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge'
|
||||
|
||||
map.match '/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'ticket_overviews#ticket_merge'
|
||||
# ticket overviews
|
||||
map.match '/api/ticket_overviews', :to => 'ticket_overviews#show', :via => :get
|
||||
|
||||
map.match '/activity_stream', :to => 'activity#activity_stream'
|
||||
map.match '/recent_viewed', :to => 'recent_viewed#recent_viewed'
|
||||
# ticket priority
|
||||
map.match '/api/ticket_priorities', :to => 'ticket_priorities#index', :via => :get
|
||||
map.match '/api/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get
|
||||
map.match '/api/ticket_priorities', :to => 'ticket_priorities#create', :via => :post
|
||||
map.match '/api/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put
|
||||
|
||||
# ticket state
|
||||
map.match '/api/ticket_states', :to => 'ticket_states#index', :via => :get
|
||||
map.match '/api/ticket_states/:id', :to => 'ticket_states#show', :via => :get
|
||||
map.match '/api/ticket_states', :to => 'ticket_states#create', :via => :post
|
||||
map.match '/api/ticket_states/:id', :to => 'ticket_states#update', :via => :put
|
||||
|
||||
# ticket articles
|
||||
map.match '/api/ticket_articles', :to => 'ticket_articles#index', :via => :get
|
||||
map.match '/api/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get
|
||||
map.match '/api/ticket_articles', :to => 'ticket_articles#create', :via => :post
|
||||
map.match '/api/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put
|
||||
map.match '/api/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment'
|
||||
map.match '/api/ticket_attachment_new', :to => 'ticket_articles#attachment_new'
|
||||
map.match '/api/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get
|
||||
|
||||
end
|
||||
module_function :add
|
||||
|
|
15
config/routes/user.rb
Normal file
15
config/routes/user.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# users
|
||||
map.match '/api/users/search', :to => 'users#search', :via => [:get, :post]
|
||||
map.match '/api/users/password_reset', :to => 'users#password_reset_send', :via => :post
|
||||
map.match '/api/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :get
|
||||
map.match '/api/users', :to => 'users#index', :via => :get
|
||||
map.match '/api/users/:id', :to => 'users#show', :via => :get
|
||||
map.match '/api/users', :to => 'users#create', :via => :post
|
||||
map.match '/api/users/:id', :to => 'users#update', :via => :put
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
|
@ -30,6 +30,7 @@ class CreateBase < ActiveRecord::Migration
|
|||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :source, :string, :limit => 200, :null => true
|
||||
t.column :preferences, :string, :limit => 4000,:null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
|
@ -47,6 +48,7 @@ class CreateBase < ActiveRecord::Migration
|
|||
t.column :body, :string, :limit => 5000, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
|
@ -60,26 +62,29 @@ class CreateBase < ActiveRecord::Migration
|
|||
t.column :follow_up_assignment, :boolean, :default => 1
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :groups, [:name], :unique => true
|
||||
|
||||
create_table :roles do |t|
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :roles, [:name], :unique => true
|
||||
|
||||
create_table :organizations do |t|
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :shared, :boolean, :null => false, :default => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :shared, :boolean, :null => false, :default => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :organizations, [:name], :unique => true
|
||||
|
|
|
@ -1,25 +1,31 @@
|
|||
class CreateTicket < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :ticket_state_types do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :ticket_state_types, [:name], :unique => true
|
||||
|
||||
create_table :ticket_states do |t|
|
||||
t.references :ticket_state_type, :null => false
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :ticket_states, [:name], :unique => true
|
||||
|
||||
create_table :ticket_priorities do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :ticket_priorities, [:name], :unique => true
|
||||
|
@ -38,6 +44,7 @@ class CreateTicket < ActiveRecord::Migration
|
|||
t.column :last_contact_agent, :timestamp, :null => true
|
||||
t.column :last_contact_customer, :timestamp, :null => true
|
||||
t.column :close_time, :timestamp, :null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
|
@ -80,17 +87,21 @@ class CreateTicket < ActiveRecord::Migration
|
|||
add_index :ticket_time_accounting, [:created_by_id]
|
||||
|
||||
create_table :ticket_article_types do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :communication, :boolean, :null => false
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :communication, :boolean, :null => false
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :ticket_article_types, [:name], :unique => true
|
||||
|
||||
create_table :ticket_article_senders do |t|
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :ticket_article_senders, [:name], :unique => true
|
||||
|
@ -99,18 +110,19 @@ class CreateTicket < ActiveRecord::Migration
|
|||
t.references :ticket, :null => false
|
||||
t.references :ticket_article_type, :null => false
|
||||
t.references :ticket_article_sender, :null => false
|
||||
t.column :from, :string, :limit => 3000, :null => true
|
||||
t.column :to, :string, :limit => 3000, :null => true
|
||||
t.column :cc, :string, :limit => 3000, :null => true
|
||||
t.column :subject, :string, :limit => 3000, :null => true
|
||||
# t.column :reply_to, :string, :limit => 3000, :null => true
|
||||
t.column :message_id, :string, :limit => 3000, :null => true
|
||||
t.column :message_id_md5, :string, :limit => 32, :null => true
|
||||
t.column :in_reply_to, :string, :limit => 3000, :null => true
|
||||
t.column :references, :string, :limit => 3200, :null => true
|
||||
t.column :body, :text, :null => true
|
||||
t.column :internal, :boolean, :null => false, :default => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.column :from, :string, :limit => 3000, :null => true
|
||||
t.column :to, :string, :limit => 3000, :null => true
|
||||
t.column :cc, :string, :limit => 3000, :null => true
|
||||
t.column :subject, :string, :limit => 3000, :null => true
|
||||
# t.column :reply_to, :string, :limit => 3000, :null => true
|
||||
t.column :message_id, :string, :limit => 3000, :null => true
|
||||
t.column :message_id_md5, :string, :limit => 32, :null => true
|
||||
t.column :in_reply_to, :string, :limit => 3000, :null => true
|
||||
t.column :references, :string, :limit => 3200, :null => true
|
||||
t.column :body, :text, :null => true
|
||||
t.column :internal, :boolean, :null => false, :default => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :ticket_articles, [:ticket_id]
|
||||
|
@ -134,13 +146,15 @@ class CreateTicket < ActiveRecord::Migration
|
|||
add_index :ticket_article_flags, [:created_by_id]
|
||||
|
||||
create_table :overviews do |t|
|
||||
t.references :user, :null => true
|
||||
t.references :role, :null => false
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :meta, :string, :limit => 1000, :null => false
|
||||
t.column :condition, :string, :limit => 2500, :null => false
|
||||
t.column :order, :string, :limit => 2500, :null => false
|
||||
t.column :view, :string, :limit => 1000, :null => false
|
||||
t.references :user, :null => true
|
||||
t.references :role, :null => false
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :meta, :string, :limit => 1000, :null => false
|
||||
t.column :condition, :string, :limit => 2500, :null => false
|
||||
t.column :order, :string, :limit => 2500, :null => false
|
||||
t.column :view, :string, :limit => 1000, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :overviews, [:user_id]
|
||||
|
|
|
@ -1,36 +1,44 @@
|
|||
class CreateNetwork < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :networks do |t|
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :networks, [:name], :unique => true
|
||||
|
||||
create_table :network_category_types do |t|
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_category_types, [:name], :unique => true
|
||||
|
||||
create_table :network_privacies do |t|
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :key, :string, :limit => 250, :null => false
|
||||
t.column :name, :string, :limit => 100, :null => false
|
||||
t.column :key, :string, :limit => 250, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_privacies, [:name], :unique => true
|
||||
|
||||
create_table :network_categories do |t|
|
||||
t.references :network_category_type, :null => false
|
||||
t.references :network_privacy, :null => false
|
||||
t.references :network, :null => false
|
||||
t.column :name, :string, :limit => 200, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :allow_comments, :boolean, :null => false, :default => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.references :network_category_type, :null => false
|
||||
t.references :network_privacy, :null => false
|
||||
t.references :network, :null => false
|
||||
t.column :name, :string, :limit => 200, :null => false
|
||||
t.column :note, :string, :limit => 250, :null => true
|
||||
t.column :allow_comments, :boolean, :null => false, :default => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_categories, [:network_id]
|
||||
|
@ -42,38 +50,43 @@ class CreateNetwork < ActiveRecord::Migration
|
|||
|
||||
create_table :network_items do |t|
|
||||
t.references :network_category, :null => false
|
||||
t.column :title, :string, :limit => 200, :null => false
|
||||
t.column :body, :string, :limit => 25000, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.column :title, :string, :limit => 200, :null => false
|
||||
t.column :body, :string, :limit => 25000, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_items, [:network_category_id]
|
||||
|
||||
create_table :network_item_comments do |t|
|
||||
t.references :network_item, :null => false
|
||||
t.column :body, :string, :limit => 25000, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.references :network_item, :null => false
|
||||
t.column :body, :string, :limit => 25000, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_item_comments, [:network_item_id]
|
||||
|
||||
create_table :network_item_plus do |t|
|
||||
t.references :network_item, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.references :network_item, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_item_plus, [:network_item_id, :created_by_id], :unique => true
|
||||
|
||||
create_table :network_category_subscriptions do |t|
|
||||
t.references :network_categories, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.references :network_categories, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_category_subscriptions, [:network_categories_id, :created_by_id], :unique => true, :name => 'index_network_category_subscriptions_on_network_c_i_and_c'
|
||||
|
||||
create_table :network_item_subscriptions do |t|
|
||||
t.references :network_item, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.references :network_item, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :network_item_subscriptions, [:network_item_id, :created_by_id], :unique => true, :name => 'index_network_item_subscriptions_on_item_id_and_created_by_id'
|
||||
|
|
|
@ -7,12 +7,13 @@ class CreateChannel < ActiveRecord::Migration
|
|||
t.column :area, :string, :limit => 100, :null => false
|
||||
t.column :options, :string, :limit => 2000, :null => true
|
||||
t.column :active, :boolean, :null => false, :default => true
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :channels, [:area]
|
||||
add_index :channels, [:adapter]
|
||||
|
||||
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
class CreateTemplate < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :templates do |t|
|
||||
t.references :user, :null => true
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :options, :string, :limit => 2500, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.references :user, :null => true
|
||||
t.column :name, :string, :limit => 250, :null => false
|
||||
t.column :options, :string, :limit => 2500, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :templates, [:user_id]
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
class CreateTranslation < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :translations do |t|
|
||||
t.column :locale, :string, :limit => 10, :null => false
|
||||
t.column :source, :string, :limit => 255, :null => false
|
||||
t.column :target, :string, :limit => 255, :null => false
|
||||
t.column :target_initial, :string, :limit => 255, :null => false
|
||||
t.column :locale, :string, :limit => 10, :null => false
|
||||
t.column :source, :string, :limit => 255, :null => false
|
||||
t.column :target, :string, :limit => 255, :null => false
|
||||
t.column :target_initial, :string, :limit => 255, :null => false
|
||||
t.column :updated_by_id, :integer, :null => false
|
||||
t.column :created_by_id, :integer, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
add_index :translations, [:source]
|
||||
|
|
44
db/migrate/20120917161903_create_change_by_id.rb
Normal file
44
db/migrate/20120917161903_create_change_by_id.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
class CreateChangeById < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :channels, :updated_by_id, :integer, :null => true
|
||||
add_column :overviews, :created_by_id, :integer, :null => true
|
||||
add_column :overviews, :updated_by_id, :integer, :null => true
|
||||
add_column :users, :updated_by_id, :integer, :null => true
|
||||
add_column :signatures, :updated_by_id, :integer, :null => true
|
||||
add_column :groups, :updated_by_id, :integer, :null => true
|
||||
add_column :roles, :updated_by_id, :integer, :null => true
|
||||
add_column :organizations, :updated_by_id, :integer, :null => true
|
||||
add_column :ticket_state_types, :updated_by_id, :integer, :null => true
|
||||
add_column :ticket_state_types, :created_by_id, :integer, :null => true
|
||||
add_column :ticket_states, :updated_by_id, :integer, :null => true
|
||||
add_column :ticket_states, :created_by_id, :integer, :null => true
|
||||
add_column :ticket_priorities, :updated_by_id, :integer, :null => true
|
||||
add_column :ticket_priorities, :created_by_id, :integer, :null => true
|
||||
add_column :tickets, :updated_by_id, :integer, :null => true
|
||||
add_column :ticket_article_types, :updated_by_id, :integer, :null => true
|
||||
add_column :ticket_article_types, :created_by_id, :integer, :null => true
|
||||
add_column :ticket_article_senders, :updated_by_id, :integer, :null => true
|
||||
add_column :ticket_article_senders, :created_by_id, :integer, :null => true
|
||||
add_column :ticket_articles, :updated_by_id, :integer, :null => true
|
||||
add_column :networks, :updated_by_id, :integer, :null => true
|
||||
add_column :networks, :created_by_id, :integer, :null => true
|
||||
add_column :network_category_types, :updated_by_id, :integer, :null => true
|
||||
add_column :network_category_types, :created_by_id, :integer, :null => true
|
||||
add_column :network_privacies, :updated_by_id, :integer, :null => true
|
||||
add_column :network_privacies, :created_by_id, :integer, :null => true
|
||||
add_column :network_categories, :updated_by_id, :integer, :null => true
|
||||
add_column :network_categories, :created_by_id, :integer, :null => true
|
||||
add_column :network_items, :updated_by_id, :integer, :null => true
|
||||
add_column :network_item_comments, :updated_by_id, :integer, :null => true
|
||||
add_column :network_item_plus, :updated_by_id, :integer, :null => true
|
||||
add_column :network_category_subscriptions, :updated_by_id, :integer, :null => true
|
||||
add_column :network_item_subscriptions, :updated_by_id, :integer, :null => true
|
||||
add_column :templates, :created_by_id, :integer, :null => true
|
||||
add_column :templates, :updated_by_id, :integer, :null => true
|
||||
add_column :translations, :created_by_id, :integer, :null => true
|
||||
add_column :translations, :updated_by_id, :integer, :null => true
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
426
db/seeds.rb
426
db/seeds.rb
|
@ -639,7 +639,7 @@ Setting.create(
|
|||
],
|
||||
},
|
||||
:state => {
|
||||
:value => '50',
|
||||
:value => '70',
|
||||
},
|
||||
:frontend => false
|
||||
)
|
||||
|
@ -1057,18 +1057,21 @@ Role.create(
|
|||
:id => 1,
|
||||
:name => 'Admin',
|
||||
:note => 'To configure your system.',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
Role.create(
|
||||
:id => 2,
|
||||
:name => 'Agent',
|
||||
:note => 'To work on Tickets.',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
Role.create(
|
||||
:id => 3,
|
||||
:name => 'Customer',
|
||||
:note => 'People who create Tickets ask for help.',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
|
@ -1076,12 +1079,14 @@ Group.create(
|
|||
:id => 1,
|
||||
:name => 'Users',
|
||||
:note => 'Standard Group/Pool for Tickets.',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
Group.create(
|
||||
:id => 2,
|
||||
:name => 'Twitter',
|
||||
:note => 'All Tweets.',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
|
@ -1099,6 +1104,7 @@ user = User.create(
|
|||
:roles => roles,
|
||||
:groups => groups,
|
||||
:organizations => organizations,
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
user_community = User.create(
|
||||
|
@ -1111,6 +1117,7 @@ user_community = User.create(
|
|||
:roles => roles,
|
||||
# :groups => groups,
|
||||
:organizations => organizations,
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
|
@ -1121,39 +1128,39 @@ Link::Object.create( :name => 'Question/Answer' )
|
|||
Link::Object.create( :name => 'Idea' )
|
||||
Link::Object.create( :name => 'Bug' )
|
||||
|
||||
Ticket::StateType.create( :name => 'new' )
|
||||
Ticket::StateType.create( :name => 'open' )
|
||||
Ticket::StateType.create( :name => 'pending reminder' )
|
||||
Ticket::StateType.create( :name => 'pending action' )
|
||||
Ticket::StateType.create( :name => 'closed' )
|
||||
Ticket::StateType.create( :name => 'merged' )
|
||||
Ticket::StateType.create( :name => 'removed' )
|
||||
Ticket::StateType.create( :name => 'new', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::StateType.create( :name => 'open', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::StateType.create( :name => 'pending reminder', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::StateType.create( :name => 'pending action', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::StateType.create( :name => 'closed', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::StateType.create( :name => 'merged', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::StateType.create( :name => 'removed', :updated_by_id => 1, :created_by_id => 1 )
|
||||
|
||||
Ticket::State.create( :name => 'new', :ticket_state_type_id => Ticket::StateType.where(:name => 'new').first.id )
|
||||
Ticket::State.create( :name => 'open', :ticket_state_type_id => Ticket::StateType.where(:name => 'open').first.id )
|
||||
Ticket::State.create( :name => 'pending', :ticket_state_type_id => Ticket::StateType.where(:name => 'pending reminder').first.id )
|
||||
Ticket::State.create( :name => 'closed', :ticket_state_type_id => Ticket::StateType.where(:name => 'closed').first.id )
|
||||
Ticket::State.create( :name => 'merged', :ticket_state_type_id => Ticket::StateType.where(:name => 'merged').first.id )
|
||||
Ticket::State.create( :name => 'removed', :ticket_state_type_id => Ticket::StateType.where(:name => 'removed').first.id )
|
||||
Ticket::State.create( :name => 'new', :ticket_state_type_id => Ticket::StateType.where(:name => 'new').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::State.create( :name => 'open', :ticket_state_type_id => Ticket::StateType.where(:name => 'open').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::State.create( :name => 'pending', :ticket_state_type_id => Ticket::StateType.where(:name => 'pending reminder').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::State.create( :name => 'closed', :ticket_state_type_id => Ticket::StateType.where(:name => 'closed').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::State.create( :name => 'merged', :ticket_state_type_id => Ticket::StateType.where(:name => 'merged').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::State.create( :name => 'removed', :ticket_state_type_id => Ticket::StateType.where(:name => 'removed').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||
|
||||
Ticket::Priority.create( :name => '1 low' )
|
||||
Ticket::Priority.create( :name => '2 normal' )
|
||||
Ticket::Priority.create( :name => '3 high' )
|
||||
Ticket::Priority.create( :name => '1 low', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Priority.create( :name => '2 normal', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Priority.create( :name => '3 high', :updated_by_id => 1, :created_by_id => 1 )
|
||||
|
||||
Ticket::Article::Type.create( :name => 'email', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'sms', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'chat', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'fax', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'phone', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'twitter status', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'twitter direct-message', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'facebook', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'note', :communication => false )
|
||||
Ticket::Article::Type.create( :name => 'web', :communication => true )
|
||||
Ticket::Article::Type.create( :name => 'email', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'sms', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'chat', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'fax', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'phone', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'twitter status', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'twitter direct-message', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'facebook', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'note', :communication => false, :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Type.create( :name => 'web', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||
|
||||
Ticket::Article::Sender.create( :name => 'Agent' )
|
||||
Ticket::Article::Sender.create( :name => 'Customer' )
|
||||
Ticket::Article::Sender.create( :name => 'System' )
|
||||
Ticket::Article::Sender.create( :name => 'Agent', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Sender.create( :name => 'Customer', :updated_by_id => 1, :created_by_id => 1 )
|
||||
Ticket::Article::Sender.create( :name => 'System', :updated_by_id => 1, :created_by_id => 1 )
|
||||
|
||||
ticket = Ticket.create(
|
||||
:group_id => Group.where( :name => 'Users' ).first.id,
|
||||
|
@ -1162,10 +1169,10 @@ ticket = Ticket.create(
|
|||
:title => 'Welcome to Zammad!',
|
||||
:ticket_state_id => Ticket::State.where( :name => 'new' ).first.id,
|
||||
:ticket_priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
|
||||
:updated_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
||||
:created_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id
|
||||
)
|
||||
Ticket::Article.create(
|
||||
:created_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
||||
:ticket_id => ticket.id,
|
||||
:ticket_article_type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id,
|
||||
:ticket_article_sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id,
|
||||
|
@ -1182,7 +1189,9 @@ Regards,
|
|||
|
||||
The Zammad.org Project
|
||||
',
|
||||
:internal => false
|
||||
:internal => false,
|
||||
:updated_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
||||
:created_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id
|
||||
)
|
||||
|
||||
overview_role = Role.where( :name => 'Agent' ).first
|
||||
|
@ -1222,7 +1231,9 @@ Overview.create(
|
|||
:per_page => 20,
|
||||
},
|
||||
:view_mode_default => 's',
|
||||
}
|
||||
},
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
Overview.create(
|
||||
|
@ -1261,7 +1272,9 @@ Overview.create(
|
|||
:per_page => 20,
|
||||
},
|
||||
:view_mode_default => 's',
|
||||
}
|
||||
},
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
Overview.create(
|
||||
|
@ -1299,7 +1312,9 @@ Overview.create(
|
|||
:per_page => 20,
|
||||
},
|
||||
:view_mode_default => 's',
|
||||
}
|
||||
},
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
Overview.create(
|
||||
|
@ -1337,7 +1352,9 @@ Overview.create(
|
|||
:per_page => 20,
|
||||
},
|
||||
:view_mode_default => 's',
|
||||
}
|
||||
},
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
Overview.create(
|
||||
|
@ -1376,7 +1393,9 @@ Overview.create(
|
|||
:per_page => 20,
|
||||
},
|
||||
:view_mode_default => 's',
|
||||
}
|
||||
},
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
Overview.create(
|
||||
|
@ -1415,7 +1434,9 @@ Overview.create(
|
|||
:per_page => 20,
|
||||
},
|
||||
:view_mode_default => 's',
|
||||
}
|
||||
},
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
overview_role = Role.where( :name => 'Customer' ).first
|
||||
|
@ -1454,7 +1475,9 @@ Overview.create(
|
|||
:per_page => 20,
|
||||
},
|
||||
:view_mode_default => 's',
|
||||
}
|
||||
},
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1
|
||||
)
|
||||
|
||||
Channel.create(
|
||||
|
@ -1468,40 +1491,56 @@ Channel.create(
|
|||
},
|
||||
:group_id => 1,
|
||||
:active => false,
|
||||
:created_by_id => User.where( :login => '-' ).first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Channel.create(
|
||||
:adapter => 'Sendmail',
|
||||
:area => 'Email::Outbound',
|
||||
:options => {},
|
||||
:active => true,
|
||||
:created_by_id => User.where( :login => '-' ).first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
|
||||
network = Network.create(
|
||||
:name => 'base'
|
||||
:name => 'base',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
|
||||
Network::Category::Type.create(
|
||||
:name => 'Announcement'
|
||||
:name => 'Announcement',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Category::Type.create(
|
||||
:name => 'Idea'
|
||||
:name => 'Idea',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Category::Type.create(
|
||||
:name => 'Question'
|
||||
:name => 'Question',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Category::Type.create(
|
||||
:name => 'Bug Report'
|
||||
:name => 'Bug Report',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
|
||||
Network::Privacy.create(
|
||||
:name => 'logged in',
|
||||
:key => 'loggedIn'
|
||||
:key => 'loggedIn',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Privacy.create(
|
||||
:name => 'logged in and moderator',
|
||||
:key => 'loggedInModerator'
|
||||
:key => 'loggedInModerator',
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Category.create(
|
||||
:name => 'Announcements',
|
||||
|
@ -1509,7 +1548,9 @@ Network::Category.create(
|
|||
:allow_comments => true,
|
||||
:network_category_type_id => Network::Category::Type.where(:name => 'Announcement').first.id,
|
||||
:network_privacy_id => Network::Privacy.where(:name => 'logged in and moderator').first.id,
|
||||
:allow_comments => true
|
||||
:allow_comments => true,
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Category.create(
|
||||
:name => 'Questions',
|
||||
|
@ -1517,7 +1558,9 @@ Network::Category.create(
|
|||
:allow_comments => true,
|
||||
:network_category_type_id => Network::Category::Type.where(:name => 'Question').first.id,
|
||||
:network_privacy_id => Network::Privacy.where(:name => 'logged in').first.id
|
||||
# :network_categories_moderator_user_ids => User.where(:login => '-').first.id
|
||||
# :network_categories_moderator_user_ids => User.where(:login => '-').first.id,
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Category.create(
|
||||
:name => 'Ideas',
|
||||
|
@ -1533,7 +1576,9 @@ Network::Category.create(
|
|||
:allow_comments => true,
|
||||
:network_category_type_id => Network::Category::Type.where(:name => 'Bug Report').first.id,
|
||||
:network_privacy_id => Network::Privacy.where(:name => 'logged in').first.id,
|
||||
:allow_comments => true
|
||||
:allow_comments => true,
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
item = Network::Item.create(
|
||||
:title => 'Example Announcement',
|
||||
|
@ -1544,170 +1589,177 @@ item = Network::Item.create(
|
|||
Network::Item::Comment.create(
|
||||
:network_item_id => item.id,
|
||||
:body => 'Some comment....',
|
||||
:created_by_id => User.where(:login => '-').first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
item = Network::Item.create(
|
||||
:title => 'Example Question?',
|
||||
:body => 'Some questions....',
|
||||
:network_category_id => Network::Category.where(:name => 'Questions').first.id,
|
||||
:created_by_id => User.where(:login => '-').first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Item::Comment.create(
|
||||
:network_item_id => item.id,
|
||||
:body => 'Some comment....',
|
||||
:created_by_id => User.where(:login => '-').first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
item = Network::Item.create(
|
||||
:title => 'Example Idea',
|
||||
:body => 'Some idea....',
|
||||
:network_category_id => Network::Category.where(:name => 'Ideas').first.id,
|
||||
:created_by_id => User.where(:login => '-').first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Item::Comment.create(
|
||||
:network_item_id => item.id,
|
||||
:body => 'Some comment....',
|
||||
:created_by_id => User.where(:login => '-').first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
item = Network::Item.create(
|
||||
:title => 'Example Bug Report',
|
||||
:body => 'Some bug....',
|
||||
:network_category_id => Network::Category.where(:name => 'Bug Reports').first.id,
|
||||
:created_by_id => User.where(:login => '-').first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
Network::Item::Comment.create(
|
||||
:network_item_id => item.id,
|
||||
:body => 'Some comment....',
|
||||
:created_by_id => User.where(:login => '-').first.id
|
||||
:updated_by_id => 1,
|
||||
:created_by_id => 1,
|
||||
)
|
||||
|
||||
Translation.create( :locale => 'de', :source => "New", :target => "Neu" )
|
||||
Translation.create( :locale => 'de', :source => "Create", :target => "Erstellen" )
|
||||
Translation.create( :locale => 'de', :source => "Cancel", :target => "Abbrechen" )
|
||||
Translation.create( :locale => 'de', :source => "Submit", :target => "Übermitteln" )
|
||||
Translation.create( :locale => 'de', :source => "Sign out", :target => "Abmelden" )
|
||||
Translation.create( :locale => 'de', :source => "Profile", :target => "Profil" )
|
||||
Translation.create( :locale => 'de', :source => "Settings", :target => "Einstellungen" )
|
||||
Translation.create( :locale => 'de', :source => "Overviews", :target => "Übersichten" )
|
||||
Translation.create( :locale => 'de', :source => "Manage", :target => "Verwalten" )
|
||||
Translation.create( :locale => 'de', :source => "Users", :target => "Benutzer" )
|
||||
Translation.create( :locale => 'de', :source => "Groups", :target => "Gruppen" )
|
||||
Translation.create( :locale => 'de', :source => "Group", :target => "Gruppe" )
|
||||
Translation.create( :locale => 'de', :source => "Organizations", :target => "Organisationen" )
|
||||
Translation.create( :locale => 'de', :source => "Organization", :target => "Organisation" )
|
||||
Translation.create( :locale => 'de', :source => "Recent Viewed", :target => "Zuletzt angesehen" )
|
||||
Translation.create( :locale => 'de', :source => "Security", :target => "Sicherheit" )
|
||||
Translation.create( :locale => 'de', :source => "From", :target => "Von" )
|
||||
Translation.create( :locale => 'de', :source => "Title", :target => "Titel" )
|
||||
Translation.create( :locale => 'de', :source => "Customer", :target => "Kunde" )
|
||||
Translation.create( :locale => 'de', :source => "State", :target => "Status" )
|
||||
Translation.create( :locale => 'de', :source => "Created", :target => "Erstellt" )
|
||||
Translation.create( :locale => 'de', :source => "Attributes", :target => "Attribute" )
|
||||
Translation.create( :locale => 'de', :source => "Direction", :target => "Richtung" )
|
||||
Translation.create( :locale => 'de', :source => "Owner", :target => "Besitzer" )
|
||||
Translation.create( :locale => 'de', :source => "Subject", :target => "Betreff" )
|
||||
Translation.create( :locale => 'de', :source => "Priority", :target => "Priorität" )
|
||||
Translation.create( :locale => 'de', :source => "Select the customer of the Ticket or create one.", :target => "Wähle den Kunden eine Tickets oder erstell einen neuen." )
|
||||
Translation.create( :locale => 'de', :source => "New Ticket", :target => "Neues Ticket" )
|
||||
Translation.create( :locale => 'de', :source => "Firstname", :target => "Vorname" )
|
||||
Translation.create( :locale => 'de', :source => "Lastname", :target => "Nachname" )
|
||||
Translation.create( :locale => 'de', :source => "Phone", :target => "Telefon" )
|
||||
Translation.create( :locale => 'de', :source => "Street", :target => "Straße" )
|
||||
Translation.create( :locale => 'de', :source => "Zip", :target => "PLZ" )
|
||||
Translation.create( :locale => 'de', :source => "City", :target => "Stadt" )
|
||||
Translation.create( :locale => 'de', :source => "Note", :target => "Notiz" )
|
||||
Translation.create( :locale => 'de', :source => "note", :target => "Notiz" )
|
||||
Translation.create( :locale => 'de', :source => "New User", :target => "Neuer Benutzer" )
|
||||
Translation.create( :locale => 'de', :source => "Merge", :target => "Zusammenfügen" )
|
||||
Translation.create( :locale => 'de', :source => "History", :target => "Historie" )
|
||||
Translation.create( :locale => 'de', :source => "new", :target => "neu" )
|
||||
Translation.create( :locale => 'de', :source => "closed", :target => "geschlossen" )
|
||||
Translation.create( :locale => 'de', :source => "open", :target => "offen" )
|
||||
Translation.create( :locale => 'de', :source => "pending", :target => "warten" )
|
||||
Translation.create( :locale => 'de', :source => "merged", :target => "zusammengefügt" )
|
||||
Translation.create( :locale => 'de', :source => "removed", :target => "zurück gezogen" )
|
||||
Translation.create( :locale => 'de', :source => "Activity Stream", :target => "Aktivitäts-Stream" )
|
||||
Translation.create( :locale => 'de', :source => "updated", :target => "aktuallisierte" )
|
||||
Translation.create( :locale => 'de', :source => "created", :target => "erstellte" )
|
||||
Translation.create( :locale => 'de', :source => "My assigned Tickets", :target => "Meine zugewisenen Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "Unassigned Tickets", :target => "Nicht zugewisene/freie Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "Unassigned & Open Tickets", :target => "Nicht zugewisene & offene Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "All Tickets", :target => "Alle Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "Escalated Tickets", :target => "Eskallierte Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "My pending reached Tickets", :target => "Meine warten erreicht Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "Password", :target => "Passwort" )
|
||||
Translation.create( :locale => 'de', :source => "Password (confirm)", :target => "Passwort (bestätigen)" )
|
||||
Translation.create( :locale => 'de', :source => "Roles", :target => "Rollen" )
|
||||
Translation.create( :locale => 'de', :source => "Active", :target => "Aktiv" )
|
||||
Translation.create( :locale => 'de', :source => "Edit", :target => "Bearbeiten" )
|
||||
Translation.create( :locale => 'de', :source => "Base", :target => "Basis" )
|
||||
Translation.create( :locale => 'de', :source => "Number", :target => "Nummer" )
|
||||
Translation.create( :locale => 'de', :source => "Sender Format", :target => "Absender Format" )
|
||||
Translation.create( :locale => 'de', :source => "Authentication", :target => "Authorisierung" )
|
||||
Translation.create( :locale => 'de', :source => "Product Name", :target => "Produkt Name" )
|
||||
Translation.create( :locale => 'de', :source => "To", :target => "An" )
|
||||
Translation.create( :locale => 'de', :source => "Customer", :target => "Kunde" )
|
||||
Translation.create( :locale => 'de', :source => "Linked Accounts", :target => "Verknüpfte Accounts" )
|
||||
Translation.create( :locale => 'de', :source => "Sign in with", :target => "Anmelden mit" )
|
||||
Translation.create( :locale => 'de', :source => "Username or email", :target => "Benutzer oder Email" )
|
||||
Translation.create( :locale => 'de', :source => "Remember me", :target => "An mich erinnern" )
|
||||
Translation.create( :locale => 'de', :source => "Forgot password?", :target => "Passwort vergessen?" )
|
||||
Translation.create( :locale => 'de', :source => "Sign in using", :target => "Anmelden über" )
|
||||
Translation.create( :locale => 'de', :source => "New to", :target => "Neu bei" )
|
||||
Translation.create( :locale => 'de', :source => "join today!", :target => "werde Teil!" )
|
||||
Translation.create( :locale => 'de', :source => "Sign up", :target => "Registrieren" )
|
||||
Translation.create( :locale => 'de', :source => "Sign in", :target => "Anmelden" )
|
||||
Translation.create( :locale => 'de', :source => "Create my account", :target => "Meinen Account erstellen" )
|
||||
Translation.create( :locale => 'de', :source => "Login successfully! Have a nice day!", :target => "Anmeldung erfolgreich!" )
|
||||
Translation.create( :locale => 'de', :source => "Last contact", :target => "Letzter Kontakt" )
|
||||
Translation.create( :locale => 'de', :source => "Last contact (Agent)", :target => "Letzter Kontakt (Agent)" )
|
||||
Translation.create( :locale => 'de', :source => "Last contact (Customer)", :target => "Letzter Kontakt (Kunde)" )
|
||||
Translation.create( :locale => 'de', :source => "Close time", :target => "Schließzeit" )
|
||||
Translation.create( :locale => 'de', :source => "First response", :target => "Erste Reaktion" )
|
||||
Translation.create( :locale => 'de', :source => "Ticket %s created!", :target => "Ticket %s erstellt!" )
|
||||
Translation.create( :locale => 'de', :source => "day", :target => "Tag" )
|
||||
Translation.create( :locale => 'de', :source => "days", :target => "Tage" )
|
||||
Translation.create( :locale => 'de', :source => "hour", :target => "Stunde" )
|
||||
Translation.create( :locale => 'de', :source => "hours", :target => "Stunden" )
|
||||
Translation.create( :locale => 'de', :source => "minute", :target => "Minute" )
|
||||
Translation.create( :locale => 'de', :source => "minutes", :target => "Minuten" )
|
||||
Translation.create( :locale => 'de', :source => "See more", :target => "mehr anzeigen" )
|
||||
Translation.create( :locale => 'de', :source => "Search", :target => "Suche" )
|
||||
Translation.create( :locale => 'de', :source => "Forgot your password?", :target => "Passwort vergessen?" )
|
||||
Translation.create( :locale => 'de', :source => "Templates", :target => "Vorlagen" )
|
||||
Translation.create( :locale => 'de', :source => "Delete", :target => "Löschen" )
|
||||
Translation.create( :locale => 'de', :source => "Apply", :target => "Übernehmen" )
|
||||
Translation.create( :locale => 'de', :source => "Save as Template", :target => "Als Template speichern" )
|
||||
Translation.create( :locale => 'de', :source => "Save", :target => "Speichern" )
|
||||
Translation.create( :locale => 'de', :source => "Open Tickets", :target => "Offene Ticket" )
|
||||
Translation.create( :locale => 'de', :source => "Closed Tickets", :target => "Geschlossene Ticket" )
|
||||
Translation.create( :locale => 'de', :source => "set to internal", :target => "auf intern setzen" )
|
||||
Translation.create( :locale => 'de', :source => "set to public", :target => "auf öffentlich setzen" )
|
||||
Translation.create( :locale => 'de', :source => "split", :target => "teilen" )
|
||||
Translation.create( :locale => 'de', :source => "Type", :target => "Typ" )
|
||||
Translation.create( :locale => 'de', :source => "raw", :target => "unverarbeitet" )
|
||||
Translation.create( :locale => 'de', :source => "1 low", :target => "1 niedrig" )
|
||||
Translation.create( :locale => 'de', :source => "2 normal", :target => "2 normal" )
|
||||
Translation.create( :locale => 'de', :source => "3 high", :target => "3 hoch" )
|
||||
Translation.create( :locale => 'de', :source => "public", :target => "öffentlich" )
|
||||
Translation.create( :locale => 'de', :source => "internal", :target => "intern" )
|
||||
Translation.create( :locale => 'de', :source => "Attach files", :target => "Dateien anhängen" )
|
||||
Translation.create( :locale => 'de', :source => "Visability", :target => "Sichtbarkeit" )
|
||||
Translation.create( :locale => 'de', :source => "Actions", :target => "Aktionen" )
|
||||
Translation.create( :locale => 'de', :source => "email", :target => "E-Mail" )
|
||||
Translation.create( :locale => 'de', :source => "phone", :target => "Telefon" )
|
||||
Translation.create( :locale => 'de', :source => "fax", :target => "Fax" )
|
||||
Translation.create( :locale => 'de', :source => "chat", :target => "Chat" )
|
||||
Translation.create( :locale => 'de', :source => "sms", :target => "SMS" )
|
||||
Translation.create( :locale => 'de', :source => "twitter status", :target => "Twitter Status Meldung" )
|
||||
Translation.create( :locale => 'de', :source => "twitter direct-message", :target => "Twitter Direkt-Nachricht" )
|
||||
Translation.create( :locale => 'de', :source => "All Open Tickets", :target => "Alle offenen Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "child", :target => "Kind" )
|
||||
Translation.create( :locale => 'de', :source => "parent", :target => "Eltern" )
|
||||
Translation.create( :locale => 'de', :source => "normal", :target => "Normal" )
|
||||
Translation.create( :locale => 'de', :source => "Linked Objects", :target => "Verknüpfte Objekte" )
|
||||
Translation.create( :locale => 'de', :source => "Links", :target => "Verknüpftungen" )
|
||||
Translation.create( :locale => 'de', :source => "Change Customer", :target => "Kunden ändern" )
|
||||
Translation.create( :locale => 'de', :source => "My Tickets", :target => "Meine Tickets" )
|
||||
Translation.create( :locale => 'de', :source => "Assignment Timout", :target => "Zeitliche Zuweisungsüberschritung" )
|
||||
Translation.create( :locale => 'de', :source => "New", :target => "Neu", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Create", :target => "Erstellen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Cancel", :target => "Abbrechen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Submit", :target => "Übermitteln", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Sign out", :target => "Abmelden", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Profile", :target => "Profil", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Settings", :target => "Einstellungen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Overviews", :target => "Übersichten", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Manage", :target => "Verwalten", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Users", :target => "Benutzer", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Groups", :target => "Gruppen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Group", :target => "Gruppe", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Organizations", :target => "Organisationen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Organization", :target => "Organisation", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Recent Viewed", :target => "Zuletzt angesehen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Security", :target => "Sicherheit", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "From", :target => "Von", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Title", :target => "Titel", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Customer", :target => "Kunde", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "State", :target => "Status", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Created", :target => "Erstellt", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Attributes", :target => "Attribute", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Direction", :target => "Richtung", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Owner", :target => "Besitzer", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Subject", :target => "Betreff", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Priority", :target => "Priorität", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Select the customer of the Ticket or create one.", :target => "Wähle den Kunden eine Tickets oder erstell einen neuen.", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "New Ticket", :target => "Neues Ticket", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Firstname", :target => "Vorname", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Lastname", :target => "Nachname", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Phone", :target => "Telefon", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Street", :target => "Straße", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Zip", :target => "PLZ", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "City", :target => "Stadt", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Note", :target => "Notiz", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "note", :target => "Notiz", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "New User", :target => "Neuer Benutzer", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Merge", :target => "Zusammenfügen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "History", :target => "Historie", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "new", :target => "neu", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "closed", :target => "geschlossen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "open", :target => "offen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "pending", :target => "warten", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "merged", :target => "zusammengefügt", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "removed", :target => "zurück gezogen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Activity Stream", :target => "Aktivitäts-Stream", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "updated", :target => "aktuallisierte", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "created", :target => "erstellte", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "My assigned Tickets", :target => "Meine zugewisenen Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Unassigned Tickets", :target => "Nicht zugewisene/freie Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Unassigned & Open Tickets", :target => "Nicht zugewisene & offene Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "All Tickets", :target => "Alle Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Escalated Tickets", :target => "Eskallierte Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "My pending reached Tickets", :target => "Meine warten erreicht Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Password", :target => "Passwort", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Password (confirm)", :target => "Passwort (bestätigen)", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Roles", :target => "Rollen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Active", :target => "Aktiv", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Edit", :target => "Bearbeiten", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Base", :target => "Basis", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Number", :target => "Nummer", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Sender Format", :target => "Absender Format", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Authentication", :target => "Authorisierung", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Product Name", :target => "Produkt Name", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "To", :target => "An", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Customer", :target => "Kunde", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Linked Accounts", :target => "Verknüpfte Accounts", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Sign in with", :target => "Anmelden mit", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Username or email", :target => "Benutzer oder Email", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Remember me", :target => "An mich erinnern", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Forgot password?", :target => "Passwort vergessen?", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Sign in using", :target => "Anmelden über", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "New to", :target => "Neu bei", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "join today!", :target => "werde Teil!", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Sign up", :target => "Registrieren", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Sign in", :target => "Anmelden", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Create my account", :target => "Meinen Account erstellen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Login successfully! Have a nice day!", :target => "Anmeldung erfolgreich!", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Last contact", :target => "Letzter Kontakt", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Last contact (Agent)", :target => "Letzter Kontakt (Agent)", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Last contact (Customer)", :target => "Letzter Kontakt (Kunde)", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Close time", :target => "Schließzeit", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "First response", :target => "Erste Reaktion", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Ticket %s created!", :target => "Ticket %s erstellt!", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "day", :target => "Tag", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "days", :target => "Tage", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "hour", :target => "Stunde", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "hours", :target => "Stunden", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "minute", :target => "Minute", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "minutes", :target => "Minuten", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "See more", :target => "mehr anzeigen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Search", :target => "Suche", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Forgot your password?", :target => "Passwort vergessen?", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Templates", :target => "Vorlagen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Delete", :target => "Löschen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Apply", :target => "Übernehmen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Save as Template", :target => "Als Template speichern", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Save", :target => "Speichern", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Open Tickets", :target => "Offene Ticket", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Closed Tickets", :target => "Geschlossene Ticket", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "set to internal", :target => "auf intern setzen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "set to public", :target => "auf öffentlich setzen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "split", :target => "teilen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Type", :target => "Typ", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "raw", :target => "unverarbeitet", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "1 low", :target => "1 niedrig", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "2 normal", :target => "2 normal", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "3 high", :target => "3 hoch", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "public", :target => "öffentlich", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "internal", :target => "intern", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Attach files", :target => "Dateien anhängen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Visability", :target => "Sichtbarkeit", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Actions", :target => "Aktionen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "email", :target => "E-Mail", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "phone", :target => "Telefon", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "fax", :target => "Fax", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "chat", :target => "Chat", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "sms", :target => "SMS", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "twitter status", :target => "Twitter Status Meldung", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "twitter direct-message", :target => "Twitter Direkt-Nachricht", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "All Open Tickets", :target => "Alle offenen Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "child", :target => "Kind", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "parent", :target => "Eltern", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "normal", :target => "Normal", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Linked Objects", :target => "Verknüpfte Objekte", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Links", :target => "Verknüpftungen", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Change Customer", :target => "Kunden ändern", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "My Tickets", :target => "Meine Tickets", :updated_by_id => 1, :created_by_id => 1 )
|
||||
Translation.create( :locale => 'de', :source => "Assignment Timout", :target => "Zeitliche Zuweisungsüberschritung", :updated_by_id => 1, :created_by_id => 1 )
|
||||
|
||||
#Translation.create( :locale => 'de', :source => "", :target => "" )
|
||||
|
|
|
@ -402,27 +402,27 @@ class ClientState
|
|||
self.ticket( ticket_id, tickets, users )
|
||||
}
|
||||
|
||||
# get groups
|
||||
group_ids = []
|
||||
Group.where( :active => true ).each { |group|
|
||||
group_ids.push group.id
|
||||
}
|
||||
agents = {}
|
||||
Ticket.agents.each { |user|
|
||||
agents[ user.id ] = 1
|
||||
}
|
||||
groups_users = {}
|
||||
groups_users[''] = []
|
||||
group_ids.each {|group_id|
|
||||
groups_users[ group_id ] = []
|
||||
Group.find(group_id).users.each {|user|
|
||||
next if !agents[ user.id ]
|
||||
groups_users[ group_id ].push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
}
|
||||
# get groups
|
||||
group_ids = []
|
||||
Group.where( :active => true ).each { |group|
|
||||
group_ids.push group.id
|
||||
}
|
||||
agents = {}
|
||||
Ticket.agents.each { |user|
|
||||
agents[ user.id ] = 1
|
||||
}
|
||||
groups_users = {}
|
||||
groups_users[''] = []
|
||||
group_ids.each {|group_id|
|
||||
groups_users[ group_id ] = []
|
||||
Group.find(group_id).users.each {|user|
|
||||
next if !agents[ user.id ]
|
||||
groups_users[ group_id ].push user.id
|
||||
if !users[user.id]
|
||||
users[user.id] = User.user_data_full(user.id)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
# send update to browser
|
||||
self.transaction({
|
||||
|
|
Loading…
Reference in a new issue