Merge branch 'develop' into feature/ui2

This commit is contained in:
Martin Edenhofer 2013-08-05 00:10:07 +02:00
commit 7ecee95998
24 changed files with 472 additions and 263 deletions

1
.gitignore vendored
View file

@ -15,6 +15,7 @@
/tmp/websocket/*
/tmp/cache/*
/tmp/pids/*
/public/assets/*
# Ignore .project files
/.project

View file

@ -1,6 +1,6 @@
source 'http://rubygems.org'
gem 'rails', '3.2.13'
gem 'rails', '3.2.14'
# preparation for rails 4
#gem 'rails', '4.0.0.rc1'
@ -23,7 +23,7 @@ group :assets do
# gem 'coffee-rails', '~> 4.0.0.rc1'
gem 'sass-rails', '~> 3.2.4'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '>= 1.2.3'
gem 'uglifier'
end
gem 'omniauth'

View file

@ -10,7 +10,7 @@ class App.Controller extends Spine.Controller
super
# generate controllerId
@controllerId = 'controller-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
@controllerId = 'controller-' + new Date().getTime() + '-' + Math.floor( Math.random() * 999999 )
# apply to release controller on dom remove
@el.on('remove', @releaseController)

View file

@ -151,7 +151,7 @@ class Settings extends App.ControllerModal
# { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', },
# { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
# { name: 'internal', display: 'Visability', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
# { name: 'internal', display: 'Visibility', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
{
name: 'per_page',
display: 'Items per page',

View file

@ -5,7 +5,7 @@ class Index extends App.ControllerContent
constructor: ->
super
# navigate to # if sesstion if exists
# navigate to # if session if exists
if @Session.get( 'id' )
@navigate '#'
return

View file

@ -43,7 +43,6 @@ class Index extends App.ControllerContent
e.preventDefault()
id = $(e.target).parents('[data-id]').data('id')
type = $(e.target).data('type')
console.log 'ID', id, type
if type is 'uninstall'
httpType = 'DELETE'

View file

@ -365,7 +365,7 @@ class Settings extends App.ControllerModal
# { name: 'from', display: 'From', tag: 'input', type: 'text', limit: 100, null: false, class: 'span8', },
# { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
# { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
# { name: 'internal', display: 'Visability', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
# { name: 'internal', display: 'Visibility', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
{
name: 'per_page'
display: 'Items per page'

View file

@ -345,7 +345,7 @@ class Edit extends App.Controller
@configure_attributes_article = [
{ name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', filter: @edit_form, default: '9', translate: true, class: 'medium' },
{ name: 'internal', display: 'Visability', tag: 'select', null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
{ name: 'internal', display: 'Visibility', tag: 'select', null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
{ name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },
{ name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },
# { name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', hide: true },

View file

@ -36,5 +36,10 @@ class _Singleton
@_log( module, level, args )
_log: ( module, level, args ) ->
if level is 'error'
console.error "App.#{module}(#{level})", args
else if level is 'debug'
console.debug "App.#{module}(#{level})", args
else
console.log "App.#{module}(#{level})", args

View file

@ -0,0 +1,173 @@
class App.Track
_instance = undefined
@init: ->
_instance ?= new _trackSingleton
@log: ( area, level, args ) ->
if _instance == undefined
_instance ?= new _trackSingleton
_instance.log( area, level, args )
@send: ->
if _instance == undefined
_instance ?= new _trackSingleton
_instance.send()
@_all: ->
if _instance == undefined
_instance ?= new _trackSingleton
_instance._all()
class _trackSingleton
constructor: ->
@trackId = 'track-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
@browser = App.Browser.detection()
@data = []
@url = 'https://portal.znuny.com/api/ui'
# @url = 'api/ui'
@log( 'start', 'notice', {} )
App.Interval.set @send, 60000
# log clicks
$(document).bind(
'click'
(e) =>
w = window.screen.width
h = window.screen.height
aTag = $(e.target)
if !aTag.attr('href')
newTag = $(e.target).parents('a')
if newTag[0]
aTag = newTag
info =
level: 'notice'
href: aTag.attr('href')
title: aTag.attr('title')
text: aTag.text()
clickX: e.pageX
clickY: e.pageY
screenX: w
screenY: h
@log( 'click', 'notice', info )
)
# log ajax calls
$(document).bind( 'ajaxComplete', ( e, request, settings ) =>
length = @url.length
if settings.url.substr(0,length) isnt @url && settings.url.substr(0,6) isnt 'api/ui'
level = 'notice'
responseText = ''
if request.status >= 400
level = 'error'
responseText = request.responseText
@log(
'ajax.send',
level,
{
type: settings.type
dataType: settings.dataType
async: settings.async
url: settings.url
data: settings.data
status: request.status
responseText: responseText
}
)
)
$(window).bind(
'beforeunload'
=>
@log( 'end', 'notice', {} )
@send(false)
return
)
log: ( area, level, args ) ->
info =
time: Math.round( new Date().getTime() / 1000 )
area: area
level: level
location: window.location.href
data: args
@data.push info
send: (async = true) =>
return if _.isEmpty @data
newData = _.clone( @data )
@data = []
newDataNew = []
for item in newData
try
itemNew = _.clone( item )
JSON.stringify(item)
# add browser info
for item, value of @browser
itemNew[item] = value
newDataNew.push itemNew
catch e
# nothing
App.Com.ajax(
type: 'POST'
url: @url
async: async
data: JSON.stringify(
track_id: @trackId
log: newDataNew
)
crossDomain: true
# success: (data, status, xhr) =>
# @data = []
# console.log('done')
error: =>
# queue all data
for item in newDataNew
@data.push item
)
_all: ->
@data
`
window.onerror = function(errorMsg, url, lineNumber) {
console.error(errorMsg + " - in " + url + ", line " + lineNumber);
};
(function() {
var console = window.console
if (!console) return
function intercept(method){
var original = console[method]
console[method] = function(){
//alert('new m' + method)
App.Track.log(
'console.' + method,
method,
arguments
)
// do sneaky stuff
if (original.apply){
// Do this for normal browsers
original.apply(console, arguments)
}
else{
// Do this for IE
var message = Array.prototype.slice.apply(arguments).join(' ')
original(message)
}
}
}
var methods = ['log', 'warn', 'error']
for (var i = 0; i < methods.length; i++)
intercept(methods[i])
}).call(this);
`

View file

@ -43,7 +43,7 @@ class _ajaxSingleton
return if status is 0
# do not show any error message on wrong login
return if status is 422
return if status is 401 && !settings.url.match('login')
# do not show any error message with code 200
return if status is 200

View file

@ -11,26 +11,31 @@ class App.Browser
# disable Crome 13 and older
if data.browser == 'Chrome' && data.version <= 13
@message(data)
console.log('Browser not supported')
return false
# disable Firefox 6 and older
else if data.browser == 'Firefox' && data.version <= 6
@message(data)
console.log('Browser not supported')
return false
# disable IE 8 and older
else if data.browser == 'Explorer' && data.version <= 8
@message(data)
console.log('Browser not supported')
return false
# disable Safari 3 and older
else if data.browser == 'Safari' && data.version <= 3
@message(data)
console.log('Browser not supported')
return false
# disable Opera 10 and older
else if data.browser == 'Opera' && data.version <= 10
@message(data)
console.log('Browser not supported')
return false
return true

View file

@ -7,7 +7,7 @@ class App.PostmasterFilter extends App.Model
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 250, 'null': false, 'class': 'span4' },
{ name: 'channel', display: 'Channel', type: 'input', readonly: 1 },
{ name: 'match', display: 'Match all of the following', tag: 'input_select', count_min: 2, count_max: 88, multiple: true, 'null': false, 'class': 'span4', select: { 'class': 'span2', multiple: false, options: { from: 'From', to: 'To', cc: 'Cc', subject: 'Subject', body: 'Body' } }, input: { limit: 250, type: 'text', 'class': 'span3' }, },
{ name: 'perform', display: 'Perform action of the following', tag: 'input_select', count_min: 2, count_max: 88, multiple: true, 'null': false, 'class': 'span4', select: { 'class': 'span2', multiple: false, options: { from: 'From', to: 'To', cc: 'Cc', subject: 'Subject', body: 'Body', 'x-zammad-priority': 'Ticket Priority', 'x-zammad-state': 'Ticket State', 'x-zammad-customer': 'Ticket Customer', 'x-zammad-ignore': 'Ignore Message', 'x-zammad-group': 'Ticket Group', 'x-zammad-owner': 'Ticket Owner', 'x-zammad-article-visability': 'Article Visability', 'x-zammad-article-type': 'Article Type', 'x-zammad-article-sender': 'Article Sender' } }, input: { limit: 250, type: 'text', 'class': 'span3' }, },
{ name: 'perform', display: 'Perform action of the following', tag: 'input_select', count_min: 2, count_max: 88, multiple: true, 'null': false, 'class': 'span4', select: { 'class': 'span2', multiple: false, options: { from: 'From', to: 'To', cc: 'Cc', subject: 'Subject', body: 'Body', 'x-zammad-priority': 'Ticket Priority', 'x-zammad-state': 'Ticket State', 'x-zammad-customer': 'Ticket Customer', 'x-zammad-ignore': 'Ignore Message', 'x-zammad-group': 'Ticket Group', 'x-zammad-owner': 'Ticket Owner', 'x-zammad-article-visibility': 'Article Visibility', 'x-zammad-article-type': 'Article Type', 'x-zammad-article-sender': 'Article Sender' } }, input: { limit: 250, type: 'text', 'class': 'span3' }, },
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, 'null': true, 'class': 'span4' },
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
{ name: 'active', display: 'Active', tag: 'boolean', type: 'boolean', 'default': true, 'null': false, 'class': 'span4' },

View file

@ -11,7 +11,7 @@ class App.TicketArticle extends App.Model
{ name: 'body', display: 'Text', tag: 'textarea', rows: 5, limit: 100, null: false, class: 'span8', },
{ name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: false, relation: 'TicketArticleType', default: '', class: 'medium' },
{ name: 'ticket_article_sender_id', display: 'Sender', tag: 'select', multiple: false, null: false, relation: 'TicketArticleSender', default: '', class: 'medium' },
{ name: 'internal', display: 'Visability', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium' },
{ name: 'internal', display: 'Visibility', tag: 'radio', default: false, null: true, options: { true: 'internal', false: 'public' }, class: 'medium' },
]
@_fillUp: (data) ->

View file

@ -61,7 +61,7 @@ class ApplicationController < ActionController::Base
def current_user
return @_current_user if @_current_user
return if !session[:user_id]
@_current_user = User.find_by_id( session[:user_id] )
@_current_user = User.find( session[:user_id] )
end
def current_user_set(user)
@_current_user = user

View file

@ -10,7 +10,7 @@ class SessionsController < ApplicationController
# auth failed
if !user
render :json => { :error => 'login failed' }, :status => :unprocessable_entity
render :json => { :error => 'login failed' }, :status => :unauthorized
return
end

View file

@ -50,7 +50,7 @@ class Channel::EmailParser
:x-zammad-owner => 'some_owner_login',
# article headers
:x-zammad-article-visability => 'internal',
:x-zammad-article-visibility => 'internal',
:x-zammad-article-type => 'agent',
:x-zammad-article-sender => 'customer',
@ -380,7 +380,7 @@ class Channel::EmailParser
# set attributes
internal = false
if mail[ 'X-Zammad-Article-Visability'.to_sym ] && mail[ 'X-Zammad-Article-Visability'.to_sym ] == 'internal'
if mail[ 'X-Zammad-Article-Visibility'.to_sym ] && mail[ 'X-Zammad-Article-Visibility'.to_sym ] == 'internal'
internal = true
end
article_attributes = {

View file

@ -11,19 +11,20 @@ Zammad::Application.configure do
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
config.assets.compress = false
config.assets.compile = true
config.assets.digest = true
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_controller.perform_caching = true
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
@ -34,4 +35,11 @@ Zammad::Application.configure do
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# autoload on
config.dependency_loading = true
end

View file

@ -1812,6 +1812,10 @@ Translation.create_if_not_exists( :locale => 'de', :source => "Discard your unsa
Translation.create_if_not_exists( :locale => 'de', :source => "Copy to clipboard: Ctrl+C, Enter", :target => "In die Zwischenablage kopieren: Strg+C, Return" )
Translation.create_if_not_exists( :locale => 'de', :source => "Copy to clipboard", :target => "In die Zwischenablage kopieren" )
Translation.create_if_not_exists( :locale => 'de', :source => "Send to clients", :target => "An Clients senden" )
Translation.create_if_not_exists( :locale => 'de', :source => "Feedback about our new Interface", :target => "Feedback übers neue Design!" )
Translation.create_if_not_exists( :locale => 'de', :source => "What ideas do you have?", :target => "Welche Ideen haben Sie?" )
Translation.create_if_not_exists( :locale => 'de', :source => "Attach Screenshot of page", :target => "Screenshot dieser Seite anhängen" )
Translation.create_if_not_exists( :locale => 'de', :source => "Thanks for your Feedback!", :target => "Vielen Dank für Ihre Feedback!" )
#Translation.create_if_not_exists( :locale => 'de', :source => "", :target => "" )
# install all packages in auto_install

View file

@ -4,7 +4,7 @@ module Auth::TEST
def self.check( username, password, config, user )
# development systems
if !ENV['RAILS_ENV'] || ENV['RAILS_ENV'] == 'development'
if !ENV['RAILS_ENV'] || ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test'
return user if password == 'test'
end

View file

@ -9,20 +9,34 @@ while true; do
esac
done
export RAILS_ENV=test
bundle install
rm -rf tmp/cache/file_store
rm -f public/assets/*.css*
rm -f public/assets/*.js*
#rake assets:precompile
rake db:drop
rake db:create
rake db:migrate
rake db:seed
thin stop
script/websocket-server.rb stop
thin start --threaded -d -p 4444
script/websocket-server.rb start -d
sleep 15
rake test:browser["BROWSER_URL=http://localhost:4444"]
script/websocket-server.rb stop
thin stop
rm -f public/assets/*.css*
rm -f public/assets/*.js*

View file

@ -305,7 +305,7 @@ EventMachine.run {
# try to close regular
client[:websocket].close_websocket
# delete sesstion from client list
# delete session from client list
sleep 0.3
@clients.delete(client_id)
end

View file

@ -144,7 +144,7 @@ class AgentTicketActionsLevel2Test < TestCase
},
{
:execute => 'wait',
:value => 3,
:value => 5,
},
# set body in edit area

View file

@ -32,19 +32,19 @@ class MaintenanceMessageTest < TestCase
{
:where => :instance1,
:execute => 'set',
:css => 'input[name="title"]',
:css => '#content input[name="title"]',
:value => message,
},
{
:where => :instance1,
:execute => 'set',
:css => 'textarea[name="message"]',
:css => '#content textarea[name="message"]',
:value => message,
},
{
:where => :instance1,
:execute => 'click',
:css => 'button[type="submit"]',
:css => '#content button[type="submit"]',
},
{
:execute => 'wait',
@ -97,19 +97,19 @@ class MaintenanceMessageTest < TestCase
{
:where => :instance1,
:execute => 'set',
:css => 'input[name="title"]',
:css => '#content input[name="title"]',
:value => message + ' #2',
},
{
:where => :instance1,
:execute => 'set',
:css => 'textarea[name="message"]',
:css => '#content textarea[name="message"]',
:value => message + ' #2',
},
{
:where => :instance1,
:execute => 'click',
:css => 'button[type="submit"]',
:css => '#content button[type="submit"]',
},
{
:execute => 'wait',
@ -162,24 +162,24 @@ class MaintenanceMessageTest < TestCase
{
:where => :instance1,
:execute => 'set',
:css => 'input[name="title"]',
:css => '#content input[name="title"]',
:value => message + ' #3' ,
},
{
:where => :instance1,
:execute => 'set',
:css => 'textarea[name="message"]',
:css => '#content textarea[name="message"]',
:value => message + ' #3',
},
{
:where => :instance1,
:execute => 'setCheck',
:css => 'input[name="reload"][value="1"]',
:css => '#content input[name="reload"][value="1"]',
},
{
:where => :instance1,
:execute => 'click',
:css => 'button[type="submit"]',
:css => '#content button[type="submit"]',
},
{
:execute => 'wait',