erp_app 3.1.10 → 3.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/app/controllers/erp_app/desktop/scaffold/base_controller.rb +1 -0
  2. data/app/controllers/erp_app/desktop/user_management/base_controller.rb +8 -10
  3. data/app/controllers/erp_app/organizer/crm/base_controller.rb +104 -88
  4. data/app/mailers/crm_mailer.rb +9 -0
  5. data/app/views/crm_mailer/send_message.html.erb +9 -0
  6. data/app/views/erp_app/desktop/base/index.erb +221 -213
  7. data/app/views/erp_app/mobile/base/index.erb +1 -0
  8. data/app/views/erp_app/organizer/base/index.erb +51 -43
  9. data/lib/erp_app/version.rb +1 -1
  10. data/lib/generators/organizer_application/templates/controllers/controller_template.erb +1 -1
  11. data/lib/generators/organizer_application/templates/public/base.js.erb +2 -2
  12. data/public/javascripts/erp_app/desktop/applications/scaffold/models_tree_panel.js +19 -0
  13. data/public/javascripts/erp_app/desktop/applications/user_management/module.js +432 -418
  14. data/public/javascripts/erp_app/desktop/applications/user_management/user_application_mgt_panel.js +1 -1
  15. data/public/javascripts/erp_app/login/window.js +2 -1
  16. data/public/javascripts/erp_app/organizer/applications/crm/contact_mechanism_grid.js +511 -389
  17. data/public/javascripts/erp_app/organizer/applications/crm/party_grid.js +1 -1
  18. data/public/javascripts/erp_app/shared/configuration/configuration_form.js +238 -262
  19. data/public/javascripts/erp_app/shared/configuration/configuration_panel.js +103 -104
  20. data/public/stylesheets/erp_app/mobile/mobile.css +6 -6
  21. metadata +5 -89
  22. data/spec/dummy/db/data_migrations/20130422163128_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  23. data/spec/dummy/db/data_migrations/20130422163129_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  24. data/spec/dummy/db/data_migrations/20130422163130_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -21
  25. data/spec/dummy/db/data_migrations/20130422163131_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +0 -19
  26. data/spec/dummy/db/data_migrations/20130422163132_add_guid_to_instances.erp_base_erp_svcs.rb +0 -10
  27. data/spec/dummy/db/data_migrations/20130422163133_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  28. data/spec/dummy/db/data_migrations/20130422163134_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  29. data/spec/dummy/db/data_migrations/20130422163135_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  30. data/spec/dummy/db/data_migrations/20130422163136_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  31. data/spec/dummy/db/data_migrations/20130422163137_note_capabilities.erp_tech_svcs.rb +0 -24
  32. data/spec/dummy/db/data_migrations/20130422163138_erp_app_setup.erp_app.rb +0 -252
  33. data/spec/dummy/db/data_migrations/20130422163139_update_preferences.erp_app.rb +0 -53
  34. data/spec/dummy/db/data_migrations/20130422163140_create_desktop_app_audit_log_viewer.erp_app.rb +0 -24
  35. data/spec/dummy/db/data_migrations/20130422163141_add_file_manager_application.erp_app.rb +0 -32
  36. data/spec/dummy/db/data_migrations/20130422163142_add_default_capabilities.erp_app.rb +0 -23
  37. data/spec/dummy/db/data_migrations/20130422163143_add_new_contact_widgets.erp_app.rb +0 -42
  38. data/spec/dummy/db/data_migrations/20130422163144_add_userinfo_widget.erp_app.rb +0 -29
  39. data/spec/dummy/db/data_migrations/20130422163145_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
  40. data/spec/dummy/db/data_migrations/20130422163146_create_user_management_mobile_application.erp_app.rb +0 -17
  41. data/spec/dummy/db/data_migrations/20130422163147_create_configuration_management_desktop_application.erp_app.rb +0 -27
  42. data/spec/dummy/db/data_migrations/20130422163148_create_job_tracker_desktop_application.erp_app.rb +0 -23
  43. data/spec/dummy/db/data_migrations/20130422163149_created_tracked_jobs.erp_app.rb +0 -15
  44. data/spec/dummy/db/data_migrations/20130422163150_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
  45. data/spec/dummy/db/data_migrations/20130422163151_create_security_management_desktop_application.erp_app.rb +0 -29
  46. data/spec/dummy/db/data_migrations/20130422163152_add_job_tracker_mobile_app.erp_app.rb +0 -17
  47. data/spec/dummy/db/migrate/20130422163121_base_erp_services.erp_base_erp_svcs.rb +0 -486
  48. data/spec/dummy/db/migrate/20130422163122_add_txn_status.erp_base_erp_svcs.rb +0 -37
  49. data/spec/dummy/db/migrate/20130422163123_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +0 -34
  50. data/spec/dummy/db/migrate/20130422163124_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +0 -17
  51. data/spec/dummy/db/migrate/20130422163125_add_long_lat_to_address.erp_base_erp_svcs.rb +0 -16
  52. data/spec/dummy/db/migrate/20130422163126_base_tech_services.erp_tech_svcs.rb +0 -271
  53. data/spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  54. data/spec/dummy/db/migrate/20130422163128_create_groups.erp_tech_svcs.rb +0 -19
  55. data/spec/dummy/db/migrate/20130422163129_upgrade_security.erp_tech_svcs.rb +0 -54
  56. data/spec/dummy/db/migrate/20130422163130_upgrade_security2.erp_tech_svcs.rb +0 -275
  57. data/spec/dummy/db/migrate/20130422163131_add_queue_to_delayed_jobs.erp_tech_svcs.rb +0 -14
  58. data/spec/dummy/db/migrate/20130422163132_base_app_framework.erp_app.rb +0 -276
  59. data/spec/dummy/db/migrate/20130422163133_add_job_tracker.erp_app.rb +0 -20
  60. data/spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb +0 -28
  61. data/spec/dummy/db/schema.rb +0 -883
  62. data/spec/dummy/db/spec.sqlite3 +0 -0
  63. data/spec/dummy/log/adam.log +0 -1
  64. data/spec/dummy/log/spec.log +0 -113709
@@ -8,6 +8,7 @@ module ErpApp
8
8
 
9
9
  def get_models
10
10
  names = ActiveRecord::Base.all_subclasses.collect{|klass| klass.name}.delete_if{|item| item =~ /::/}.uniq.sort{|a,b| a <=> b}
11
+ names = names.select { |name| name =~ Regexp.new("^#{params[:name]}.", Regexp::IGNORECASE)}
11
12
 
12
13
  respond_to do |format|
13
14
  format.json do
@@ -11,13 +11,12 @@ module ErpApp
11
11
  dir = sort_hash[:direction] || 'ASC'
12
12
  limit = params[:limit] || 25
13
13
  start = params[:start] || 0
14
- total_count = 0
15
14
 
16
15
  if username.blank?
17
16
  users = User.order("#{sort} #{dir}").offset(start).limit(limit)
18
17
  total_count = User.count
19
18
  else
20
- users = User.where('username like ?', "%#{username}%").order("#{sort} #{dir}").offset(start).limit(limit)
19
+ users = User.where('username like ? or email like ?', "%#{username}%", "%#{username}%").order("#{sort} #{dir}").offset(start).limit(limit)
21
20
  total_count = users.count
22
21
  end
23
22
 
@@ -26,7 +25,6 @@ module ErpApp
26
25
 
27
26
  def new
28
27
  response = {}
29
- application = DesktopApplication.find_by_internal_identifier('user_management')
30
28
  begin
31
29
  current_user.with_capability(:create, 'User') do
32
30
 
@@ -37,8 +35,8 @@ module ErpApp
37
35
  :password_confirmation => params[:password_confirmation]
38
36
  )
39
37
  #set this to tell activation where to redirect_to for login and temp password
40
- user.add_instance_attribute(:login_url, '/erp_app/login');
41
- user.add_instance_attribute(:temp_password, params[:password]);
38
+ user.add_instance_attribute(:login_url, '/erp_app/login')
39
+ user.add_instance_attribute(:temp_password, params[:password])
42
40
 
43
41
  if user.save
44
42
  individual = Individual.create(:gender => params[:gender], :current_first_name => params[:first_name], :current_last_name => params[:last_name])
@@ -75,7 +73,7 @@ module ErpApp
75
73
  end
76
74
 
77
75
  def delete
78
- application = DesktopApplication.find_by_internal_identifier('user_management')
76
+
79
77
  if current_user.has_capability?('create', 'User')
80
78
  unless @user.party.nil?
81
79
  @user.party.destroy
@@ -95,7 +93,7 @@ module ErpApp
95
93
  @user = User.find(params[:id])
96
94
  end
97
95
 
98
- end
99
- end
100
- end
101
- end
96
+ end #BaseController
97
+ end #UserManagement
98
+ end #Desktop
99
+ end #ErpApp
@@ -1,46 +1,46 @@
1
1
  module ErpApp
2
- module Organizer
3
- module Crm
4
- class BaseController < ErpApp::Organizer::BaseController
2
+ module Organizer
3
+ module Crm
4
+ class BaseController < ErpApp::Organizer::BaseController
5
5
  @@date_format = "%m/%d/%Y"
6
6
  @@datetime_format = "%m/%d/%Y %l:%M%P"
7
7
 
8
- def menu
8
+ def menu
9
9
  menu = []
10
10
 
11
11
  menu << {:text => 'Individuals', :businessPartType => 'individual', :leaf => true, :iconCls => 'icon-user', :applicationCardId => "individuals_search_grid"}
12
- menu << {:text => 'Organizations',:businessPartType => 'organization', :leaf => true, :iconCls => 'icon-user', :applicationCardId => "organizations_search_grid"}
12
+ menu << {:text => 'Organizations', :businessPartType => 'organization', :leaf => true, :iconCls => 'icon-user', :applicationCardId => "organizations_search_grid"}
13
13
 
14
14
  render :json => menu
15
- end
15
+ end
16
16
 
17
- def contact_purposes
17
+ def contact_purposes
18
18
  render :inline => "{\"types\":#{ContactPurpose.all.to_json(:only => [:id, :description])}}"
19
- end
19
+ end
20
20
 
21
- def parties
21
+ def parties
22
22
  render :inline => if request.put?
23
- update_party
24
- elsif request.get?
25
- get_parties
26
- elsif request.delete?
27
- delete_party
28
- end
29
- end
23
+ update_party
24
+ elsif request.get?
25
+ get_parties
26
+ elsif request.delete?
27
+ delete_party
28
+ end
29
+ end
30
30
 
31
- def contact_mechanism
31
+ def contact_mechanism
32
32
  render :inline => if request.post?
33
- create_contact_mechanism
34
- elsif request.put?
35
- update_contact_mechanism
36
- elsif request.get?
37
- get_contact_mechanisms
38
- elsif request.delete?
39
- delete_contact_mechanism
40
- end
41
- end
33
+ create_contact_mechanism
34
+ elsif request.put?
35
+ update_contact_mechanism
36
+ elsif request.get?
37
+ get_contact_mechanisms
38
+ elsif request.delete?
39
+ delete_contact_mechanism
40
+ end
41
+ end
42
42
 
43
- def create_party
43
+ def create_party
44
44
  result = {}
45
45
  begin
46
46
  enterprise_identifier = params[:enterprise_identifier]
@@ -60,14 +60,14 @@ module ErpApp
60
60
  business_party.party.save
61
61
 
62
62
  result = {:success => true, :message => "#{party_type} Added", :name => business_party.party.description}
63
- rescue Exception=>ex
63
+ rescue Exception => ex
64
64
  result = {:success => false, :message => "Error adding #{party_type}"}
65
65
  end
66
66
 
67
67
  render :json => result
68
- end
68
+ end
69
69
 
70
- def update_party
70
+ def update_party
71
71
  enterprise_identifier = params[:enterprise_identifier]
72
72
  party_type = params[:party_type]
73
73
  business_party_id = params[:business_party_id]
@@ -86,7 +86,7 @@ module ErpApp
86
86
  klass = party_type.constantize
87
87
  business_party = klass.find(business_party_id)
88
88
 
89
- business_party_data.each do |key,value|
89
+ business_party_data.each do |key, value|
90
90
  key = key.gsub("business_party.", "")
91
91
  method = key + '='
92
92
  business_party.send method.to_sym, value
@@ -100,17 +100,17 @@ module ErpApp
100
100
  party.save
101
101
  end unless enterprise_identifier.blank?
102
102
 
103
- render :json => { :success => true,
104
- :message => "#{party_type} updated",
105
- :data => [{
106
- :id => party.id,
107
- :enterprise_identifier => party.enterprise_identifier,
108
- :created_at => party.created_at,
109
- :updated_at => party.updated_at,
110
- :business_party => party.business_party
111
- }]
103
+ render :json => {:success => true,
104
+ :message => "#{party_type} updated",
105
+ :data => [{
106
+ :id => party.id,
107
+ :enterprise_identifier => party.enterprise_identifier,
108
+ :created_at => party.created_at,
109
+ :updated_at => party.updated_at,
110
+ :business_party => party.business_party
111
+ }]
112
112
  }
113
- end
113
+ end
114
114
 
115
115
  def get_party_details
116
116
  @party = Party.find(params[:id]) rescue nil
@@ -125,12 +125,12 @@ module ErpApp
125
125
  success = true
126
126
  message = "User Does Not Exist"
127
127
  u = {
128
- :username => '',
129
- :email => '',
130
- :activation_state => '',
131
- :last_login_at => '',
132
- :failed_logins_count => '',
133
- :activation_token => ''
128
+ :username => '',
129
+ :email => '',
130
+ :activation_state => '',
131
+ :last_login_at => '',
132
+ :failed_logins_count => '',
133
+ :activation_token => ''
134
134
  }
135
135
  else
136
136
  success = true
@@ -139,12 +139,12 @@ module ErpApp
139
139
  last_login_at = user.last_login_at.blank? ? '' : user.last_login_at.getlocal.strftime(@@datetime_format)
140
140
 
141
141
  u = {
142
- :username => user.username,
143
- :email => user.email,
144
- :activation_state => user.activation_state,
145
- :last_login_at => last_login_at,
146
- :failed_logins_count => user.failed_logins_count,
147
- :activation_token => user.activation_token
142
+ :username => user.username,
143
+ :email => user.email,
144
+ :activation_state => user.activation_state,
145
+ :last_login_at => last_login_at,
146
+ :failed_logins_count => user.failed_logins_count,
147
+ :activation_token => user.activation_token
148
148
  }
149
149
  end
150
150
  else
@@ -153,10 +153,10 @@ module ErpApp
153
153
  u = {}
154
154
  end
155
155
 
156
- render :json => { :success => success,
157
- :message => message,
158
- :data => [u]
159
- }
156
+ render :json => {:success => success,
157
+ :message => message,
158
+ :data => [u]
159
+ }
160
160
  end
161
161
 
162
162
  def update_user
@@ -166,8 +166,8 @@ module ErpApp
166
166
  user = party.user
167
167
  if user.nil?
168
168
  success = true
169
- message = "User Does Not Exist"
170
- else
169
+ message = "User Does Not Exist"
170
+ else
171
171
  user.username = params[:username]
172
172
  user.email = params[:email]
173
173
  if user.save
@@ -183,7 +183,7 @@ module ErpApp
183
183
  message = "Party Not Found"
184
184
  end
185
185
 
186
- render :json => { :success => success, :message => message } and return
186
+ render :json => {:success => success, :message => message} and return
187
187
  end
188
188
 
189
189
  def activate
@@ -196,11 +196,26 @@ module ErpApp
196
196
  message = "Invalid activation token."
197
197
  end
198
198
 
199
- render :json => { :success => success, :message => message } and return
199
+ render :json => {:success => success, :message => message} and return
200
+ end
201
+
202
+ def send_email
203
+ send_to = params[:send_to].strip
204
+ subject = params[:subject].strip
205
+ message = params[:message].strip
206
+ cc_email = params[:cc_email].blank? ? nil : params[:cc_email].strip
207
+
208
+ CrmMailer.send_message(send_to, subject, message).deliver
209
+
210
+ if cc_email
211
+ CrmMailer.send_message(cc_email, subject, message).deliver
212
+ end
213
+
214
+ render :json => {:success => true}
200
215
  end
201
216
 
202
217
  private
203
- def get_parties
218
+ def get_parties
204
219
  search_name = params[:party_name]
205
220
  party_type = params[:party_type]
206
221
  start = params[:start] || 0
@@ -209,24 +224,24 @@ module ErpApp
209
224
  total_count = Party.where("description like ? and business_party_type = ?", "%#{search_name}%", party_type).count
210
225
  parties = Party.where("description like ? and business_party_type = ?", "%#{search_name}%", party_type).order("id").offset(start).limit(limit)
211
226
 
212
- {:totalCount => total_count, :data => parties.collect{|party| {
213
- :id => party.id,
214
- :enterprise_identifier => party.enterprise_identifier,
215
- :created_at => party.created_at,
216
- :updated_at => party.updated_at,
217
- :business_party => party.business_party
218
- }}
227
+ {:totalCount => total_count, :data => parties.collect { |party| {
228
+ :id => party.id,
229
+ :enterprise_identifier => party.enterprise_identifier,
230
+ :created_at => party.created_at,
231
+ :updated_at => party.updated_at,
232
+ :business_party => party.business_party
233
+ } }
219
234
  }.to_json
220
- end
235
+ end
221
236
 
222
- def delete_party
237
+ def delete_party
223
238
  party_type = params[:party_type]
224
239
  Party.destroy(params[:id])
225
240
 
226
241
  {:data => [], :message => "#{party_type} deleted"}.to_json
227
- end
242
+ end
228
243
 
229
- def create_contact_mechanism
244
+ def create_contact_mechanism
230
245
  party_id = params[:party_id]
231
246
  contact_type = params[:contact_type]
232
247
  contact_purpose_id = params[:data][:contact_purpose_id]
@@ -234,7 +249,7 @@ module ErpApp
234
249
 
235
250
  contact_mechanism_class = contact_type.constantize
236
251
  party = Party.find(party_id)
237
-
252
+
238
253
  contact_purpose = contact_purpose_id.blank? ? ContactPurpose.find_by_internal_identifier('default') : ContactPurpose.find(contact_purpose_id)
239
254
  contact_mechanism = party.add_contact(contact_mechanism_class, params[:data], contact_purpose)
240
255
 
@@ -245,15 +260,15 @@ module ErpApp
245
260
  end
246
261
 
247
262
  "{\"success\":true, \"data\":#{contact_mechanism.to_json(:methods => [:contact_purpose_id])},\"message\":\"#{contact_type} added\"}"
248
- end
263
+ end
249
264
 
250
- def update_contact_mechanism
265
+ def update_contact_mechanism
251
266
  contact_type = params[:contact_type]
252
267
  contact_mechanism_id = params[:data][:id]
253
268
  contact_purpose_id = params[:data][:contact_purpose_id]
254
269
  params[:data].delete(:id)
255
270
  params[:data].delete(:contact_purpose_id)
256
-
271
+
257
272
  contact_mechanism = contact_type.constantize.find(contact_mechanism_id)
258
273
 
259
274
  if !contact_purpose_id.blank?
@@ -263,7 +278,7 @@ module ErpApp
263
278
  contact_mechanism.contact.save
264
279
  end
265
280
 
266
- params[:data].each do |key,value|
281
+ params[:data].each do |key, value|
267
282
  method = key + '='
268
283
  contact_mechanism.send method.to_sym, value
269
284
  end
@@ -277,9 +292,9 @@ module ErpApp
277
292
  end
278
293
 
279
294
  "{\"success\":true, \"data\":#{contact_mechanism.to_json(:methods => [:contact_purpose_id])},\"message\":\"#{contact_type} updated\"}"
280
- end
295
+ end
281
296
 
282
- def get_contact_mechanisms
297
+ def get_contact_mechanisms
283
298
  party_id = params[:party_id]
284
299
  contact_type = params[:contact_type]
285
300
 
@@ -295,9 +310,9 @@ module ErpApp
295
310
  end
296
311
 
297
312
  "{\"success\":true, \"data\":#{contact_mechanisms.to_json(:methods => [:contact_purpose_id])}}"
298
- end
313
+ end
299
314
 
300
- def delete_contact_mechanism
315
+ def delete_contact_mechanism
301
316
  party_id = params[:party_id]
302
317
  contact_type = params[:contact_type]
303
318
  contact_mechanism_id = params[:id]
@@ -308,10 +323,11 @@ module ErpApp
308
323
 
309
324
  party = Party.find(party_id)
310
325
  contact_mechanisms = party.find_all_contacts_by_contact_mechanism(contact_type_class)
311
-
326
+
312
327
  "{\"success\":true, \"data\":#{contact_mechanisms.to_json(:methods => [:contact_purpose_id])},\"message\":\"#{contact_type} deleted\"}"
313
- end
314
- end
315
- end
316
- end
317
- end
328
+ end
329
+
330
+ end #BaseController
331
+ end #Crm
332
+ end #Organizer
333
+ end #ErpApp
@@ -0,0 +1,9 @@
1
+ class CrmMailer < ActionMailer::Base
2
+ default :from => ErpTechSvcs::Config.email_notifications_from
3
+
4
+ def send_message(to_email, subject, message)
5
+ @message = message
6
+ mail(:to => to_email, :subject => subject)
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <%= raw @message %>
8
+ </body>
9
+ </html>
@@ -1,248 +1,256 @@
1
1
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <style type="text/css">
3
+ <head>
4
+ <style type="text/css">
5
5
 
6
- <%@desktop.applications.each do |application|%>
7
- .<%=application.shortcut_id%>-shortcut{
8
- background-image:url("/images/icons/<%=application.icon.split('-')[1]%>/<%=application.icon.split('-')[1]%>_48x48.png");
9
- height:48px;
10
- width:48px;
11
- }
12
- <%end%>
13
- .control-panel-win-shortcut{
14
- background-image:url("/images/icons/control_panel/control_panel_48x48.png");
15
- height:48px;
16
- width:48px;
6
+ <%@desktop.applications.each do |application|%>
7
+ .<%=application.shortcut_id%>-shortcut {
8
+ background-image: url("/images/icons/<%=application.icon.split('-')[1]%>/<%=application.icon.split('-')[1]%>_48x48.png");
9
+ height: 48px;
10
+ width: 48px;
11
+ }
12
+
13
+ <%end%>
14
+ .control-panel-win-shortcut {
15
+ background-image: url("/images/icons/control_panel/control_panel_48x48.png");
16
+ height: 48px;
17
+ width: 48px;
17
18
  }
18
19
 
19
- .web-navigator-win-shortcut{
20
- background-image:url("/images/icons/globe/globe_48x48.png");
21
- height:48px;
22
- width:48px;
20
+ .web-navigator-win-shortcut {
21
+ background-image: url("/images/icons/globe/globe_48x48.png");
22
+ height: 48px;
23
+ width: 48px;
23
24
  }
24
25
 
25
26
  #loading-mask {
26
- position: absolute;
27
- left: 0;
28
- top: 0;
29
- width: 100%;
30
- height: 100%;
31
- z-index: 20000;
32
- background-color: white;
27
+ position: absolute;
28
+ left: 0;
29
+ top: 0;
30
+ width: 100%;
31
+ height: 100%;
32
+ z-index: 20000;
33
+ background-color: white;
33
34
  }
34
35
 
35
36
  #loading {
36
- position: absolute;
37
- left: 50%;
38
- top: 50%;
39
- padding: 2px;
40
- z-index: 20001;
41
- height: auto;
42
- margin: -35px 0 0 -30px;
37
+ position: absolute;
38
+ left: 50%;
39
+ top: 50%;
40
+ padding: 2px;
41
+ z-index: 20001;
42
+ height: auto;
43
+ margin: -35px 0 0 -30px;
43
44
  }
44
45
 
45
46
  #loading .loading-indicator {
46
- background: url(/images/erp_app/ext_loading_image.gif) no-repeat;
47
- color: #555;
48
- font: bold 13px tahoma,arial,helvetica;
49
- padding: 8px 42px;
50
- margin: 0;
51
- text-align: center;
52
- height: auto;
47
+ background: url(/images/erp_app/ext_loading_image.gif) no-repeat;
48
+ color: #555;
49
+ font: bold 13px tahoma, arial, helvetica;
50
+ padding: 8px 42px;
51
+ margin: 0;
52
+ text-align: center;
53
+ height: auto;
53
54
  }
54
- </style>
55
+ </style>
56
+
57
+ <!--javascript-->
58
+ <%= include_extjs(:theme => @desktop.get_preference(:extjs_theme), :debug => (Rails.env != 'production')) %>
59
+ <%= static_javascript_include_tag("extjs/overrides.js") %>
55
60
 
56
- <!--javascript-->
57
- <%= include_extjs(:theme => @desktop.get_preference(:extjs_theme), :debug => (Rails.env != 'production')) %>
58
- <%= static_javascript_include_tag("extjs/overrides.js")%>
61
+ <%= static_javascript_include_tag("erp_app/utility.js") %>
62
+ <%= static_javascript_include_tag("erp_app/desktop/ext_ux_desktop_module.js") %>
59
63
 
60
- <%= static_javascript_include_tag("erp_app/utility.js")%>
61
- <%= static_javascript_include_tag("erp_app/desktop/ext_ux_desktop_module.js")%>
64
+ <%= static_javascript_include_tag('erp_app/widgets.js') %>
65
+ <%= include_widgets %>
66
+ <!-- shared application resources -->
67
+ <%= load_shared_application_resources(:javascripts) %>
68
+ <!-- end shared application resources -->
69
+ <%= static_javascript_include_tag(
70
+ "erp_app/desktop/applications/control_panel/module.js",
71
+ "erp_app/desktop/applications/control_panel/desktop_management_panel.js",
72
+ "erp_app/desktop/applications/control_panel/application_management_panel.js",
73
+ "erp_app/desktop/applications/web_navigator/module.js",
74
+ "erp_app/ckeditor/ckeditor.js"
75
+ ) %>
76
+ <!-- application resources -->
77
+ <%= static_javascript_include_tag(@desktop.applications.collect { |app| app.locate_resources('javascripts') }.flatten) %>
78
+ <!-- end application resources -->
79
+ <%= include_compass_ae_instance_about %>
80
+ <%= set_max_file_upload %>
81
+ <%= set_file_upload_types %>
82
+ <%= set_email_regex %>
62
83
 
63
- <%= static_javascript_include_tag('erp_app/widgets.js')%>
64
- <%= include_widgets%>
65
- <!-- shared application resources -->
66
- <%= load_shared_application_resources(:javascripts) %>
67
- <!-- end shared application resources -->
68
- <%= static_javascript_include_tag(
69
- "erp_app/desktop/applications/control_panel/module.js",
70
- "erp_app/desktop/applications/control_panel/desktop_management_panel.js",
71
- "erp_app/desktop/applications/control_panel/application_management_panel.js",
72
- "erp_app/desktop/applications/web_navigator/module.js",
73
- "erp_app/ckeditor/ckeditor.js"
74
- )%>
75
- <!-- application resources -->
76
- <%=static_javascript_include_tag(@desktop.applications.collect{|app| app.locate_resources('javascripts')}.flatten)%>
77
- <!-- end application resources -->
78
- <%=include_compass_ae_instance_about%>
79
- <%=set_max_file_upload%>
80
- <%=set_file_upload_types %>
81
- <%=set_email_regex %>
84
+ <!--stylesheets-->
85
+ <%= static_stylesheet_link_tag('erp_app/desktop/base.css') %>
86
+ <!-- shared application resources -->
87
+ <%= load_shared_application_resources(:stylesheets) %>
88
+ <!-- end application resources -->
89
+ <!-- application resources -->
90
+ <%= static_stylesheet_link_tag(@desktop.applications.collect { |app| app.locate_resources('stylesheets') }.flatten) %>
91
+ <!-- end application resources -->
92
+ <!-- compass extensions -->
93
+ <%= include_code_mirror_library %>
94
+ <style type="text/css">
95
+ .CodeMirror {
96
+ border: 1px solid #eee;
97
+ }
82
98
 
83
- <!--stylesheets-->
84
- <%= static_stylesheet_link_tag('erp_app/desktop/base.css') %>
85
- <!-- shared application resources -->
86
- <%= load_shared_application_resources(:stylesheets) %>
87
- <!-- end application resources -->
88
- <!-- application resources -->
89
- <%= static_stylesheet_link_tag(@desktop.applications.collect{|app| app.locate_resources('stylesheets')}.flatten)%>
90
- <!-- end application resources -->
91
- <!-- compass extensions -->
92
- <%=include_code_mirror_library%>
93
- <style type="text/css">
94
- .CodeMirror {
95
- border: 1px solid #eee;
96
- }
97
- .CodeMirror-scroll {
98
- height: auto;
99
- overflow-y: hidden;
100
- overflow-x: auto;
101
- width: 100%;
102
- }
103
- </style>
104
- <%=setup_js_authentication(@user, @desktop)%>
105
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
106
- <title>Compass Desktop</title>
107
- </head>
108
- <body>
109
- <script type="text/javascript">
110
- Ext.define("MyDesktop.App",{
111
- extend:"Ext.ux.desktop.App",
112
- requires:["Ext.window.MessageBox","Ext.ux.desktop.ShortcutModel"],
113
- init:function(){
114
- this.callParent()
99
+ .CodeMirror-scroll {
100
+ height: auto;
101
+ overflow-y: hidden;
102
+ overflow-x: auto;
103
+ width: 100%;
104
+ }
105
+ </style>
106
+ <%= setup_js_authentication(@user, @desktop) %>
107
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
108
+ <title>Compass Desktop</title>
109
+ </head>
110
+ <body>
111
+ <script type="text/javascript">
112
+ Ext.define("MyDesktop.App", {
113
+ extend: "Ext.ux.desktop.App",
114
+ requires: ["Ext.window.MessageBox", "Ext.ux.desktop.ShortcutModel"],
115
+ init: function () {
116
+ this.callParent()
115
117
  },
116
- getModules:function(){
117
- return[
118
- new Compass.ErpApp.Desktop.Applications.ControlPanel(),
119
- new Compass.ErpApp.Desktop.Applications.WebNavigator(),
120
- <%=raw @desktop.applications.collect{|app| "new #{app.javascript_class_name}()"}.join(",").to_s%>
121
- ]
118
+ getModules: function () {
119
+ return[
120
+ new Compass.ErpApp.Desktop.Applications.ControlPanel(),
121
+ new Compass.ErpApp.Desktop.Applications.WebNavigator(),
122
+ <%=raw @desktop.applications.collect{|app| "new #{app.javascript_class_name}()"}.join(",").to_s%>
123
+ ]
122
124
  },
123
- getDesktopConfig:function(){
124
- var b=this,a=b.callParent();
125
- return Ext.apply(a,{
126
- contextMenuItems:[
127
- {
128
- text:"Control Panel",
129
- handler:b.onControlPanel,
130
- iconCls:"icon-control_panel",
131
- scope:b
132
- }],
133
- shortcuts: Ext.create("Ext.data.Store",{
134
- model: "Ext.ux.desktop.ShortcutModel",
135
- data: [
136
- {name:"Control Panel",iconCls:"control-panel-win-shortcut",module:"control-panel-win"},
137
- {name:"Web Navigator",iconCls:"web-navigator-win-shortcut",module:"web-navigator-win"}<%=(@desktop.shortcuts.count > 0) ? ',' : '' %>
138
- <%=raw @desktop.shortcuts.collect{|app| "{name:'#{app.description}',iconCls:'#{app.shortcut_id}-shortcut',module:'#{app.shortcut_id}'}"}.join(",")%>
139
- ]
140
- }),
141
- wallpaper:"/images/wallpaper/<%=@desktop.get_preference(:desktop_background) %>",
142
- wallpaperStretch:true
143
- })
125
+ getDesktopConfig: function () {
126
+ var b = this, a = b.callParent();
127
+ return Ext.apply(a, {
128
+ contextMenuItems: [
129
+ {
130
+ text: "Control Panel",
131
+ handler: b.onControlPanel,
132
+ iconCls: "icon-control_panel",
133
+ scope: b
134
+ }
135
+ ],
136
+ shortcuts: Ext.create("Ext.data.Store", {
137
+ model: "Ext.ux.desktop.ShortcutModel",
138
+ data: [
139
+ {name: "Control Panel", iconCls: "control-panel-win-shortcut", module: "control-panel-win"},
140
+ {name: "Web Navigator", iconCls: "web-navigator-win-shortcut", module: "web-navigator-win"}<%=(@desktop.shortcuts.count > 0) ? ',' : '' %>
141
+ <%=raw @desktop.shortcuts.collect{|app| "{name:'#{app.description}',iconCls:'#{app.shortcut_id}-shortcut',module:'#{app.shortcut_id}'}"}.join(",")%>
142
+ ]
143
+ }),
144
+ wallpaper: "/images/wallpaper/<%=@desktop.get_preference(:desktop_background) %>",
145
+ wallpaperStretch: true
146
+ })
144
147
  },
145
- getStartConfig:function(){
146
- var b=this,a=b.callParent();
147
- return Ext.apply(a,{
148
- title:'<%=@user.party.description%>',
149
- iconCls:"icon-user",
150
- height:300,
151
- toolConfig:{
152
- width:100,
153
- items:[{
154
- text:"Logout",
155
- iconCls:"icon-key",
156
- handler:b.onLogout,
157
- scope:b
158
- },
159
- {
160
- text:"About",
161
- iconCls:"icon-info",
162
- handler:b.onHelp,
163
- scope:b
164
- }]
165
- }
166
- })
148
+ getStartConfig: function () {
149
+ var b = this, a = b.callParent();
150
+ return Ext.apply(a, {
151
+ title: '<%=@user.party.description%>',
152
+ iconCls: "icon-user",
153
+ height: 300,
154
+ toolConfig: {
155
+ width: 100,
156
+ items: [
157
+ {
158
+ text: "Logout",
159
+ iconCls: "icon-key",
160
+ handler: b.onLogout,
161
+ scope: b
162
+ },
163
+ {
164
+ text: "About",
165
+ iconCls: "icon-info",
166
+ handler: b.onHelp,
167
+ scope: b
168
+ }
169
+ ]
170
+ }
171
+ })
167
172
  },
168
- getTaskbarConfig:function(){
169
- var a=this.callParent();
170
- return Ext.apply(a,{
171
- quickStart:[{
172
- name:"Control Panel",
173
- iconCls:"icon-control_panel",
174
- module:"control-panel-win"
175
- }],
176
- trayItems:[{
177
- xtype:"trayclock",
178
- flex:1
179
- }]
180
- })
173
+ getTaskbarConfig: function () {
174
+ var a = this.callParent();
175
+ return Ext.apply(a, {
176
+ quickStart: [
177
+ {
178
+ name: "Control Panel",
179
+ iconCls: "icon-control_panel",
180
+ module: "control-panel-win"
181
+ }
182
+ ],
183
+ trayItems: [
184
+ {
185
+ xtype: "trayclock",
186
+ flex: 1
187
+ }
188
+ ]
189
+ })
181
190
  },
182
- onLogout:function(){
183
- Ext.Msg.confirm("Logout","Are you sure you want to logout?", function(btn, text){
184
- if(btn == 'yes'){
185
- window.location = '/session/sign_out';
186
- }
187
- })
191
+ onLogout: function () {
192
+ Ext.Msg.confirm("Logout", "Are you sure you want to logout?", function (btn, text) {
193
+ if (btn == 'yes') {
194
+ window.location = '/session/sign_out';
195
+ }
196
+ })
188
197
  },
189
- onHelp:function(){
190
- var tpl = new Ext.XTemplate("<table>",
191
- "<tr><td style='width:100px;'>Version: </td><td>{version}</td></tr>",
192
- "<tr><td>Installed at: </td><td>{installedAt}</td></tr>",
193
- "<tr><td>Last Update: </td><td>{lastUpdateAt}</td></tr>",
194
- "</table><br/>",
195
- "<h3>Installed Engines</h3><br/>",
196
- "<table>",
197
- "<tr><th style='width:150px;font-weight:bold;'>Name</th><th style='font-weight:bold;'>Version</th></tr>",
198
- '<tpl for="installedEngines">',
199
- "<tr><td>{name}</td><td>{version}</td></tr>",
200
- '</tpl>',
201
- "</table>");
198
+ onHelp: function () {
199
+ var tpl = new Ext.XTemplate("<table>",
200
+ "<tr><td style='width:100px;'>Version: </td><td>{version}</td></tr>",
201
+ "<tr><td>Installed at: </td><td>{installedAt}</td></tr>",
202
+ "<tr><td>Last Update: </td><td>{lastUpdateAt}</td></tr>",
203
+ "</table><br/>",
204
+ "<h3>Installed Engines</h3><br/>",
205
+ "<table>",
206
+ "<tr><th style='width:150px;font-weight:bold;'>Name</th><th style='font-weight:bold;'>Version</th></tr>",
207
+ '<tpl for="installedEngines">',
208
+ "<tr><td>{name}</td><td>{version}</td></tr>",
209
+ '</tpl>',
210
+ "</table>");
202
211
 
203
- var aboutWindow = Ext.create('Ext.window.Window',{
204
- title: 'About Your Compass AE Instance',
205
- height: 200,
206
- width: 400,
207
- layout: 'fit',
208
- resizable:false,
209
- autoScroll:true,
210
- tpl:tpl,
211
- data:compassAeInstance
212
- });
213
- aboutWindow.show();
212
+ var aboutWindow = Ext.create('Ext.window.Window', {
213
+ title: 'About Your Compass AE Instance',
214
+ height: 200,
215
+ width: 400,
216
+ layout: 'fit',
217
+ resizable: false,
218
+ autoScroll: true,
219
+ tpl: tpl,
220
+ data: compassAeInstance
221
+ });
222
+ aboutWindow.show();
214
223
  },
215
- onControlPanel:function(){
216
- var controlPanel = window.compassDesktop.getModule('control-panel-win');
217
- controlPanel.createWindow();
224
+ onControlPanel: function () {
225
+ var controlPanel = window.compassDesktop.getModule('control-panel-win');
226
+ controlPanel.createWindow();
218
227
  }
219
- });
228
+ });
220
229
 
221
- var compassDesktop;
222
- Ext.onReady(function () {
230
+ var compassDesktop;
231
+ Ext.onReady(function () {
223
232
  compassDesktop = new MyDesktop.App();
224
233
 
225
- setTimeout(function(){
226
- Ext.get('loading').remove();
227
- Ext.get('loading-mask').fadeOut({remove:true});
228
- <% @desktop.autoloads.each do |application| %>
234
+ setTimeout(function () {
235
+ Ext.get('loading').remove();
236
+ Ext.get('loading-mask').fadeOut({remove: true});
237
+ <% @desktop.autoloads.each do |application| %>
229
238
  compassDesktop.getModule('<%=application.shortcut_id%>').createWindow();
230
- <% end %>
239
+ <% end %>
231
240
  }, 250);
232
- });
233
241
 
234
- window.onbeforeunload = function(){
235
- return ' If you navigate away from this page without' +
236
- ' first saving your data, the changes will be' +
237
- ' lost.';
238
- }
239
- </script>
240
- <div id="loading-mask"></div>
241
- <div id="loading">
242
- <div class="loading-indicator">
243
- <p style='margin-left: -110px; margin-top: 30px;'>Loading Compass Desktop...</p>
244
- </div>
245
- </div>
246
- <%= setSessionTimeout %>
247
- </body>
242
+ // Push some history into this windows history to help prevent back button
243
+ for (var i = 0; i < 10; i++) {
244
+ window.history.pushState("history", 'CompassAE Desktop', "#"+i*new Date().getMilliseconds());
245
+ }
246
+ });
247
+ </script>
248
+ <div id="loading-mask"></div>
249
+ <div id="loading">
250
+ <div class="loading-indicator">
251
+ <p style='margin-left: -110px; margin-top: 30px;'>Loading Compass Desktop...</p>
252
+ </div>
253
+ </div>
254
+ <%= setSessionTimeout %>
255
+ </body>
248
256
  </html>