Merge branch 'develop' into feature/ui2

This commit is contained in:
Martin Edenhofer 2013-08-21 21:40:18 +02:00
commit 1dc7545075
42 changed files with 349 additions and 367 deletions

View file

@ -120,6 +120,8 @@ class Taskbar extends App.Controller
tasks = App.TaskManager.all()
item_list = []
for task in tasks
# collect meta data of task for task bar item
data =
url: '#'
id: false
@ -128,8 +130,13 @@ class Taskbar extends App.Controller
worker = App.TaskManager.worker( task.key )
if worker
meta = worker.meta()
# apply meta data of controller
if meta
data = meta
for key, value of meta
data[key] = value
# collect new task bar items
item = {}
item.task = task
item.data = data

View file

@ -35,16 +35,16 @@ class App.TicketZoom extends App.Controller
)
meta: =>
return if !@ticket
ticket = App.Ticket.retrieve( @ticket.id )
meta =
url: @url()
head: ticket.title
title: '#' + ticket.number + ' - ' + ticket.title
id: ticket.id
url: @url()
id: @ticket_id
if @ticket
meta.head = @ticket.title
meta.title = '#' + @ticket.number + ' - ' + @ticket.title
meta
url: =>
'#ticket/zoom/' + @ticket.id
'#ticket/zoom/' + @ticket_id
activate: =>
@navupdate '#'
@ -106,9 +106,6 @@ class App.TicketZoom extends App.Controller
load: (data, force) =>
# reset old indexes
@ticket = undefined
# remember article ids
@ticket_article_ids = data.ticket_article_ids
@ -121,14 +118,14 @@ class App.TicketZoom extends App.Controller
# load collections
App.Event.trigger 'loadAssets', data.assets
# get data
@ticket = App.Ticket.retrieve( @ticket_id )
# render page
@render(force)
render: (force) =>
# get data
@ticket = App.Ticket.retrieve( @ticket_id )
# update taskbar with new meta data
App.Event.trigger 'task:render'
if !@renderDone

View file

@ -29,10 +29,10 @@ class _trackSingleton
@log( 'start', 'notice', {} )
# start initial submit 10 sec. later to avoid ie10 cookie issues
# start initial submit 30 sec. later to avoid ie10 cookie issues
delay = =>
App.Interval.set @send, 60000
App.Delay.set delay, 10000
App.Interval.set @send, 80000
App.Delay.set delay, 30000
# log clicks
$(document).bind(
@ -139,9 +139,15 @@ class _trackSingleton
@data
`
window.onerror = function(errorMsg, url, lineNumber) {
console.error(errorMsg + " - in " + url + ", line " + lineNumber);
};
(function() {
window.onerrorOld = window.onerror
window.onerror = function(errorMsg, url, lineNumber) {
console.error(errorMsg + " - in " + url + ", line " + lineNumber);
if (window.onerrorOld) {
window.onerrorOld(errorMsg, url, lineNumber);
}
}
}).call(this);
(function() {
var console = window.console

View file

@ -83,6 +83,10 @@ class App.Auth
for key, value of data.session
App.Session.set( key, value )
# refresh default collections
for key, value of data.default_collections
App[key].refresh( value, options: { clear: true } )
App.Event.trigger( 'auth', data.session )
# init of i18n
@ -93,10 +97,6 @@ class App.Auth
locale = window.navigator.userLanguage || window.navigator.language || 'en'
App.i18n.set( locale )
# refresh default collections
for key, value of data.default_collections
App[key].refresh( value, options: { clear: true } )
App.Event.trigger( 'auth:login', data.session )
App.Event.trigger( 'ui:rerender' )

View file

@ -375,14 +375,14 @@ class _taskManagerSingleton extends App.Controller
for task in @allTasks
task_count += 1
console.log('START', task)
App.Delay.set(
=>
task = tasks.shift()
@add(task.key, task.callback, task.params, true)
task_count * 300
undefined
'task'
)
do (task) =>
App.Delay.set(
=>
@add(task.key, task.callback, task.params, true)
task_count * 900
undefined
'task'
)
App.Event.trigger 'taskbar:ready'

View file

@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
:mode_show_rendeder,
:model_index_render
before_filter :set_user, :session_update
before_filter :log_request, :set_user, :session_update
before_filter :cors_preflight_check
after_filter :set_access_control_headers
@ -52,6 +52,10 @@ class ApplicationController < ActionController::Base
Observer::Ticket::Notification.transaction
end
def log_request
puts Time.now().to_s + ' ' + request.original_fullpath.to_s
end
# Finds the User with the ID stored in the session with the key
# :current_user_id This is a common way to handle user login in
# a Rails application; logging in sets the session value and

View file

@ -26,7 +26,7 @@ class LongPollingController < ApplicationController
# spool messages for new connects
if params['data']['spool']
msg = JSON.generate( params['data'] )
Session.spool_create(msg)
Sessions.spool_create(msg)
end
# get spool messages and send them to new client connection
@ -40,14 +40,14 @@ class LongPollingController < ApplicationController
end
if current_user
spool = Session.spool_list( params['data']['timestamp'], current_user.id )
spool = Sessions.spool_list( params['data']['timestamp'], current_user.id )
spool.each { |item|
if item[:type] == 'direct'
log 'notice', "send spool to (user_id=#{ current_user.id })", client_id
Session.send( client_id, item[:message] )
Sessions.send( client_id, item[:message] )
else
log 'notice', "send spool", client_id
Session.send( client_id, item[:message] )
Sessions.send( client_id, item[:message] )
end
}
end
@ -55,7 +55,7 @@ class LongPollingController < ApplicationController
# send spool:sent event to client
sleep 0.2
log 'notice', "send spool:sent event", client_id
Session.send( client_id, { :event => 'spool:sent', :data => { :timestamp => Time.now.utc.to_i } } )
Sessions.send( client_id, { :event => 'spool:sent', :data => { :timestamp => Time.now.utc.to_i } } )
end
@ -67,13 +67,13 @@ class LongPollingController < ApplicationController
user = User.user_data_full( user_id )
end
log 'notice', "send auth login (user_id #{user_id})", client_id
Session.create( client_id, user, { :type => 'ajax' } )
Sessions.create( client_id, user, { :type => 'ajax' } )
# broadcast
elsif params['data']['action'] == 'broadcast'
# list all current clients
client_list = Session.list
client_list = Sessions.list
client_list.each {|local_client_id, local_client|
if local_client_id != client_id
@ -82,13 +82,13 @@ class LongPollingController < ApplicationController
params['data']['recipient']['user_id'].each { |user_id|
if local_client[:user][:id] == user_id
log 'notice', "send broadcast from (#{client_id.to_s}) to (user_id #{user_id})", local_client_id
Session.send( local_client_id, params['data'] )
Sessions.send( local_client_id, params['data'] )
end
}
# broadcast every client
else
log 'notice', "send broadcast from (#{client_id.to_s})", local_client_id
Session.send( local_client_id, params['data'] )
Sessions.send( local_client_id, params['data'] )
end
else
log 'notice', "do not send broadcast to it self", client_id
@ -119,13 +119,13 @@ class LongPollingController < ApplicationController
# update last ping
sleep 1
Session.touch( client_id )
Sessions.touch( client_id )
# set max loop time to 24 sec. because of 30 sec. timeout of mod_proxy
count = 12
while true
count = count - 1
queue = Session.queue( client_id )
queue = Sessions.queue( client_id )
if queue && queue[0]
# puts "send " + queue.inspect + client_id.to_s
render :json => queue
@ -155,7 +155,7 @@ class LongPollingController < ApplicationController
end
def client_id_verify
return if !params[:client_id]
sessions = Session.sessions
sessions = Sessions.sessions
return if !sessions.include?( params[:client_id].to_s )
return true
end

View file

@ -1,5 +1,7 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
require 'ticket/overviews'
class TicketOverviewsController < ApplicationController
before_filter :authentication_check

View file

@ -2,7 +2,7 @@
require 'cache'
require 'user_info'
require 'session'
require 'sessions'
class ApplicationModel < ActiveRecord::Base
self.abstract_class = true
@ -340,7 +340,7 @@ class OwnModel < ApplicationModel
class_name = self.class.name
class_name.gsub!(/::/, '')
Session.broadcast(
Sessions.broadcast(
:event => class_name + ':created',
:data => { :id => self.id, :updated_at => self.updated_at }
)
@ -368,7 +368,7 @@ class OwnModel < ApplicationModel
puts "#{self.class.name.downcase} UPDATED " + self.updated_at.to_s
class_name = self.class.name
class_name.gsub!(/::/, '')
Session.broadcast(
Sessions.broadcast(
:event => class_name + ':updated',
:data => { :id => self.id, :updated_at => self.updated_at }
)
@ -395,7 +395,7 @@ class OwnModel < ApplicationModel
puts "#{self.class.name.downcase} DESTOY " + self.updated_at.to_s
class_name = self.class.name
class_name.gsub!(/::/, '')
Session.broadcast(
Sessions.broadcast(
:event => class_name + ':destroy',
:data => { :id => self.id, :updated_at => self.updated_at }
)

View file

@ -82,5 +82,8 @@ module Zammad
# Enable threaded mode
config.threadsafe!
# catch all router files
config.paths['config/routes'] += Dir[Rails.root.join("config/routes/*.rb")]
end
end

View file

@ -8,11 +8,4 @@ Zammad::Application.routes.draw do
# just remember to delete public/index.html.
root :to => 'init#index', :via => :get
# load routes from external files
dir = File.expand_path('../', __FILE__)
files = Dir.glob( "#{dir}/routes/*.rb" )
for file in files
require file
ExtraRoutes.add(self, Rails.configuration.api_path)
end
end
end

View file

@ -1,8 +1,6 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
map.match api_path + '/activity_stream', :to => 'activity#activity_stream', :via => :get
match api_path + '/activity_stream', :to => 'activity#activity_stream', :via => :get
end
module_function :add
end
end

View file

@ -1,19 +1,18 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# omniauth
map.match '/auth/:provider/callback', :to => 'sessions#create_omniauth',:via => [:post, :get, :puts, :delete]
# omniauth
match '/auth/:provider/callback', :to => 'sessions#create_omniauth',:via => [:post, :get, :puts, :delete]
# sso
map.match '/auth/sso', :to => 'sessions#create_sso', :via => [:post, :get]
# sso
match '/auth/sso', :to => 'sessions#create_sso', :via => [:post, :get]
# sessions
map.match api_path + '/signin', :to => 'sessions#create', :via => :post
map.match api_path + '/signshow', :to => 'sessions#show', :via => :get
map.match api_path + '/signout', :to => 'sessions#destroy', :via => [:get, :delete]
# sessions
match api_path + '/signin', :to => 'sessions#create', :via => :post
match api_path + '/signshow', :to => 'sessions#show', :via => :get
match api_path + '/signout', :to => 'sessions#destroy', :via => [:get, :delete]
map.match api_path + '/sessions', :to => 'sessions#list', :via => :get
map.match api_path + '/sessions/:id', :to => 'sessions#delete', :via => :delete
end
module_function :add
end
match api_path + '/sessions', :to => 'sessions#list', :via => :get
match api_path + '/sessions/:id', :to => 'sessions#delete', :via => :delete
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# channels
map.match api_path + '/channels', :to => 'channels#index', :via => :get
map.match api_path + '/channels/:id', :to => 'channels#show', :via => :get
map.match api_path + '/channels', :to => 'channels#create', :via => :post
map.match api_path + '/channels/:id', :to => 'channels#update', :via => :put
map.match api_path + '/channels/:id', :to => 'channels#destroy', :via => :delete
# channels
match api_path + '/channels', :to => 'channels#index', :via => :get
match api_path + '/channels/:id', :to => 'channels#show', :via => :get
match api_path + '/channels', :to => 'channels#create', :via => :post
match api_path + '/channels/:id', :to => 'channels#update', :via => :put
match api_path + '/channels/:id', :to => 'channels#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,12 +1,10 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# groups
map.match api_path + '/email_addresses', :to => 'email_addresses#index', :via => :get
map.match api_path + '/email_addresses/:id', :to => 'email_addresses#show', :via => :get
map.match api_path + '/email_addresses', :to => 'email_addresses#create', :via => :post
map.match api_path + '/email_addresses/:id', :to => 'email_addresses#update', :via => :put
# groups
match api_path + '/email_addresses', :to => 'email_addresses#index', :via => :get
match api_path + '/email_addresses/:id', :to => 'email_addresses#show', :via => :get
match api_path + '/email_addresses', :to => 'email_addresses#create', :via => :post
match api_path + '/email_addresses/:id', :to => 'email_addresses#update', :via => :put
end
module_function :add
end

View file

@ -1,9 +1,7 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# getting_started
map.match api_path + '/getting_started', :to => 'getting_started#index', :via => :get
# getting_started
match api_path + '/getting_started', :to => 'getting_started#index', :via => :get
end
module_function :add
end
end

View file

@ -1,12 +1,10 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# groups
map.match api_path + '/groups', :to => 'groups#index', :via => :get
map.match api_path + '/groups/:id', :to => 'groups#show', :via => :get
map.match api_path + '/groups', :to => 'groups#create', :via => :post
map.match api_path + '/groups/:id', :to => 'groups#update', :via => :put
# groups
match api_path + '/groups', :to => 'groups#index', :via => :get
match api_path + '/groups/:id', :to => 'groups#show', :via => :get
match api_path + '/groups', :to => 'groups#create', :via => :post
match api_path + '/groups/:id', :to => 'groups#update', :via => :put
end
module_function :add
end

View file

@ -1,11 +1,9 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# links
map.match api_path + '/links', :to => 'links#index', :via => :get
map.match api_path + '/links/add', :to => 'links#add', :via => :get
map.match api_path + '/links/remove', :to => 'links#remove', :via => :get
# links
match api_path + '/links', :to => 'links#index', :via => :get
match api_path + '/links/add', :to => 'links#add', :via => :get
match api_path + '/links/remove', :to => 'links#remove', :via => :get
end
module_function :add
end
end

View file

@ -1,10 +1,8 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# messages
map.match api_path + '/message_send', :to => 'long_polling#message_send', :via => [ :get, :post ]
map.match api_path + '/message_receive', :to => 'long_polling#message_receive', :via => [ :get, :post ]
# messages
match api_path + '/message_send', :to => 'long_polling#message_send', :via => [ :get, :post ]
match api_path + '/message_receive', :to => 'long_polling#message_receive', :via => [ :get, :post ]
end
module_function :add
end
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# networkss
map.match api_path + '/networks', :to => 'networks#index', :via => :get
map.match api_path + '/networks/:id', :to => 'networks#show', :via => :get
map.match api_path + '/networks', :to => 'networks#create', :via => :post
map.match api_path + '/networks/:id', :to => 'networks#update', :via => :put
map.match api_path + '/networks/:id', :to => 'networks#destroy',:via => :delete
# networkss
match api_path + '/networks', :to => 'networks#index', :via => :get
match api_path + '/networks/:id', :to => 'networks#show', :via => :get
match api_path + '/networks', :to => 'networks#create', :via => :post
match api_path + '/networks/:id', :to => 'networks#update', :via => :put
match api_path + '/networks/:id', :to => 'networks#destroy',:via => :delete
end
module_function :add
end

View file

@ -1,12 +1,10 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# organizations
map.match api_path + '/organizations', :to => 'organizations#index', :via => :get
map.match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get
map.match api_path + '/organizations', :to => 'organizations#create', :via => :post
map.match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put
# organizations
match api_path + '/organizations', :to => 'organizations#index', :via => :get
match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get
match api_path + '/organizations', :to => 'organizations#create', :via => :post
match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put
end
module_function :add
end
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# overviews
map.match api_path + '/overviews', :to => 'overviews#index', :via => :get
map.match api_path + '/overviews/:id', :to => 'overviews#show', :via => :get
map.match api_path + '/overviews', :to => 'overviews#create', :via => :post
map.match api_path + '/overviews/:id', :to => 'overviews#update', :via => :put
map.match api_path + '/overviews/:id', :to => 'overviews#destroy', :via => :delete
# overviews
match api_path + '/overviews', :to => 'overviews#index', :via => :get
match api_path + '/overviews/:id', :to => 'overviews#show', :via => :get
match api_path + '/overviews', :to => 'overviews#create', :via => :post
match api_path + '/overviews/:id', :to => 'overviews#update', :via => :put
match api_path + '/overviews/:id', :to => 'overviews#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,11 +1,9 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# overviews
map.match api_path + '/packages', :to => 'packages#index', :via => :get
map.match api_path + '/packages', :to => 'packages#install', :via => :post
map.match api_path + '/packages', :to => 'packages#uninstall', :via => :delete
# overviews
match api_path + '/packages', :to => 'packages#index', :via => :get
match api_path + '/packages', :to => 'packages#install', :via => :post
match api_path + '/packages', :to => 'packages#uninstall', :via => :delete
end
module_function :add
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# postmaster_filters
map.match api_path + '/postmaster_filters', :to => 'postmaster_filters#index', :via => :get
map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#show', :via => :get
map.match api_path + '/postmaster_filters', :to => 'postmaster_filters#create', :via => :post
map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#update', :via => :put
map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#destroy', :via => :delete
# postmaster_filters
match api_path + '/postmaster_filters', :to => 'postmaster_filters#index', :via => :get
match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#show', :via => :get
match api_path + '/postmaster_filters', :to => 'postmaster_filters#create', :via => :post
match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#update', :via => :put
match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,8 +1,5 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
map.match api_path + '/recent_viewed', :to => 'recent_viewed#recent_viewed', :via => :get
end
module_function :add
end
match api_path + '/recent_viewed', :to => 'recent_viewed#recent_viewed', :via => :get
end

View file

@ -1,12 +1,10 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# roles
map.match api_path + '/roles', :to => 'roles#index', :via => :get
map.match api_path + '/roles/:id', :to => 'roles#show', :via => :get
map.match api_path + '/roles', :to => 'roles#create', :via => :post
map.match api_path + '/roles/:id', :to => 'roles#update', :via => :put
# roles
match api_path + '/roles', :to => 'roles#index', :via => :get
match api_path + '/roles/:id', :to => 'roles#show', :via => :get
match api_path + '/roles', :to => 'roles#create', :via => :post
match api_path + '/roles/:id', :to => 'roles#update', :via => :put
end
module_function :add
end

View file

@ -1,9 +1,7 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# rss
map.match api_path + '/rss_fetch', :to => 'rss#fetch', :via => :get
# rss
match api_path + '/rss_fetch', :to => 'rss#fetch', :via => :get
end
module_function :add
end
end

View file

@ -1,9 +1,7 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# search
map.match api_path + '/search', :to => 'search#search', :via => [:get, :post]
# search
match api_path + '/search', :to => 'search#search', :via => [:get, :post]
end
module_function :add
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# base objects
map.match api_path + '/settings', :to => 'settings#index', :via => :get
map.match api_path + '/settings/:id', :to => 'settings#show', :via => :get
map.match api_path + '/settings', :to => 'settings#create', :via => :post
map.match api_path + '/settings/:id', :to => 'settings#update', :via => :put
map.match api_path + '/settings/:id', :to => 'settings#destroy', :via => :delete
# base objects
match api_path + '/settings', :to => 'settings#index', :via => :get
match api_path + '/settings/:id', :to => 'settings#show', :via => :get
match api_path + '/settings', :to => 'settings#create', :via => :post
match api_path + '/settings/:id', :to => 'settings#update', :via => :put
match api_path + '/settings/:id', :to => 'settings#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# signatures
map.match api_path + '/signatures', :to => 'signatures#index', :via => :get
map.match api_path + '/signatures/:id', :to => 'signatures#show', :via => :get
map.match api_path + '/signatures', :to => 'signatures#create', :via => :post
map.match api_path + '/signatures/:id', :to => 'signatures#update', :via => :put
map.match api_path + '/signatures/:id', :to => 'signatures#destroy', :via => :delete
# signatures
match api_path + '/signatures', :to => 'signatures#index', :via => :get
match api_path + '/signatures/:id', :to => 'signatures#show', :via => :get
match api_path + '/signatures', :to => 'signatures#create', :via => :post
match api_path + '/signatures/:id', :to => 'signatures#update', :via => :put
match api_path + '/signatures/:id', :to => 'signatures#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# slas
map.match api_path + '/slas', :to => 'slas#index', :via => :get
map.match api_path + '/slas/:id', :to => 'slas#show', :via => :get
map.match api_path + '/slas', :to => 'slas#create', :via => :post
map.match api_path + '/slas/:id', :to => 'slas#update', :via => :put
map.match api_path + '/slas/:id', :to => 'slas#destroy', :via => :delete
# slas
match api_path + '/slas', :to => 'slas#index', :via => :get
match api_path + '/slas/:id', :to => 'slas#show', :via => :get
match api_path + '/slas', :to => 'slas#create', :via => :post
match api_path + '/slas/:id', :to => 'slas#update', :via => :put
match api_path + '/slas/:id', :to => 'slas#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,11 +1,9 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# links
map.match api_path + '/tags', :to => 'tags#list', :via => :get
map.match api_path + '/tags/add', :to => 'tags#add', :via => :get
map.match api_path + '/tags/remove', :to => 'tags#remove', :via => :get
# links
match api_path + '/tags', :to => 'tags#list', :via => :get
match api_path + '/tags/add', :to => 'tags#add', :via => :get
match api_path + '/tags/remove', :to => 'tags#remove', :via => :get
end
module_function :add
end
end

View file

@ -1,10 +1,10 @@
module ExtraRoutes
def add(map, api_path)
map.match api_path + '/taskbar', :to => 'taskbar#index', :via => :get
map.match api_path + '/taskbar/:id', :to => 'taskbar#show', :via => :get
map.match api_path + '/taskbar', :to => 'taskbar#create', :via => :post
map.match api_path + '/taskbar/:id', :to => 'taskbar#update', :via => :put
map.match api_path + '/taskbar/:id', :to => 'taskbar#destroy',:via => :delete
end
module_function :add
end
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
match api_path + '/taskbar', :to => 'taskbar#index', :via => :get
match api_path + '/taskbar/:id', :to => 'taskbar#show', :via => :get
match api_path + '/taskbar', :to => 'taskbar#create', :via => :post
match api_path + '/taskbar/:id', :to => 'taskbar#update', :via => :put
match api_path + '/taskbar/:id', :to => 'taskbar#destroy',:via => :delete
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# templates
map.match api_path + '/templates', :to => 'templates#index', :via => :get
map.match api_path + '/templates/:id', :to => 'templates#show', :via => :get
map.match api_path + '/templates', :to => 'templates#create', :via => :post
map.match api_path + '/templates/:id', :to => 'templates#update', :via => :put
map.match api_path + '/templates/:id', :to => 'templates#destroy', :via => :delete
# templates
match api_path + '/templates', :to => 'templates#index', :via => :get
match api_path + '/templates/:id', :to => 'templates#show', :via => :get
match api_path + '/templates', :to => 'templates#create', :via => :post
match api_path + '/templates/:id', :to => 'templates#update', :via => :put
match api_path + '/templates/:id', :to => 'templates#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,10 +1,7 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
map.match '/tests-core', :to => 'tests#core', :via => :get
map.match '/tests-form', :to => 'tests#form', :via => :get
map.match '/tests/wait/:sec', :to => 'tests#wait', :via => :get
match '/tests-core', :to => 'tests#core', :via => :get
match '/tests-form', :to => 'tests#form', :via => :get
match '/tests/wait/:sec', :to => 'tests#wait', :via => :get
end
module_function :add
end
end

View file

@ -1,13 +1,11 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# text_modules
map.match api_path + '/text_modules', :to => 'text_modules#index', :via => :get
map.match api_path + '/text_modules/:id', :to => 'text_modules#show', :via => :get
map.match api_path + '/text_modules', :to => 'text_modules#create', :via => :post
map.match api_path + '/text_modules/:id', :to => 'text_modules#update', :via => :put
map.match api_path + '/text_modules/:id', :to => 'text_modules#destroy', :via => :delete
# text_modules
match api_path + '/text_modules', :to => 'text_modules#index', :via => :get
match api_path + '/text_modules/:id', :to => 'text_modules#show', :via => :get
match api_path + '/text_modules', :to => 'text_modules#create', :via => :post
match api_path + '/text_modules/:id', :to => 'text_modules#update', :via => :put
match api_path + '/text_modules/:id', :to => 'text_modules#destroy', :via => :delete
end
module_function :add
end

View file

@ -1,43 +1,41 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# tickets
map.match api_path + '/tickets/search', :to => 'tickets#search', :via => [:get, :post]
map.match api_path + '/tickets', :to => 'tickets#index', :via => :get
map.match api_path + '/tickets/:id', :to => 'tickets#show', :via => :get
map.match api_path + '/tickets', :to => 'tickets#create', :via => :post
map.match api_path + '/tickets/:id', :to => 'tickets#update', :via => :put
map.match api_path + '/ticket_create', :to => 'tickets#ticket_create', :via => :get
map.match api_path + '/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get
map.match api_path + '/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get
map.match api_path + '/ticket_customer', :to => 'tickets#ticket_customer', :via => :get
map.match api_path + '/ticket_merge_list/:ticket_id', :to => 'tickets#ticket_merge_list', :via => :get
map.match api_path + '/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge', :via => :get
# tickets
match api_path + '/tickets/search', :to => 'tickets#search', :via => [:get, :post]
match api_path + '/tickets', :to => 'tickets#index', :via => :get
match api_path + '/tickets/:id', :to => 'tickets#show', :via => :get
match api_path + '/tickets', :to => 'tickets#create', :via => :post
match api_path + '/tickets/:id', :to => 'tickets#update', :via => :put
match api_path + '/ticket_create', :to => 'tickets#ticket_create', :via => :get
match api_path + '/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get
match api_path + '/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get
match api_path + '/ticket_customer', :to => 'tickets#ticket_customer', :via => :get
match api_path + '/ticket_merge_list/:ticket_id', :to => 'tickets#ticket_merge_list', :via => :get
match api_path + '/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge', :via => :get
# ticket overviews
map.match api_path + '/ticket_overviews', :to => 'ticket_overviews#show', :via => :get
# ticket overviews
match api_path + '/ticket_overviews', :to => 'ticket_overviews#show', :via => :get
# ticket priority
map.match api_path + '/ticket_priorities', :to => 'ticket_priorities#index', :via => :get
map.match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get
map.match api_path + '/ticket_priorities', :to => 'ticket_priorities#create', :via => :post
map.match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put
# ticket priority
match api_path + '/ticket_priorities', :to => 'ticket_priorities#index', :via => :get
match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get
match api_path + '/ticket_priorities', :to => 'ticket_priorities#create', :via => :post
match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put
# ticket state
map.match api_path + '/ticket_states', :to => 'ticket_states#index', :via => :get
map.match api_path + '/ticket_states/:id', :to => 'ticket_states#show', :via => :get
map.match api_path + '/ticket_states', :to => 'ticket_states#create', :via => :post
map.match api_path + '/ticket_states/:id', :to => 'ticket_states#update', :via => :put
# ticket state
match api_path + '/ticket_states', :to => 'ticket_states#index', :via => :get
match api_path + '/ticket_states/:id', :to => 'ticket_states#show', :via => :get
match api_path + '/ticket_states', :to => 'ticket_states#create', :via => :post
match api_path + '/ticket_states/:id', :to => 'ticket_states#update', :via => :put
# ticket articles
map.match api_path + '/ticket_articles', :to => 'ticket_articles#index', :via => :get
map.match api_path + '/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get
map.match api_path + '/ticket_articles', :to => 'ticket_articles#create', :via => :post
map.match api_path + '/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put
map.match api_path + '/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment', :via => :get
map.match api_path + '/ticket_attachment_new', :to => 'ticket_articles#attachment_new', :via => :post
map.match api_path + '/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get
# ticket articles
match api_path + '/ticket_articles', :to => 'ticket_articles#index', :via => :get
match api_path + '/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get
match api_path + '/ticket_articles', :to => 'ticket_articles#create', :via => :post
match api_path + '/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put
match api_path + '/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment', :via => :get
match api_path + '/ticket_attachment_new', :to => 'ticket_articles#attachment_new', :via => :post
match api_path + '/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get
end
module_function :add
end
end

View file

@ -1,12 +1,11 @@
module ExtraRoutes
def add(map, api_path)
map.match api_path + '/translations', :to => 'translations#index', :via => :get
map.match api_path + '/translations/:id', :to => 'translations#show', :via => :get
map.match api_path + '/translations', :to => 'translations#create', :via => :post
map.match api_path + '/translations/:id', :to => 'translations#update', :via => :put
map.match api_path + '/translations/:id', :to => 'translations#destroy', :via => :delete
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
map.match api_path + '/translations/lang/:locale', :to => 'translations#load', :via => :get
end
module_function :add
end
match api_path + '/translations', :to => 'translations#index', :via => :get
match api_path + '/translations/:id', :to => 'translations#show', :via => :get
match api_path + '/translations', :to => 'translations#create', :via => :post
match api_path + '/translations/:id', :to => 'translations#update', :via => :put
match api_path + '/translations/:id', :to => 'translations#destroy', :via => :delete
match api_path + '/translations/lang/:locale', :to => 'translations#load', :via => :get
end

View file

@ -1,18 +1,16 @@
module ExtraRoutes
def add(map, api_path)
Zammad::Application.routes.draw do
api_path = Rails.configuration.api_path
# users
map.match api_path + '/users/search', :to => 'users#search', :via => [:get, :post]
map.match api_path + '/users/password_reset', :to => 'users#password_reset_send', :via => :post
map.match api_path + '/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :post
map.match api_path + '/users/password_change', :to => 'users#password_change', :via => :post
map.match api_path + '/users/preferences', :to => 'users#preferences', :via => :put
map.match api_path + '/users/account', :to => 'users#account_remove', :via => :delete
map.match api_path + '/users', :to => 'users#index', :via => :get
map.match api_path + '/users/:id', :to => 'users#show', :via => :get
map.match api_path + '/users', :to => 'users#create', :via => :post
map.match api_path + '/users/:id', :to => 'users#update', :via => :put
# users
match api_path + '/users/search', :to => 'users#search', :via => [:get, :post]
match api_path + '/users/password_reset', :to => 'users#password_reset_send', :via => :post
match api_path + '/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :post
match api_path + '/users/password_change', :to => 'users#password_change', :via => :post
match api_path + '/users/preferences', :to => 'users#preferences', :via => :put
match api_path + '/users/account', :to => 'users#account_remove', :via => :delete
match api_path + '/users', :to => 'users#index', :via => :get
match api_path + '/users/:id', :to => 'users#show', :via => :get
match api_path + '/users', :to => 'users#create', :via => :post
match api_path + '/users/:id', :to => 'users#update', :via => :put
end
module_function :add
end

View file

@ -2,7 +2,7 @@ require 'json'
require 'rss'
require 'session_helper'
module Session
module Sessions
# get application root directory
@root = Dir.pwd.to_s
@ -205,7 +205,7 @@ module Session
next if @@client_threads[client_id]
# get current user
session_data = Session.get( client_id )
session_data = Sessions.get( client_id )
next if !session_data
next if !session_data[:user]
next if !session_data[:user][:id]
@ -272,7 +272,7 @@ module Session
files.sort.each {|entry|
filename = path + '/' + entry
if /^send/.match( entry )
data.push Session.queue_file( path, entry )
data.push Sessions.queue_file( path, entry )
end
}
return data
@ -297,7 +297,7 @@ module Session
# list all current clients
client_list = self.list
client_list.each {|local_client_id, local_client|
Session.send( local_client_id, data )
Sessions.send( local_client_id, data )
}
return true
end
@ -552,7 +552,7 @@ class ClientState
while true
# get connection user
session_data = Session.get( @client_id )
session_data = Sessions.get( @client_id )
return if !session_data
return if !session_data[:user]
return if !session_data[:user][:id]
@ -851,7 +851,7 @@ class ClientState
# send update to browser
def send( data )
Session.send( @client_id, data )
Sessions.send( @client_id, data )
end
def log( level, data )

View file

@ -8,7 +8,7 @@ require 'eventmachine'
require 'em-websocket'
require 'json'
require 'fileutils'
require 'session'
require 'sessions'
require 'optparse'
require 'daemons'
@ -91,7 +91,7 @@ EventMachine.run {
ws.onopen {
client_id = ws.object_id.to_s
log 'notice', 'Client connected.', client_id
Session.create( client_id, {}, { :type => 'websocket' } )
Sessions.create( client_id, {}, { :type => 'websocket' } )
if !@clients.include? client_id
@clients[client_id] = {
@ -112,7 +112,7 @@ EventMachine.run {
@clients.delete client_id
end
Session.destory( client_id )
Sessions.destory( client_id )
}
# manage messages
@ -132,7 +132,7 @@ EventMachine.run {
# spool messages for new connects
if data['spool']
Session.spool_create(msg)
Sessions.spool_create(msg)
end
# get spool messages and send them to new client connection
@ -146,7 +146,7 @@ EventMachine.run {
end
if @clients[client_id] && @clients[client_id][:session] && @clients[client_id][:session]['id']
spool = Session.spool_list( data['timestamp'], @clients[client_id][:session]['id'] )
spool = Sessions.spool_list( data['timestamp'], @clients[client_id][:session]['id'] )
spool.each { |item|
# create new msg to push to client
@ -171,7 +171,7 @@ EventMachine.run {
# get session
if data['action'] == 'login'
@clients[client_id][:session] = data['session']
Session.create( client_id, data['session'], { :type => 'websocket' } )
Sessions.create( client_id, data['session'], { :type => 'websocket' } )
# remember ping, send pong back
elsif data['action'] == 'ping'
@ -182,7 +182,7 @@ EventMachine.run {
elsif data['action'] == 'broadcast'
# list all current clients
client_list = Session.list
client_list = Sessions.list
client_list.each {|local_client_id, local_client|
if local_client_id != client_id
@ -203,7 +203,7 @@ EventMachine.run {
if local_client[:meta][:type] == 'websocket' && @clients[ local_client_id ]
@clients[ local_client_id ][:websocket].send( "[#{msg}]" )
else
Session.send( local_client_id, data )
Sessions.send( local_client_id, data )
end
end
}
@ -217,7 +217,7 @@ EventMachine.run {
if local_client[:meta][:type] == 'websocket' && @clients[ local_client_id ]
@clients[ local_client_id ][:websocket].send( "[#{msg}]" )
else
Session.send( local_client_id, data )
Sessions.send( local_client_id, data )
end
end
else
@ -247,7 +247,7 @@ EventMachine.run {
}
# ajax
client_list = Session.list
client_list = Sessions.list
clients = 0
client_list.each {|client_id, client|
next if client[:meta][:type] == 'websocket'
@ -268,7 +268,7 @@ EventMachine.run {
next if client[:disconnect]
log 'debug', 'checking for data...', client_id
begin
queue = Session.queue( client_id )
queue = Sessions.queue( client_id )
if queue && queue[0]
# log "send " + queue.inspect, client_id
log 'notice', "send data to client", client_id
@ -312,12 +312,12 @@ EventMachine.run {
}
# ajax
clients = Session.list
clients = Sessions.list
clients.each { |client_id, client|
next if client[:meta][:type] == 'websocket'
if ( client[:meta][:last_ping].to_i + ( 60 * idle_time_in_min ) ) < Time.now.to_i
log 'notice', "closing idle ajax connection", client_id
Session.destory( client_id )
Sessions.destory( client_id )
end
}
end

View file

@ -52,11 +52,35 @@ class TestCase < Test::Unit::TestCase
end
end
local_browser.manage.timeouts.implicit_wait = 3 # seconds
browser_instance_js_on_start(local_browser)
end
def browser_instance_js_on_start(instance)
instance.execute_script('
window.jsErrors = [];
window.onerror = function(errorMessage) {
window.jsErrors.push(errorMessage);
};');
end
def browser_instance_js_on_teardown(instance)
result = instance.execute_script( 'return window.jsErrors;' )
if result
puts 'JS ERRORS: ' + result.inspect
else
puts 'JS ERRORS: -none-'
end
end
def teardown
return if !@browsers
# show js errors
@browsers.each{ |local_browser|
browser_instance_js_on_teardown(local_browser)
}
# only shut down browser type once on local webdriver tests
# otherwise this error will happen "Errno::ECONNREFUSED: Connection refused - connect(2)"
if !ENV['REMOTE_URL']
@ -160,7 +184,7 @@ class TestCase < Test::Unit::TestCase
end
def browser_element_action(test, action, instance)
puts "NOTICE #{Time.now.to_s}: " + action.inspect
puts "NOTICE #{Time.now.to_s}: " + action.inspect
sleep 0.1
if action[:css]
if action[:css].match '###stack###'