Added setting for system_online_service to check if it's used in hosted mode.
This commit is contained in:
parent
46b6d0de08
commit
ff47b7f707
6 changed files with 128 additions and 19 deletions
|
@ -276,7 +276,10 @@ class Base extends App.ControllerContent
|
||||||
if data.result is 'ok'
|
if data.result is 'ok'
|
||||||
for key, value of data.settings
|
for key, value of data.settings
|
||||||
App.Config.set( key, value )
|
App.Config.set( key, value )
|
||||||
@navigate 'getting_started/channel'
|
if App.Config.get('system_online_service')
|
||||||
|
@navigate 'getting_started/channel/email_pre_configured'
|
||||||
|
else
|
||||||
|
@navigate 'getting_started/channel'
|
||||||
else
|
else
|
||||||
for key, value of data.messages
|
for key, value of data.messages
|
||||||
@showAlert( key, value )
|
@showAlert( key, value )
|
||||||
|
@ -356,6 +359,50 @@ class Channel extends App.ControllerContent
|
||||||
|
|
||||||
App.Config.set( 'getting_started/channel', Channel, 'Routes' )
|
App.Config.set( 'getting_started/channel', Channel, 'Routes' )
|
||||||
|
|
||||||
|
class ChannelEmailPreConfigured extends App.ControllerContent
|
||||||
|
className: 'getstarted fit'
|
||||||
|
|
||||||
|
constructor: ->
|
||||||
|
super
|
||||||
|
|
||||||
|
# redirect if we are not admin
|
||||||
|
if !@authenticate(true)
|
||||||
|
@navigate '#'
|
||||||
|
return
|
||||||
|
|
||||||
|
# set title
|
||||||
|
@title 'Connect Channels'
|
||||||
|
|
||||||
|
@fetch()
|
||||||
|
|
||||||
|
release: =>
|
||||||
|
@el.removeClass('fit getstarted')
|
||||||
|
|
||||||
|
fetch: ->
|
||||||
|
|
||||||
|
# get data
|
||||||
|
@ajax(
|
||||||
|
id: 'getting_started',
|
||||||
|
type: 'GET',
|
||||||
|
url: @apiPath + '/getting_started',
|
||||||
|
processData: true,
|
||||||
|
success: (data, status, xhr) =>
|
||||||
|
|
||||||
|
# check if import is active
|
||||||
|
if data.import_mode == true
|
||||||
|
@navigate '#import/' + data.import_backend
|
||||||
|
return
|
||||||
|
|
||||||
|
# render page
|
||||||
|
@render(data)
|
||||||
|
)
|
||||||
|
|
||||||
|
render: (data) ->
|
||||||
|
@html App.view('getting_started/email_pre_configured')(
|
||||||
|
data
|
||||||
|
)
|
||||||
|
|
||||||
|
App.Config.set( 'getting_started/channel/email_pre_configured', ChannelEmailPreConfigured, 'Routes' )
|
||||||
|
|
||||||
class ChannelEmail extends App.ControllerContent
|
class ChannelEmail extends App.ControllerContent
|
||||||
className: 'getstarted fit'
|
className: 'getstarted fit'
|
||||||
|
|
|
@ -17,12 +17,14 @@
|
||||||
<div class="logo-preview-placeholder"><%- @T('Your Logo') %></div>
|
<div class="logo-preview-placeholder"><%- @T('Your Logo') %></div>
|
||||||
<div class="btn btn--success fileUpload"><%- @T('Upload') %><input type="file" class="js-upload" name="logo" accept="image/*"></div>
|
<div class="btn btn--success fileUpload"><%- @T('Upload') %><input type="file" class="js-upload" name="logo" accept="image/*"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<% if !@C('system_online_service'): %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><%- @T('System URL') %></label>
|
<label><%- @T('System URL') %></label>
|
||||||
<div class="alert alert--danger hide" role="alert"></div>
|
<div class="alert alert--danger hide" role="alert"></div>
|
||||||
<input type="text" class="form-control" name="url" value="<%= @url %>" placeholder="http://zammad.example.com" required>
|
<input type="text" class="form-control" name="url" value="<%= @url %>" placeholder="http://zammad.example.com" required>
|
||||||
<p class="help-block">The URL to this installation of Zammad.</p>
|
<p class="help-block">The URL to this installation of Zammad.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="wizard-controls center">
|
<div class="wizard-controls center">
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<div class="main flex vertical centered darkBackground">
|
||||||
|
<img class="zammad full logo" src="<%= @C('image_path') + '/' + 'full logo on dark.svg' %>" alt="Zammad">
|
||||||
|
<form class="setup wizard js-channel">
|
||||||
|
<div class="wizard-slide">
|
||||||
|
<h2><%- @T('Connect Channels') %></h2>
|
||||||
|
<div class="wizard-body vertical center">
|
||||||
|
<p class="help-block help-block--center"><%- @T('Your Zammad as the following email address.') %></p>
|
||||||
|
<% if @addresses: %>
|
||||||
|
<% for address in @addresses: %>
|
||||||
|
<p><%= address.realname %> <<%= address.email %>></p>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<p class="help-block help-block--center"><%- @T('If you want to use more email adresses, you can configure them later.') %></p>
|
||||||
|
</div>
|
||||||
|
<div class="wizard-controls center">
|
||||||
|
<a class="subtle-link" href="#getting_started/base"><%- @T('Go Back') %></a>
|
||||||
|
<a class="btn align-right" href="#getting_started/finish"><%- @T( 'Finish' ) %></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -39,15 +39,12 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
return if !authentication_check
|
return if !authentication_check
|
||||||
end
|
end
|
||||||
|
|
||||||
# get all groups
|
|
||||||
groups = Group.where( :active => true )
|
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render :json => {
|
render :json => {
|
||||||
:setup_done => setup_done,
|
:setup_done => setup_done,
|
||||||
:import_mode => Setting.get('import_mode'),
|
:import_mode => Setting.get('import_mode'),
|
||||||
:import_backend => Setting.get('import_backend'),
|
:import_backend => Setting.get('import_backend'),
|
||||||
:groups => groups,
|
:system_online_service => Setting.get('system_online_service'),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,8 +55,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
|
|
||||||
# validate url
|
# validate url
|
||||||
messages = {}
|
messages = {}
|
||||||
if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/
|
if !Setting.get('system_online_service')
|
||||||
messages[:url] = 'A URL looks like http://zammad.example.com'
|
if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/
|
||||||
|
messages[:url] = 'A URL looks like http://zammad.example.com'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# validate organization
|
# validate organization
|
||||||
|
@ -87,11 +86,13 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
|
|
||||||
# split url in http_type and fqdn
|
# split url in http_type and fqdn
|
||||||
settings = {}
|
settings = {}
|
||||||
if params[:url] =~ /^(http|https):\/\/(.+?)$/
|
if !Setting.get('system_online_service')
|
||||||
Setting.set('http_type', $1)
|
if params[:url] =~ /^(http|https):\/\/(.+?)$/
|
||||||
settings[:http_type] = $1
|
Setting.set('http_type', $1)
|
||||||
Setting.set('fqdn', $2)
|
settings[:http_type] = $1
|
||||||
settings[:fqdn] = $2
|
Setting.set('fqdn', $2)
|
||||||
|
settings[:fqdn] = $2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# save organization
|
# save organization
|
||||||
|
@ -595,7 +596,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
if found && found == 'verify ok'
|
if found && found == 'verify ok'
|
||||||
|
|
||||||
# remember address
|
# remember address
|
||||||
address = EmailAddress.all.first
|
address = EmailAddress.where( :email => params[:meta][:email] ).first
|
||||||
|
if !address
|
||||||
|
address = EmailAddress.first
|
||||||
|
end
|
||||||
if address
|
if address
|
||||||
address.update_attributes(
|
address.update_attributes(
|
||||||
:realname => params[:meta][:realname],
|
:realname => params[:meta][:realname],
|
||||||
|
@ -863,10 +867,20 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
if !setup_done
|
if !setup_done
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# get all groups
|
||||||
|
groups = Group.where( :active => true )
|
||||||
|
|
||||||
|
# get email addresses
|
||||||
|
addresses = EmailAddress.where( :active => true )
|
||||||
|
|
||||||
render :json => {
|
render :json => {
|
||||||
:setup_done => true,
|
:setup_done => true,
|
||||||
:import_mode => Setting.get('import_mode'),
|
:import_mode => Setting.get('import_mode'),
|
||||||
:import_backend => Setting.get('import_backend'),
|
:import_backend => Setting.get('import_backend'),
|
||||||
|
:system_online_service => Setting.get('system_online_service'),
|
||||||
|
:addresses => addresses,
|
||||||
|
:groups => groups,
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
16
db/migrate/20141120000001_update_setting3.rb
Normal file
16
db/migrate/20141120000001_update_setting3.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
class UpdateSetting3 < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
:title => 'Online Service',
|
||||||
|
:name => 'system_online_service',
|
||||||
|
:area => 'Core',
|
||||||
|
:description => 'Defines if application is used as online service.',
|
||||||
|
:options => {},
|
||||||
|
:state => false,
|
||||||
|
:frontend => true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -15,6 +15,15 @@ Setting.create_if_not_exists(
|
||||||
:state => false,
|
:state => false,
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
:title => 'Online Service',
|
||||||
|
:name => 'system_online_service',
|
||||||
|
:area => 'Core',
|
||||||
|
:description => 'Defines if application is used as online service.',
|
||||||
|
:options => {},
|
||||||
|
:state => false,
|
||||||
|
:frontend => true
|
||||||
|
)
|
||||||
Setting.create_if_not_exists(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Product Name',
|
:title => 'Product Name',
|
||||||
:name => 'product_name',
|
:name => 'product_name',
|
||||||
|
|
Loading…
Reference in a new issue