smukherjee-openbill 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. data/.actionScriptProperties +4 -1
  2. data/VERSION +1 -1
  3. data/app/controllers/application.rb +50 -0
  4. data/app/controllers/carts_controller.rb +0 -33
  5. data/app/controllers/products_controller.rb +48 -15
  6. data/app/controllers/sessions_controller.rb +2 -2
  7. data/app/controllers/settings_controller.rb +4 -2
  8. data/app/controllers/users_controller.rb +52 -0
  9. data/app/helpers/users_helper.rb +2 -0
  10. data/app/models/user.rb +7 -0
  11. data/app/views/layouts/users.html.erb +17 -0
  12. data/config/routes.rb +2 -1
  13. data/openbill.gemspec +20 -3
  14. data/pkg/openbill-0.1.6.gem +0 -0
  15. data/pkg/openbill-0.1.7.gem +0 -0
  16. data/public/admin.swf +0 -0
  17. data/public/images/delete.png +0 -0
  18. data/public/images/done.png +0 -0
  19. data/public/images/edit.png +0 -0
  20. data/public/modules/AdminHome.swf +0 -0
  21. data/public/modules/CustomerList.swf +0 -0
  22. data/public/stylesheets/default.css +1 -1
  23. data/src/admin.mxml +18 -6
  24. data/src/images/delete.png +0 -0
  25. data/src/images/done.png +0 -0
  26. data/src/images/edit.png +0 -0
  27. data/src/modules/AdminHome.mxml +26 -0
  28. data/src/modules/CustomerList.mxml +32 -0
  29. data/src/org/rsos/openbill/business/RailsDelegate.as +16 -0
  30. data/src/org/rsos/openbill/command/CustomerCommand.as +49 -0
  31. data/src/org/rsos/openbill/control/OpenbillController.as +1 -0
  32. data/src/org/rsos/openbill/event/CustomerEvent.as +29 -0
  33. data/src/org/rsos/openbill/model/OpenbillModelLocator.as +29 -15
  34. data/src/org/rsos/openbill/view/Header.mxml +9 -2
  35. data/src/org/rsos/openbill/view/SignIn.mxml +1 -1
  36. data/src/stylesheets/default.css +1 -1
  37. data/test/functional/users_controller_test.rb +8 -0
  38. metadata +20 -3
  39. data/src/org/rsos/openbill/view/Content.mxml +0 -20
@@ -21,6 +21,9 @@
21
21
  <applications>
22
22
  <application path="admin.mxml"/>
23
23
  </applications>
24
- <modules/>
24
+ <modules>
25
+ <module application="src/admin.mxml" destPath="modules/AdminHome.swf" optimize="true" sourcePath="src/modules/AdminHome.mxml"/>
26
+ <module application="src/admin.mxml" destPath="modules/CustomerList.swf" optimize="true" sourcePath="src/modules/CustomerList.mxml"/>
27
+ </modules>
25
28
  <buildCSSFiles/>
26
29
  </actionScriptProperties>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -46,4 +46,54 @@ class ApplicationController < ActionController::Base
46
46
 
47
47
  helper :all
48
48
 
49
+ def admin_login_required
50
+ if authorized?
51
+ @user = User.find(current_user.id)
52
+ if @user.role.role_name == "Admin"
53
+ session[:account_id] = @user.account_id
54
+ else
55
+ logout_killing_session!
56
+ access_denied
57
+ end
58
+ end
59
+
60
+ if params[:account_id]!=nil
61
+ session[:account_id] = params[:account_id]
62
+ elsif session[:account_id]==nil
63
+ session[:account_id]=1
64
+ end
65
+
66
+ @account = Account.find(session[:account_id])
67
+ end
68
+
69
+ def init_cart
70
+ if authorized?
71
+ @user = User.find(current_user.id)
72
+ if @user.role.role_name == "Customer"
73
+ session[:account_id] = @user.account_id
74
+ else
75
+ logout_killing_session!
76
+ end
77
+ else
78
+ @user = User.new
79
+ @user.account_id = session[:account_id]
80
+ end
81
+
82
+ if params[:account_id]!=nil
83
+ session[:account_id] = params[:account_id]
84
+ elsif session[:account_id]==nil
85
+ session[:account_id]=1
86
+ end
87
+
88
+ if session[:order]==nil
89
+ session[:order] = Order.new
90
+ session[:order].user = @user
91
+ end
92
+
93
+ @account = Account.find(session[:account_id])
94
+ @setting = @account.settings.find(:first)
95
+ @tlds = @account.tlds
96
+ @order = session[:order]
97
+ end
98
+
49
99
  end
@@ -189,38 +189,5 @@ protected
189
189
  flash[:error] = "Couldn't log you in as '#{params[:login]}'"
190
190
  logger.warn "Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}"
191
191
  end
192
-
193
- private
194
- def init_cart
195
-
196
- if authorized?
197
- @user = User.find(current_user.id)
198
- if @user.role.role_name == "Customer"
199
- session[:account_id] = @user.account_id
200
- else
201
- logout_killing_session!
202
- end
203
- else
204
- @user = User.new
205
- @user.account_id = session[:account_id]
206
- end
207
-
208
- if params[:account_id]!=nil
209
- session[:account_id] = params[:account_id]
210
- elsif session[:account_id]==nil
211
- session[:account_id]=1
212
- end
213
-
214
- if session[:order]==nil
215
- session[:order] = Order.new
216
- session[:order].user = @user
217
- end
218
-
219
- @account = Account.find(session[:account_id])
220
- @setting = @account.settings.find(:first)
221
- @tlds = @account.tlds
222
- @order = session[:order]
223
-
224
- end
225
192
 
226
193
  end
@@ -1,19 +1,52 @@
1
1
  class ProductsController < ApplicationController
2
-
3
- before_filter :login_required
2
+
3
+ before_filter :admin_login_required
4
+
5
+ # GET /products
6
+ # GET /products.xml
7
+ def index
8
+ @products = @account.products.find(:all)
9
+ render :xml => @products
10
+ end
4
11
 
5
- def index
6
- @products = User.find(current_user.id).account.products
7
- render :xml => @products, :status => :ok
12
+ # GET /products/1
13
+ # GET /products/1.xml
14
+ def show
15
+ @product = @account.products.find(params[:id])
16
+ render :xml => @product
17
+ end
18
+
19
+ # POST /products
20
+ # POST /products.xml
21
+ def create
22
+ @product = Product.new(params[:product])
23
+ if @product.save
24
+ flash[:notice] = 'Product was successfully created.'
25
+ render :xml => @product, :status => :ok
26
+ else
27
+ render :xml => @product.errors, :status => :ok
8
28
  end
9
-
10
- def update
11
- @products = User.find(current_user.id).account.products.find(params[:id])
12
- if @products.update_attributes(params[:products])
13
- flash[:notice] = 'Products was successfully updated.'
14
- render :xml => @products, :status => :ok
15
- else
16
- render :xml => @products.errors, :status => :ok
17
- end
29
+
30
+ end
31
+
32
+ # PUT /products/1
33
+ # PUT /products/1.xml
34
+ def update
35
+ @product = @account.products.find(params[:id])
36
+ if @product.update_attributes(params[:product])
37
+ flash[:notice] = 'Product was successfully updated.'
38
+ render :xml => @product, :status => :ok
39
+ else
40
+ render :xml => @product.errors, :status => :ok
18
41
  end
19
- end
42
+
43
+ end
44
+
45
+ # DELETE /products/1
46
+ # DELETE /products/1.xml
47
+ def destroy
48
+ @product = @account.products.find(params[:id])
49
+ @product.destroy
50
+ render :xml => @product, :status => :ok
51
+ end
52
+ end
@@ -3,7 +3,7 @@ class SessionsController < ApplicationController
3
3
  def create
4
4
  if authorized? && User.find(self.current_user.id).role.role_name == params[:role_name]
5
5
  @user = User.find(self.current_user.id)
6
- render :xml => @user.to_xml(:include => [:role, :account, :settings, :currencies], :except => [:activation_code,:crypted_password,:salt, :remember_token, :remember_token_expires_at]), :status=>:ok
6
+ render :xml => @user, :status=>:ok
7
7
  else
8
8
  logout_keeping_session!
9
9
  user = User.authenticate(params[:login], params[:password])
@@ -13,7 +13,7 @@ class SessionsController < ApplicationController
13
13
  handle_remember_cookie! new_cookie_flag
14
14
  flash[:notice] = "Logged in successfully"
15
15
  @user = User.find(self.current_user.id)
16
- render :xml => @user.to_xml(:include => [:role, :account, :settings, :currencies], :except => [:activation_code,:crypted_password,:salt, :remember_token, :remember_token_expires_at]), :status=>:ok
16
+ render :xml => @user, :status=>:ok
17
17
  else
18
18
  note_failed_signin
19
19
  @login = params[:login]
@@ -1,9 +1,11 @@
1
1
  class SettingsController < ApplicationController
2
2
 
3
- before_filter :login_required
3
+ before_filter :admin_login_required
4
4
 
5
+ # PUT /settings/1
6
+ # PUT /settings/1.xml
5
7
  def update
6
- @setting = User.find(current_user.id).settings.find(params[:id])
8
+ @setting = @account.settings.find(:first)
7
9
  if @setting.update_attributes(params[:setting])
8
10
  flash[:notice] = 'Settings was successfully updated.'
9
11
  render :xml => @setting, :status => :ok
@@ -0,0 +1,52 @@
1
+ class UsersController < ApplicationController
2
+
3
+ before_filter :admin_login_required
4
+
5
+ # GET /users
6
+ # GET /users.xml
7
+ def index
8
+ @users = @account.users.find(:all)
9
+ render :xml => @users
10
+ end
11
+
12
+ # GET /users/1
13
+ # GET /users/1.xml
14
+ def show
15
+ @user = @account.users.find(params[:id])
16
+ render :xml => @user
17
+ end
18
+
19
+ # POST /users
20
+ # POST /users.xml
21
+ def create
22
+ @user = User.new(params[:user])
23
+ if @user.save
24
+ flash[:notice] = 'User was successfully created.'
25
+ render :xml => @user, :status => :ok
26
+ else
27
+ render :xml => @user.errors, :status => :ok
28
+ end
29
+
30
+ end
31
+
32
+ # PUT /users/1
33
+ # PUT /users/1.xml
34
+ def update
35
+ @user = @account.users.find(params[:id])
36
+ if @user.update_attributes(params[:user])
37
+ flash[:notice] = 'User was successfully updated.'
38
+ render :xml => @user, :status => :ok
39
+ else
40
+ render :xml => @user.errors, :status => :ok
41
+ end
42
+
43
+ end
44
+
45
+ # DELETE /users/1
46
+ # DELETE /users/1.xml
47
+ def destroy
48
+ @user = @account.users.find(params[:id])
49
+ @user.destroy
50
+ render :xml => @user, :status => :ok
51
+ end
52
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
data/app/models/user.rb CHANGED
@@ -59,6 +59,13 @@ class User < ActiveRecord::Base
59
59
  def email=(value)
60
60
  write_attribute :email, (value ? value.downcase : nil)
61
61
  end
62
+
63
+ alias_method :_to_xml, :to_xml
64
+
65
+ def to_xml(options = {})
66
+ default_options = {:include => [:role, :account, :settings, :currencies], :except => [:activation_code,:crypted_password,:salt, :remember_token, :remember_token_expires_at]}
67
+ self._to_xml(options.merge(default_options))
68
+ end
62
69
 
63
70
  protected
64
71
  def make_activation_code
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
+ <title>Users: <%= controller.action_name %></title>
8
+ <%= stylesheet_link_tag 'scaffold' %>
9
+ </head>
10
+ <body>
11
+
12
+ <p style="color: green"><%= flash[:notice] %></p>
13
+
14
+ <%= yield %>
15
+
16
+ </body>
17
+ </html>
data/config/routes.rb CHANGED
@@ -21,7 +21,8 @@ ActionController::Routing::Routes.draw do |map|
21
21
  map.empty_cart '/empty_cart',
22
22
  :controller => 'carts',
23
23
  :action => 'empty_cart'
24
-
24
+
25
+ map.resources :users
25
26
  map.resources :products
26
27
  map.resources :settings
27
28
 
data/openbill.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{openbill}
5
- s.version = "0.1.6"
5
+ s.version = "0.1.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Siddhartha Mukherjee"]
9
- s.date = %q{2009-05-30}
9
+ s.date = %q{2009-05-31}
10
10
  s.description = %q{Open source web hosting billing platform}
11
11
  s.email = %q{support@rsos.in}
12
12
  s.extra_rdoc_files = [
@@ -30,11 +30,13 @@ Gem::Specification.new do |s|
30
30
  "app/controllers/products_controller.rb",
31
31
  "app/controllers/sessions_controller.rb",
32
32
  "app/controllers/settings_controller.rb",
33
+ "app/controllers/users_controller.rb",
33
34
  "app/helpers/application_helper.rb",
34
35
  "app/helpers/carts_helper.rb",
35
36
  "app/helpers/products_helper.rb",
36
37
  "app/helpers/sessions_helper.rb",
37
38
  "app/helpers/settings_helper.rb",
39
+ "app/helpers/users_helper.rb",
38
40
  "app/models/account.rb",
39
41
  "app/models/billingcycle.rb",
40
42
  "app/models/currency.rb",
@@ -72,6 +74,7 @@ Gem::Specification.new do |s|
72
74
  "app/views/carts/customer.html.erb",
73
75
  "app/views/carts/order.html.erb",
74
76
  "app/views/layouts/default.html.erb",
77
+ "app/views/layouts/users.html.erb",
75
78
  "app/views/user_mailer/activation.erb",
76
79
  "app/views/user_mailer/signup_notification.erb",
77
80
  "config/boot.rb",
@@ -124,6 +127,7 @@ Gem::Specification.new do |s|
124
127
  "pkg/openbill-0.1.4.gem",
125
128
  "pkg/openbill-0.1.5.gem",
126
129
  "pkg/openbill-0.1.6.gem",
130
+ "pkg/openbill-0.1.7.gem",
127
131
  "public/404.html",
128
132
  "public/422.html",
129
133
  "public/500.html",
@@ -318,6 +322,9 @@ Gem::Specification.new do |s|
318
322
  "public/history/history.js",
319
323
  "public/history/historyFrame.html",
320
324
  "public/images/avatar.png",
325
+ "public/images/delete.png",
326
+ "public/images/done.png",
327
+ "public/images/edit.png",
321
328
  "public/images/logo.png",
322
329
  "public/images/rails.png",
323
330
  "public/images/spinner.gif",
@@ -330,6 +337,8 @@ Gem::Specification.new do |s|
330
337
  "public/javascripts/jquery.localscroll.js",
331
338
  "public/javascripts/jquery.scrollTo.js",
332
339
  "public/javascripts/prototype.js",
340
+ "public/modules/AdminHome.swf",
341
+ "public/modules/CustomerList.swf",
333
342
  "public/playerProductInstall.swf",
334
343
  "public/privacy.html",
335
344
  "public/robots.txt",
@@ -547,17 +556,24 @@ Gem::Specification.new do |s|
547
556
  "src/assets/scroll/up_1.png",
548
557
  "src/assets/scroll/up_2.png",
549
558
  "src/assets/xml/listData.xml",
559
+ "src/images/delete.png",
560
+ "src/images/done.png",
561
+ "src/images/edit.png",
550
562
  "src/images/logo.png",
551
563
  "src/libs/Cairngorm.swc",
552
564
  "src/libs/flexlib.swc",
565
+ "src/modules/AdminHome.mxml",
566
+ "src/modules/CustomerList.mxml",
553
567
  "src/org/rsos/openbill/business/RailsDelegate.as",
554
568
  "src/org/rsos/openbill/business/Services.mxml",
569
+ "src/org/rsos/openbill/command/CustomerCommand.as",
555
570
  "src/org/rsos/openbill/command/FpCommand.as",
556
571
  "src/org/rsos/openbill/command/LoginCommand.as",
557
572
  "src/org/rsos/openbill/command/LogoutCommand.as",
558
573
  "src/org/rsos/openbill/command/ProductCommand.as",
559
574
  "src/org/rsos/openbill/command/SettingCommand.as",
560
575
  "src/org/rsos/openbill/control/OpenbillController.as",
576
+ "src/org/rsos/openbill/event/CustomerEvent.as",
561
577
  "src/org/rsos/openbill/event/FpEvent.as",
562
578
  "src/org/rsos/openbill/event/LoginEvent.as",
563
579
  "src/org/rsos/openbill/event/LogoutEvent.as",
@@ -565,7 +581,6 @@ Gem::Specification.new do |s|
565
581
  "src/org/rsos/openbill/event/SettingEvent.as",
566
582
  "src/org/rsos/openbill/model/OpenbillModelLocator.as",
567
583
  "src/org/rsos/openbill/util/ValueObjectUtil.as",
568
- "src/org/rsos/openbill/view/Content.mxml",
569
584
  "src/org/rsos/openbill/view/Footer.mxml",
570
585
  "src/org/rsos/openbill/view/Header.mxml",
571
586
  "src/org/rsos/openbill/view/Product.mxml",
@@ -606,6 +621,7 @@ Gem::Specification.new do |s|
606
621
  "test/functional/products_controller_test.rb",
607
622
  "test/functional/sessions_controller_test.rb",
608
623
  "test/functional/settings_controller_test.rb",
624
+ "test/functional/users_controller_test.rb",
609
625
  "test/integration/empty",
610
626
  "test/performance/browsing_test.rb",
611
627
  "test/test_helper.rb",
@@ -751,6 +767,7 @@ Gem::Specification.new do |s|
751
767
  "test/functional/products_controller_test.rb",
752
768
  "test/functional/sessions_controller_test.rb",
753
769
  "test/functional/settings_controller_test.rb",
770
+ "test/functional/users_controller_test.rb",
754
771
  "test/performance/browsing_test.rb",
755
772
  "test/test_helper.rb",
756
773
  "test/unit/account_test.rb",
Binary file
Binary file
data/public/admin.swf CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -572,7 +572,7 @@ DataGrid {
572
572
 
573
573
  .mydataGridHeaderStyle {
574
574
  textAlign: left;
575
- color: #333333;
575
+ color: #ABABAB;
576
576
  font-family: "Myriad Pro";
577
577
  font-weight: normal;
578
578
  font-size: 11;
data/src/admin.mxml CHANGED
@@ -38,6 +38,17 @@
38
38
  loginEvent.userVO = new UserVO();
39
39
  CairngormEventDispatcher.getInstance().dispatchEvent(loginEvent);
40
40
  }
41
+ private function handleSwfProgress(event:ProgressEvent):void{
42
+ pb.setProgress(((event.bytesLoaded/event.bytesTotal)*100), pb.maximum);
43
+ pb.validateNow();
44
+ if(event.bytesLoaded==event.bytesTotal){
45
+ pb.setProgress(pb.maximum,pb.maximum);
46
+ pb.visible=false;
47
+ mloader.validateNow();
48
+ }else{
49
+ pb.visible=true;
50
+ }
51
+ }
41
52
  ]]>
42
53
  </mx:Script>
43
54
 
@@ -48,12 +59,13 @@
48
59
 
49
60
  <!-- the FrontController, containing Commands specific to this application -->
50
61
  <control:OpenbillController id="controller" />
51
- <ns1:Header left="0" top="0" right="0">
52
- </ns1:Header>
53
- <ns1:Footer bottom="0" left="0" right="0">
54
- </ns1:Footer>
55
- <ns1:Content left="0" right="0" top="80" bottom="50">
56
- </ns1:Content>
62
+ <ns1:Header visible="{model.loggedin}" left="0" top="0" right="0" />
63
+ <ns1:Footer visible="{model.loggedin}" bottom="0" left="0" right="0" />
64
+ <mx:HBox left="0" right="0" top="80" bottom="50">
65
+ <mx:VBox width="250" height="100%" />
66
+ <mx:ModuleLoader visible="{model.loggedin}" progress="handleSwfProgress(event)" id="mloader"/>
67
+ </mx:HBox>
68
+ <mx:ProgressBar visible="false" horizontalCenter="0" verticalCenter="0" labelPlacement="center" width="200" color="#BBBBBB" fontWeight="normal" minimum="0" maximum="100" indeterminate="false" id="pb"/>
57
69
 
58
70
  <!-- ========================================================================== -->
59
71
 
Binary file
Binary file
Binary file
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
3
+ <mx:DropShadowFilter id="dropShadow" distance="1" angle="45" blurX="0" blurY="0" alpha="1" color="0x111111" />
4
+ <mx:Label text="Admin home" filters="{[dropShadow]}" fontWeight="bold" fontSize="20" color="#60AAFF" left="0" top="10"/>
5
+ <mx:VBox backgroundColor="#000000" dropShadowEnabled="true" dropShadowColor="#000000" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5" shadowDirection="right" shadowDistance="5" borderStyle="solid" left="0" top="44">
6
+ <mx:BarChart id="barchart1" height="150" width="275" showAllDataTips="true" showDataTips="true" dataTipMode="multiple" selectionMode="multiple">
7
+ <mx:series>
8
+ <mx:BarSeries displayName="Orphan order" xField=""/>
9
+ <mx:BarSeries displayName="Pending order" xField=""/>
10
+ <mx:BarSeries displayName="Active order" xField=""/>
11
+ </mx:series>
12
+ </mx:BarChart>
13
+ <mx:Legend dataProvider="{barchart1}" backgroundColor="#111111"/>
14
+ </mx:VBox>
15
+
16
+ <mx:VBox backgroundColor="#000000" dropShadowEnabled="true" dropShadowColor="#000000" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5" shadowDirection="right" shadowDistance="5" borderStyle="solid" left="331" top="44">
17
+ <mx:BarChart id="barchart2" height="150" width="250" showAllDataTips="true" showDataTips="true" dataTipMode="multiple" selectionMode="multiple">
18
+ <mx:series>
19
+ <mx:BarSeries displayName="Pending invoice" xField=""/>
20
+ <mx:BarSeries displayName="Paid invoice" xField=""/>
21
+ <mx:BarSeries displayName="Overdue invoice" xField=""/>
22
+ </mx:series>
23
+ </mx:BarChart>
24
+ <mx:Legend dataProvider="{barchart2}" backgroundColor="#111111"/>
25
+ </mx:VBox>
26
+ </mx:Module>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
3
+ <mx:Script>
4
+ <![CDATA[
5
+ import org.rsos.openbill.model.OpenbillModelLocator;
6
+ [Bindable]
7
+ private var model:OpenbillModelLocator = OpenbillModelLocator.getInstance();
8
+ ]]>
9
+ </mx:Script>
10
+ <mx:DropShadowFilter id="dropShadow" distance="1" angle="45" blurX="0" blurY="0" alpha="1" color="0x111111" />
11
+ <mx:Label text="Customer list" filters="{[dropShadow]}" fontWeight="bold" fontSize="20" color="#60AAFF" top="10" left="0"/>
12
+ <mx:VBox backgroundColor="#000000" dropShadowEnabled="true" dropShadowColor="#000000" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5" shadowDirection="right" shadowDistance="5" borderStyle="solid" left="0" top="44">
13
+ <mx:DataGrid width="600" height="400" dataProvider="{model.customerArray}">
14
+ <mx:columns>
15
+ <mx:DataGridColumn headerText="Name" dataField="name"/>
16
+ <mx:DataGridColumn headerText="Email" dataField="email"/>
17
+ <mx:DataGridColumn headerText="Orders"/>
18
+ <mx:DataGridColumn headerText="Invoices"/>
19
+ <mx:DataGridColumn headerText="">
20
+ <mx:itemRenderer>
21
+ <mx:Component>
22
+ <mx:HBox width="100">
23
+ <mx:Image buttonMode="true" useHandCursor="true" source="images/edit.png" width="16" height="16"/>
24
+ <mx:Image buttonMode="true" useHandCursor="true" source="images/delete.png" width="16" height="16"/>
25
+ </mx:HBox>
26
+ </mx:Component>
27
+ </mx:itemRenderer>
28
+ </mx:DataGridColumn>
29
+ </mx:columns>
30
+ </mx:DataGrid>
31
+ </mx:VBox>
32
+ </mx:Module>
@@ -19,6 +19,22 @@ package org.rsos.openbill.business
19
19
  this.service = ServiceLocator.getInstance().getHTTPService( "RailsService" );
20
20
  this.responder = responder;
21
21
  }
22
+ public function customer(userVO:UserVO, action:String):void
23
+ {
24
+ var params:Object = new Object();
25
+ if(userVO!=null){
26
+ params['users[id]']=userVO.id;
27
+ }
28
+ params['_method'] = action;
29
+
30
+ service.url = "/users";
31
+ service.method = action;
32
+ if (action=="PUT")service.method = "POST";
33
+
34
+ var token:AsyncToken = service.send(params);
35
+ token.resultHandler = responder.result;
36
+ token.faultHandler = responder.fault;
37
+ }
22
38
  public function product(productVO:ProductVO, action:String):void
23
39
  {
24
40
  var params:Object = new Object();
@@ -0,0 +1,49 @@
1
+ package org.rsos.openbill.command
2
+ {
3
+ /* add to controller
4
+ addCommand( CustomerEvent.EVENT_CUSTOMER, CustomerCommand );
5
+ */
6
+ import com.adobe.cairngorm.control.CairngormEvent;
7
+ import com.adobe.cairngorm.commands.ICommand;
8
+
9
+ import org.rsos.openbill.model.OpenbillModelLocator;
10
+ import org.rsos.openbill.business.RailsDelegate;
11
+ import org.rsos.openbill.event.CustomerEvent;
12
+
13
+ import mx.controls.Alert;
14
+ import mx.rpc.IResponder;
15
+ import mx.rpc.events.FaultEvent;
16
+
17
+ public class CustomerCommand implements ICommand, IResponder
18
+ {
19
+ public function execute(event:CairngormEvent):void
20
+ {
21
+ var delegate : RailsDelegate = new RailsDelegate( this )
22
+
23
+ delegate.customer(CustomerEvent(event).userVO, CustomerEvent(event).action);
24
+
25
+ }
26
+
27
+ public function result(data:Object):void
28
+ {
29
+ var model:OpenbillModelLocator = OpenbillModelLocator.getInstance();
30
+ var resultXML:XML = XML(data.result);
31
+ if(resultXML.hasComplexContent()){
32
+ var users:XMLList = resultXML.children();
33
+ var tmp:Array = new Array();
34
+ for(var i:Number=0; i<users.length(); i++)
35
+ {
36
+ tmp.push(model.GetUserVOFromXML(users[i]));
37
+ }
38
+ model.customerArray = tmp;
39
+ }
40
+ }
41
+
42
+ public function fault(info:Object):void
43
+ {
44
+ var faultEvent :FaultEvent = FaultEvent( info )
45
+ Alert.show( "fault at customer" )
46
+ }
47
+
48
+ }
49
+ }
@@ -19,6 +19,7 @@ package org.rsos.openbill.control
19
19
  addCommand( FpEvent.EVENT_FP, FpCommand );
20
20
  addCommand( SettingEvent.EVENT_SETTING, SettingCommand );
21
21
  addCommand( ProductEvent.EVENT_PRODUCT, ProductCommand );
22
+ addCommand( CustomerEvent.EVENT_CUSTOMER, CustomerCommand );
22
23
  }
23
24
  }
24
25
 
@@ -0,0 +1,29 @@
1
+ package org.rsos.openbill.event
2
+ {
3
+ import com.adobe.cairngorm.control.CairngormEvent;
4
+
5
+ import flash.events.Event;
6
+
7
+ import org.rsos.openbill.vo.UserVO;
8
+
9
+ public class CustomerEvent extends CairngormEvent
10
+ {
11
+
12
+ public static var EVENT_CUSTOMER : String = "Customer";
13
+ public var userVO:UserVO;
14
+ public var action:String = "GET";
15
+ public function CustomerEvent()
16
+ {
17
+ super(EVENT_CUSTOMER);
18
+ }
19
+
20
+ /**
21
+ * Override the inherited clone() method, but don't return any state.
22
+ */
23
+ override public function clone() : Event
24
+ {
25
+ return new CustomerEvent();
26
+ }
27
+
28
+ }
29
+ }
@@ -3,9 +3,10 @@ package org.rsos.openbill.model
3
3
  import com.adobe.cairngorm.control.CairngormEventDispatcher;
4
4
  import com.adobe.cairngorm.model.ModelLocator;
5
5
 
6
+ import mx.core.Application;
6
7
  import mx.managers.PopUpManager;
7
8
 
8
- import org.rsos.openbill.event.ProductEvent;
9
+ import org.rsos.openbill.event.CustomerEvent;
9
10
  import org.rsos.openbill.view.*;
10
11
  import org.rsos.openbill.vo.*;
11
12
 
@@ -28,7 +29,16 @@ package org.rsos.openbill.model
28
29
  }
29
30
 
30
31
  private var signin:SignIn;
31
-
32
+
33
+ public function set load(module:String):void{
34
+
35
+ var url:String='modules/'+module+'.swf';
36
+
37
+ if(Application.application.mloader.url!=url){
38
+ Application.application.mloader.unloadModule();
39
+ Application.application.mloader.loadModule(url);
40
+ }
41
+ }
32
42
 
33
43
  public function ReportError(e:*):void{
34
44
 
@@ -40,15 +50,9 @@ package org.rsos.openbill.model
40
50
  PopUpManager.addPopUp(setting, parent, true);
41
51
  }
42
52
 
43
- public function showproduct(parent:*, productVO:ProductVO):void
44
- {
45
- var product:Product = new Product();
46
- product.productVO = productVO;
47
- PopUpManager.addPopUp(product, parent, true);
48
- }
49
-
50
53
  public function askforlogin(parent:*):void
51
54
  {
55
+ loggedin = false;
52
56
  try{
53
57
  signin.closeWindow();
54
58
  }catch(e:Error){ReportError(e)}
@@ -59,13 +63,11 @@ package org.rsos.openbill.model
59
63
  }
60
64
  public function dologin():void
61
65
  {
66
+ loggedin = true;
62
67
  try{
63
68
  signin.closeWindow();
64
69
  }catch(e:Error){ReportError(e)}
65
-
66
- var listProducts:ProductEvent = new ProductEvent();
67
- listProducts.action = "GET";
68
- CairngormEventDispatcher.getInstance().dispatchEvent(listProducts);
70
+ load = "AdminHome";
69
71
 
70
72
  }
71
73
  public function GetUserVOFromXML(resultXML:XML):UserVO
@@ -144,7 +146,7 @@ package org.rsos.openbill.model
144
146
 
145
147
  public function GetProductVOFromXML(resultXML:XML):ProductVO
146
148
  {
147
- var productVO:ProductVO = new ProductVO()
149
+ var productVO:ProductVO = new ProductVO();
148
150
  try{
149
151
  productVO.id = Number(resultXML.id);
150
152
  productVO.account = userVO.account;
@@ -157,7 +159,7 @@ package org.rsos.openbill.model
157
159
 
158
160
  public function GetCurrencyVOFromXML(resultXML:XML):CurrencyVO
159
161
  {
160
- var currencyVO:CurrencyVO = new CurrencyVO()
162
+ var currencyVO:CurrencyVO = new CurrencyVO();
161
163
  try{
162
164
  currencyVO.id = Number(resultXML.id);
163
165
  currencyVO.currency_name = String(resultXML.currency_name);
@@ -180,9 +182,21 @@ package org.rsos.openbill.model
180
182
  }
181
183
 
182
184
  /* bindables go here */
185
+ public var loggedin:Boolean = false;
183
186
  public var userVO:UserVO;
184
187
  public var productsArray:Array;
185
188
  public var dateFormats:Array = ["YYYY-MM-DD", "DD-MM-YYYY"];
186
189
  public var currenyArray:Array = [];
190
+ public var customerArray:Array = [];
191
+ public var adminArray:Array = [];
192
+ public var staffArray:Array = [];
193
+ public var guestArray:Array = [];
194
+
195
+ public function getcustomerlist():void
196
+ {
197
+ var customerEvent:CustomerEvent = new CustomerEvent();
198
+ CairngormEventDispatcher.getInstance().dispatchEvent(customerEvent);
199
+ }
200
+
187
201
  }
188
202
  }
@@ -19,12 +19,12 @@
19
19
  private var menubarXML:XMLList =
20
20
  <>
21
21
  <menuitem label="Home" data="top">
22
- <menuitem label="Admin home" data="1A"/>
22
+ <menuitem label="Admin home" data="adminhome"/>
23
23
  <menuitem label="Settings" data="setting"/>
24
24
  <menuitem label="Logout" data="logout"/>
25
25
  </menuitem>
26
26
  <menuitem label="Customer" data="top">
27
- <menuitem label="List customers" data="2A"/>
27
+ <menuitem label="List customers" data="customerlist"/>
28
28
  <menuitem label="Add customer" data="2B"/>
29
29
  <menuitem label="List custom fields" data="2C"/>
30
30
  <menuitem label="Add custom field" data="2D"/>
@@ -77,8 +77,15 @@
77
77
 
78
78
  private function menuHandler(event:MenuEvent):void {
79
79
  if (event.item.@data != "top") {
80
+ if (event.item.@data.toString()=="adminhome") model.load = "AdminHome";
80
81
  if (event.item.@data.toString()=="setting") opensetting();
81
82
  if (event.item.@data.toString()=="logout") logout();
83
+
84
+ if (event.item.@data.toString()=="customerlist")
85
+ {
86
+ model.getcustomerlist();
87
+ model.load = "CustomerList";
88
+ }
82
89
  }
83
90
  }
84
91
 
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ns1="flexlib.controls.*" xmlns:ns2="flexlib.containers.*" horizontalAlign="center" verticalAlign="middle" creationComplete="centerWindow()" >
2
+ <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ns1="flexlib.controls.*" xmlns:ns2="flexlib.containers.*" horizontalAlign="center" verticalAlign="middle" creationComplete="centerWindow()">
3
3
  <mx:states>
4
4
  <mx:State name="fp">
5
5
  <mx:SetProperty target="{label1}" name="text" value="Password reset"/>
@@ -572,7 +572,7 @@ DataGrid {
572
572
 
573
573
  .mydataGridHeaderStyle {
574
574
  textAlign: left;
575
- color: #333333;
575
+ color: #ABABAB;
576
576
  font-family: "Myriad Pro";
577
577
  font-weight: normal;
578
578
  font-size: 11;
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class UsersControllerTest < ActionController::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smukherjee-openbill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siddhartha Mukherjee
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-30 00:00:00 -07:00
12
+ date: 2009-05-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -39,11 +39,13 @@ files:
39
39
  - app/controllers/products_controller.rb
40
40
  - app/controllers/sessions_controller.rb
41
41
  - app/controllers/settings_controller.rb
42
+ - app/controllers/users_controller.rb
42
43
  - app/helpers/application_helper.rb
43
44
  - app/helpers/carts_helper.rb
44
45
  - app/helpers/products_helper.rb
45
46
  - app/helpers/sessions_helper.rb
46
47
  - app/helpers/settings_helper.rb
48
+ - app/helpers/users_helper.rb
47
49
  - app/models/account.rb
48
50
  - app/models/billingcycle.rb
49
51
  - app/models/currency.rb
@@ -81,6 +83,7 @@ files:
81
83
  - app/views/carts/customer.html.erb
82
84
  - app/views/carts/order.html.erb
83
85
  - app/views/layouts/default.html.erb
86
+ - app/views/layouts/users.html.erb
84
87
  - app/views/user_mailer/activation.erb
85
88
  - app/views/user_mailer/signup_notification.erb
86
89
  - config/boot.rb
@@ -133,6 +136,7 @@ files:
133
136
  - pkg/openbill-0.1.4.gem
134
137
  - pkg/openbill-0.1.5.gem
135
138
  - pkg/openbill-0.1.6.gem
139
+ - pkg/openbill-0.1.7.gem
136
140
  - public/404.html
137
141
  - public/422.html
138
142
  - public/500.html
@@ -327,6 +331,9 @@ files:
327
331
  - public/history/history.js
328
332
  - public/history/historyFrame.html
329
333
  - public/images/avatar.png
334
+ - public/images/delete.png
335
+ - public/images/done.png
336
+ - public/images/edit.png
330
337
  - public/images/logo.png
331
338
  - public/images/rails.png
332
339
  - public/images/spinner.gif
@@ -339,6 +346,8 @@ files:
339
346
  - public/javascripts/jquery.localscroll.js
340
347
  - public/javascripts/jquery.scrollTo.js
341
348
  - public/javascripts/prototype.js
349
+ - public/modules/AdminHome.swf
350
+ - public/modules/CustomerList.swf
342
351
  - public/playerProductInstall.swf
343
352
  - public/privacy.html
344
353
  - public/robots.txt
@@ -556,17 +565,24 @@ files:
556
565
  - src/assets/scroll/up_1.png
557
566
  - src/assets/scroll/up_2.png
558
567
  - src/assets/xml/listData.xml
568
+ - src/images/delete.png
569
+ - src/images/done.png
570
+ - src/images/edit.png
559
571
  - src/images/logo.png
560
572
  - src/libs/Cairngorm.swc
561
573
  - src/libs/flexlib.swc
574
+ - src/modules/AdminHome.mxml
575
+ - src/modules/CustomerList.mxml
562
576
  - src/org/rsos/openbill/business/RailsDelegate.as
563
577
  - src/org/rsos/openbill/business/Services.mxml
578
+ - src/org/rsos/openbill/command/CustomerCommand.as
564
579
  - src/org/rsos/openbill/command/FpCommand.as
565
580
  - src/org/rsos/openbill/command/LoginCommand.as
566
581
  - src/org/rsos/openbill/command/LogoutCommand.as
567
582
  - src/org/rsos/openbill/command/ProductCommand.as
568
583
  - src/org/rsos/openbill/command/SettingCommand.as
569
584
  - src/org/rsos/openbill/control/OpenbillController.as
585
+ - src/org/rsos/openbill/event/CustomerEvent.as
570
586
  - src/org/rsos/openbill/event/FpEvent.as
571
587
  - src/org/rsos/openbill/event/LoginEvent.as
572
588
  - src/org/rsos/openbill/event/LogoutEvent.as
@@ -574,7 +590,6 @@ files:
574
590
  - src/org/rsos/openbill/event/SettingEvent.as
575
591
  - src/org/rsos/openbill/model/OpenbillModelLocator.as
576
592
  - src/org/rsos/openbill/util/ValueObjectUtil.as
577
- - src/org/rsos/openbill/view/Content.mxml
578
593
  - src/org/rsos/openbill/view/Footer.mxml
579
594
  - src/org/rsos/openbill/view/Header.mxml
580
595
  - src/org/rsos/openbill/view/Product.mxml
@@ -615,6 +630,7 @@ files:
615
630
  - test/functional/products_controller_test.rb
616
631
  - test/functional/sessions_controller_test.rb
617
632
  - test/functional/settings_controller_test.rb
633
+ - test/functional/users_controller_test.rb
618
634
  - test/integration/empty
619
635
  - test/performance/browsing_test.rb
620
636
  - test/test_helper.rb
@@ -779,6 +795,7 @@ test_files:
779
795
  - test/functional/products_controller_test.rb
780
796
  - test/functional/sessions_controller_test.rb
781
797
  - test/functional/settings_controller_test.rb
798
+ - test/functional/users_controller_test.rb
782
799
  - test/performance/browsing_test.rb
783
800
  - test/test_helper.rb
784
801
  - test/unit/account_test.rb
@@ -1,20 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">
3
- <mx:VBox height="100%" width="250">
4
- </mx:VBox>
5
- <mx:VBox width="100%" height="100%">
6
- <mx:VBox backgroundColor="#000000" dropShadowEnabled="true" dropShadowColor="#000000" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" shadowDirection="right" shadowDistance="5" borderStyle="solid">
7
- <mx:BarChart id="barchart1" height="200" width="350" showAllDataTips="true" showDataTips="true" dataTipMode="multiple" selectionMode="multiple">
8
- <mx:series>
9
- <mx:BarSeries displayName="Pending order" xField=""/>
10
- <mx:BarSeries displayName="Active order" xField=""/>
11
- <mx:BarSeries displayName="Completed order" xField=""/>
12
- <mx:BarSeries displayName="Suspended order" xField=""/>
13
- </mx:series>
14
- </mx:BarChart>
15
- <mx:Legend dataProvider="{barchart1}" width="350" backgroundColor="#111111"/>
16
- </mx:VBox>
17
-
18
- </mx:VBox>
19
-
20
- </mx:HBox>