Merge branch 'develop' into interface

Conflicts:
	app/assets/javascripts/app/controllers/getting_started.js.coffee
This commit is contained in:
Martin Edenhofer 2014-10-18 16:08:11 +02:00
commit a43c0bc062
16 changed files with 203 additions and 48 deletions

View file

@ -97,5 +97,7 @@ end
# to generate doc
gem 'kramdown'
gem 'prawn'
gem 'prawn-table'
gem 'puma'

18
README_elasticsearch.md Normal file
View file

@ -0,0 +1,18 @@
# Setup a elastic search
* Install elastic search
* Install attachment plugin
cd /usr/share/elasticsearch
bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/2.0.0
* Configure elastic search
* rails r "Setting.set('es_url', 'http://172.0.0.1:9200')"
* rails r "Setting.set('es_user', 'elasticsearch')" # optional
* rails r "Setting.set('es_password', 'zammad')" # optional
* rails r "Setting.set('es_index', Socket.gethostname + '_zammad')" # optional
* Create elastic search indexes
* rake searchindex:rebuild # drop/create/reload

View file

@ -51,13 +51,13 @@ class Index extends App.ControllerContent
new App.ControllerForm(
el: @el.find('#form-master')
model: App.User
required: 'signup'
screen: 'signup'
autofocus: true
)
new App.ControllerForm(
el: @el.find('#form-agent')
model: App.User
required: 'invite_agent'
screen: 'invite_agent'
autofocus: true
)
@ -94,8 +94,7 @@ class Index extends App.ControllerContent
# save user
user.save(
done: (r) =>
done: =>
if @master_user
@master_user = false
App.Auth.login(
@ -106,7 +105,7 @@ class Index extends App.ControllerContent
success: @relogin
# error: @error,
)
@Config.set('system_init_done', true)
App.Event.trigger 'notify', {
type: 'success'
msg: App.i18n.translateContent( 'Welcome to %s!', @Config.get('product_name') )
@ -123,13 +122,14 @@ class Index extends App.ControllerContent
# rerender page
@render()
fail: (data) ->
App.Event.trigger 'notify', {
type: 'error'
msg: App.i18n.translateContent( 'Can\'t create user!' )
timeout: 2500
}
fail: (data) ->
App.Event.trigger 'notify', {
type: 'error'
msg: App.i18n.translateContent( 'Can\'t create user!' )
timeout: 2500
}
# @modalHide()
)
relogin: (data, status, xhr) =>

View file

@ -24,7 +24,8 @@ class _trackSingleton
@trackId = 'track-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
@browser = App.Browser.detection()
@data = []
@url = 'https://portal.znuny.com/api/ui'
# @url = 'https://log.znuny.com/api/ui'
@url = 'https://portal.znuny.com/api/v1/ui'
# @url = 'api/ui'
@log( 'start', 'notice', {} )
@ -89,14 +90,14 @@ class _trackSingleton
return
)
log: ( area, level, args ) ->
log: ( facility, level, args ) ->
return if !App.Config.get('ui_send_client_stats')
info =
time: Math.round( new Date().getTime() / 1000 )
area: area
facility: facility
level: level
location: window.location.href
data: args
location: window.location.pathname + window.location.hash
message: args
@data.push info
send: (async = true) =>
@ -110,9 +111,6 @@ class _trackSingleton
itemNew = _.clone( item )
JSON.stringify(item)
# add browser info
for item, value of @browser
itemNew[item] = value
newDataNew.push itemNew
catch e
# nothing
@ -122,8 +120,12 @@ class _trackSingleton
url: @url
async: async
data: JSON.stringify(
track_id: @trackId
log: newDataNew
meta:
track_id: @trackId
host: window.location.host
protocol: window.location.protocol
browser: @browser
log: newDataNew
)
crossDomain: true
# success: (data, status, xhr) =>

View file

@ -22,7 +22,7 @@ class App.Browser
data =
browser: @searchString(@dataBrowser) or "An unknown browser"
version: @searchVersion(navigator.userAgent) or @searchVersion(navigator.appVersion) or "an unknown version"
OS: @searchString(@dataOS) or "an unknown OS"
os: @searchString(@dataOS) or "an unknown os"
@check: ->
data = @detection()

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class History < ApplicationModel
require 'history/assets'
load 'history/assets.rb'
include History::Assets
self.table_name = 'histories'

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Organization < ApplicationModel
require 'organization/assets'
load 'organization/assets.rb'
include Organization::Assets
extend Organization::Search
include Organization::SearchIndex

View file

@ -4,13 +4,13 @@ class Ticket < ApplicationModel
include Ticket::Escalation
include Ticket::Subject
include Ticket::Permission
require 'ticket/assets'
load 'ticket/assets.rb'
include Ticket::Assets
require 'ticket/history_log'
load 'ticket/history_log.rb'
include Ticket::HistoryLog
require 'ticket/activity_stream_log'
load 'ticket/activity_stream_log.rb'
include Ticket::ActivityStreamLog
require 'ticket/search_index'
load 'ticket/search_index.rb'
include Ticket::SearchIndex
extend Ticket::Search

View file

@ -1,11 +1,11 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::Article < ApplicationModel
require 'ticket/article/assets'
load 'ticket/article/assets.rb'
include Ticket::Article::Assets
require 'ticket/article/history_log'
load 'ticket/article/history_log.rb'
include Ticket::Article::HistoryLog
require 'ticket/article/activity_stream_log'
load 'ticket/article/activity_stream_log.rb'
include Ticket::Article::ActivityStreamLog
belongs_to :ticket

View file

@ -3,7 +3,7 @@
require 'digest/md5'
class User < ApplicationModel
require 'user/assets'
load 'user/assets.rb'
include User::Assets
extend User::Search
include User::SearchIndex

View file

@ -20,8 +20,8 @@ Zammad::Application.configure do
# Compress JavaScripts and CSS
config.assets.compress = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# Set uglifier as JS and sass as CSS compressor
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Don't fallback to assets pipeline if a precompiled asset is missed
@ -30,17 +30,17 @@ Zammad::Application.configure do
# Generate digests for assets URLs
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies
# config.force_ssl = true
# See everything in the log (default is :info)
# Define the log level (default is :info, to see all use :debug)
# config.log_level = :debug
config.log_level = :info
@ -69,12 +69,12 @@ Zammad::Application.configure do
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# Disable automatic flushing of the log to improve performance
# config.autoflush_log = false
# autoload on
# Enable autoload
config.dependency_loading = true
# Use default logging formatter so that PID and timestamp are not suppressed.
# Use default logging formatter so that PID and timestamp are not suppressed
config.log_formatter = ::Logger::Formatter.new
end

View file

@ -13,11 +13,16 @@ Zammad::Application.configure do
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Disable assert compression for relyable error code lines
config.assets.compress = false
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Show full error reports and disable caching
@ -36,9 +41,9 @@ Zammad::Application.configure do
config.active_support.deprecation = :stderr
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
config.action_controller.allow_forgery_protection = false
# autoload on
# Enable autoload
config.dependency_loading = true
end

View file

@ -8,11 +8,16 @@ Zammad::Application.configure do
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Disable assert compression for relyable error code lines
config.assets.compress = false
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Show full error reports and disable caching
@ -31,9 +36,9 @@ Zammad::Application.configure do
config.active_support.deprecation = :stderr
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
config.action_controller.allow_forgery_protection = false
# autoload on
# Enable autoload
config.dependency_loading = true
end

48
test/fixtures/mail24.box vendored Normal file
View file

@ -0,0 +1,48 @@
Return-Path: oracle@ELIG0-1-DB01.example.com
Received: by ELIG0-1-DB01 (Postfix, from userid 1000)
id 1F4D8383B7; Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
Received: from ELIG0-1-DB01 (static-62-50-37-197.irtnet.net [62.50.37.197])
by mail2.mail.example.com (Postfix) with ESMTP
id 43854316E9; Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
Received: from mail2.mail.example.com (perls.mail.example.com [195.30.107.84])
by mail.example.com (Postfix) with ESMTP id 4DE3C471003F;
Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
Received: from mail.example.com ([127.0.0.1])
by localhost (mail.example.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id AtfOMc9Eru0V; Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
Received: from localhost (localhost.localdomain [127.0.0.1])
by mail.example.com (Postfix) with ESMTP id 3C7B54710042;
Thu, 18 Sep 2014 09:30:06 +0200 (CEST)
Received: from mail.example.com (LHLO mail.example.com) (195.30.107.40) by
mail.example.com with LMTP; Thu, 18 Sep 2014 09:30:06 +0200 (CEST)
Date: Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
From: oracle@IG0-1-DB01.example.com
To: support@example.com
Subject: Regelsets im Test-Status gefunden: 1
Message-ID: <279749720.2270042.1412150446700.JavaMail.root@mail.example.com>
Content-Type: multipart/mixed;
boundary="=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495"; generated=true
X-Virus-Scanned: amavisd-new at mail.example.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-10 required=6.6
tests=[BAYES_00=-1.9, FSL_HELO_NON_FQDN_1=0.001, HELO_NO_DOMAIN=0.001,
TO_NO_BRKTS_PCNT=0.001] autolearn=ham
MIME-Version: 1.0
--=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
--=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495
Content-Type: text/csv
Content-Disposition: attachment; filename=rulesets-report.csv
Content-Transfer-Encoding: 7bit
RULESET_ID;NAME;ACTIV;RUN_MODE;AUDIT_MODIFY_DATE
387;DP DHL JOIN - EN : Einladung eAC;T;SM;1.09.14
--=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495--

36
test/fixtures/mail25.box vendored Normal file
View file

@ -0,0 +1,36 @@
Return-Path: oracle@IG0-1-DB01.example.com
Received: from mail.example.com (LHLO mail.example.com) (195.30.107.40) by
mail.example.com with LMTP; Thu, 18 Sep 2014 09:30:06 +0200 (CEST)
Received: from localhost (localhost.localdomain [127.0.0.1])
by mail.example.com (Postfix) with ESMTP id 3C7B54710042;
Thu, 18 Sep 2014 09:30:06 +0200 (CEST)
X-Virus-Scanned: amavisd-new at mail.example.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-10 required=6.6
tests=[BAYES_00=-1.9, FSL_HELO_NON_FQDN_1=0.001, HELO_NO_DOMAIN=0.001,
TO_NO_BRKTS_PCNT=0.001] autolearn=ham
Received: from mail.example.com ([127.0.0.1])
by localhost (mail.example.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id AtfOMc9Eru0V; Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
Received: from mail2.mail.example.com (perls.mail.example.com [195.30.107.84])
by mail.example.com (Postfix) with ESMTP id 4DE3C471003F;
Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
Received: from IG0-1-DB01 (static-62-50-37-197.irtnet.net [62.50.37.197])
by mail2.mail.example.com (Postfix) with ESMTP
id 43854316E9; Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
Received: by IG0-1-DB01 (Postfix, from userid 1000)
id 1F4D8383B7; Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
To: support@example.com
Subject: Regelsets im Test-Status gefunden: 1
Message-Id: <20140918073001.1F4D8383B7@IG0-1-DB01>
Date: Thu, 18 Sep 2014 09:30:01 +0200 (CEST)
From: oracle@IG0-1-DB01.example.com
begin 644 rulesets-report.csv
M4E5,15-%5%])1#M.04U%.T%#5$E6.U)53E]-3T1%.T%51$E47TU/1$E&65]$
M051%"C,X-SM$4"!$2$P@2D])3B`M($5.(#H@16EN;&%D=6YG(&5!0SM4.U--
*.S$W+C`Y+C$T"@``
`
end

View file

@ -492,6 +492,45 @@ Freemont and pulling out several minutes.
:to => 'undisclosed-recipients: ;',
},
},
{
:data => IO.read('test/fixtures/mail24.box'),
:body_md5 => 'd41d8cd98f00b204e9800998ecf8427e',
:params => {
:from => 'oracle@IG0-1-DB01.example.com',
:from_email => 'oracle@IG0-1-DB01.example.com',
:from_display_name => '',
:subject => 'Regelsets im Test-Status gefunden: 1',
:to => 'support@example.com',
:body => '',
},
:attachments => [
{
:data => 'RULESET_ID;NAME;ACTIV;RUN_MODE;AUDIT_MODIFY_DATE
387;DP DHL JOIN - EN : Einladung eAC;T;SM;1.09.14
',
:md5 => 'a61c76479fdc2f107fe2697ac5ad60ae',
:filename => 'rulesets-report.csv',
},
],
},
{
:data => IO.read('test/fixtures/mail25.box'),
:body_md5 => '436f71d8d8a4ffbd3f18fc9de7d7f767',
:params => {
:from => 'oracle@IG0-1-DB01.example.com',
:from_email => 'oracle@IG0-1-DB01.example.com',
:from_display_name => '',
:subject => 'Regelsets im Test-Status gefunden: 1',
:to => 'support@example.com',
:body => "begin 644 rulesets-report.csv
M4E5,15-%5%])1#M.04U%.T%#5$E6.U)53E]-3T1%.T%51$E47TU/1$E&65]$
M051%\"C,X-SM$4\"!$2$P@2D])3B`M($5.(#H@16EN;&%D=6YG(&5!0SM4.U--
*.S$W+C`Y+C$T\"@``
`
end
",
},
},
]
files.each { |file|
@ -524,7 +563,7 @@ Freemont and pulling out several minutes.
data[:attachments].each { |attachment_parser|
next if found
file_md5 = Digest::MD5.hexdigest( attachment_parser[:data] )
# puts 'Attachment:' + attachment_parser.inspect + '-' + file_md5
#puts 'Attachment:' + attachment_parser.inspect + '-' + file_md5
if attachment[:md5] == file_md5
found = true
assert_equal( attachment[:filename], attachment_parser[:filename] )