Browse Source

Renamed class name to get app model name.

Martin Edenhofer 11 years ago
parent
commit
438baa1231

+ 2 - 2
app/controllers/application_controller.rb

@@ -257,7 +257,7 @@ class ApplicationController < ActionController::Base
     begin
 
       # create object
-      generic_object = object.new( object.param_cleanup( params[object.to_app_model] ) )
+      generic_object = object.new( object.param_cleanup( params[object.to_app_model_url] ) )
 
       # save object
       generic_object.save!
@@ -281,7 +281,7 @@ class ApplicationController < ActionController::Base
       generic_object = object.find( params[:id] )
 
       # save object
-      generic_object.update_attributes!( object.param_cleanup( params[object.to_app_model] ) )
+      generic_object.update_attributes!( object.param_cleanup( params[object.to_app_model_url] ) )
       model_update_render_item(generic_object)
     rescue Exception => e
       logger.error e.message

+ 9 - 9
app/controllers/sessions/collection_base.rb

@@ -4,29 +4,29 @@ module ExtraCollection
   def session( collections, user )
 
     # all base stuff
-    collections[ Taskbar.to_online_model ]       = Taskbar.where( :user_id => user.id )
-    collections[ Role.to_online_model ]          = Role.all
-    collections[ Group.to_online_model ]         = Group.all
+    collections[ Taskbar.to_app_model ]       = Taskbar.where( :user_id => user.id )
+    collections[ Role.to_app_model ]          = Role.all
+    collections[ Group.to_app_model ]         = Group.all
 
     if !user.is_role('Customer')
-      collections[ Organization.to_online_model ]  = Organization.all
+      collections[ Organization.to_app_model ]  = Organization.all
     else
       if user.organization_id
-        collections[ Organization.to_online_model ]  = Organization.where( :id => user.organization_id )
+        collections[ Organization.to_app_model ]  = Organization.where( :id => user.organization_id )
       end
     end
   end
   def push( collections, user )
 
     # all base stuff
-    collections[ Role.to_online_model ]          = Role.all
-    collections[ Group.to_online_model ]         = Group.all
+    collections[ Role.to_app_model ]          = Role.all
+    collections[ Group.to_app_model ]         = Group.all
 
     if !user.is_role('Customer')
-      collections[ Organization.to_online_model ]  = Organization.all
+      collections[ Organization.to_app_model ]  = Organization.all
     else
       if user.organization_id
-        collections[ Organization.to_online_model ]  = Organization.where( :id => user.organization_id )
+        collections[ Organization.to_app_model ]  = Organization.where( :id => user.organization_id )
       end
     end
   end

+ 8 - 8
app/controllers/sessions/collection_network.rb

@@ -3,18 +3,18 @@
 module ExtraCollection
   def session( collections, user )
 
-    collections[ Network.to_online_model ]                 = Network.all
-    collections[ Network::Category.to_online_model ]       = Network::Category.all
-    collections[ Network::Category::Type.to_online_model ] = Network::Category::Type.all
-    collections[ Network::Privacy.to_online_model ]        = Network::Privacy.all
+    collections[ Network.to_app_model ]                 = Network.all
+    collections[ Network::Category.to_app_model ]       = Network::Category.all
+    collections[ Network::Category::Type.to_app_model ] = Network::Category::Type.all
+    collections[ Network::Privacy.to_app_model ]        = Network::Privacy.all
 
   end
   def push( collections, user )
 
-    collections[ Network.to_online_model ]                 = Network.all
-    collections[ Network::Category.to_online_model ]       = Network::Category.all
-    collections[ Network::Category::Type.to_online_model ] = Network::Category::Type.all
-    collections[ Network::Privacy.to_online_model ]        = Network::Privacy.all
+    collections[ Network.to_app_model ]                 = Network.all
+    collections[ Network::Category.to_app_model ]       = Network::Category.all
+    collections[ Network::Category::Type.to_app_model ] = Network::Category::Type.all
+    collections[ Network::Privacy.to_app_model ]        = Network::Privacy.all
 
   end
   module_function :session, :push

+ 14 - 14
app/controllers/sessions/collection_ticket.rb

@@ -4,37 +4,37 @@ module ExtraCollection
   def session( collections, user )
 
     # all ticket stuff
-    collections[ Ticket::StateType.to_online_model ]       = Ticket::StateType.all
-    collections[ Ticket::State.to_online_model ]           = Ticket::State.all
-    collections[ Ticket::Priority.to_online_model ]        = Ticket::Priority.all
-    collections[ Ticket::Article::Type.to_online_model ]   = Ticket::Article::Type.all
-    collections[ Ticket::Article::Sender.to_online_model ] = Ticket::Article::Sender.all
+    collections[ Ticket::StateType.to_app_model ]       = Ticket::StateType.all
+    collections[ Ticket::State.to_app_model ]           = Ticket::State.all
+    collections[ Ticket::Priority.to_app_model ]        = Ticket::Priority.all
+    collections[ Ticket::Article::Type.to_app_model ]   = Ticket::Article::Type.all
+    collections[ Ticket::Article::Sender.to_app_model ] = Ticket::Article::Sender.all
 
     if !user.is_role('Customer')
 
       # all signatures
-      collections[ Signature.to_online_model ]     = Signature.all
+      collections[ Signature.to_app_model ]     = Signature.all
 
       # all email addresses
-      collections[ EmailAddress.to_online_model ]  = EmailAddress.all
+      collections[ EmailAddress.to_app_model ]  = EmailAddress.all
     end
   end
   def push( collections, user )
 
     # all ticket stuff
-    collections[ Ticket::StateType.to_online_model ]       = Ticket::StateType.all
-    collections[ Ticket::State.to_online_model ]           = Ticket::State.all
-    collections[ Ticket::Priority.to_online_model ]        = Ticket::Priority.all
-    collections[ Ticket::Article::Type.to_online_model ]   = Ticket::Article::Type.all
-    collections[ Ticket::Article::Sender.to_online_model ] = Ticket::Article::Sender.all
+    collections[ Ticket::StateType.to_app_model ]       = Ticket::StateType.all
+    collections[ Ticket::State.to_app_model ]           = Ticket::State.all
+    collections[ Ticket::Priority.to_app_model ]        = Ticket::Priority.all
+    collections[ Ticket::Article::Type.to_app_model ]   = Ticket::Article::Type.all
+    collections[ Ticket::Article::Sender.to_app_model ] = Ticket::Article::Sender.all
 
     if !user.is_role('Customer')
 
       # all signatures
-      collections[ Signature.to_online_model ]     = Signature.all
+      collections[ Signature.to_app_model ]     = Signature.all
 
       # all email addresses
-      collections[ EmailAddress.to_online_model ]  = EmailAddress.all
+      collections[ EmailAddress.to_app_model ]  = EmailAddress.all
     end
   end
 

+ 1 - 1
app/controllers/sessions_controller.rb

@@ -161,7 +161,7 @@ class SessionsController < ApplicationController
     }
     render :json => {
       :sessions                   => sessions_clean,
-      User.to_online_model.to_sym => users,
+      User.to_app_model => users,
     }
   end
 

+ 3 - 3
app/controllers/ticket_overviews_controller.rb

@@ -49,7 +49,7 @@ class TicketOverviewsController < ApplicationController
     end
 
     # get related users
-    assets = { User.to_online_model.to_sym => {} }
+    assets = { User.to_app_model => {} }
     overview[:ticket_ids].each {|ticket_id|
       ticket = Ticket.lookup( :id => ticket_id )
       assets = ticket.assets(assets)
@@ -70,8 +70,8 @@ class TicketOverviewsController < ApplicationController
       Group.find(group_id).users.each {|user|
         next if !agents[ user.id ]
         groups_users[ group_id ].push user.id
-        if !assets[ User.to_online_model.to_sym ][user.id]
-          assets[ User.to_online_model.to_sym ][user.id] = User.user_data_full(user.id)
+        if !assets[ User.to_app_model ][user.id]
+          assets[ User.to_app_model ][user.id] = User.user_data_full(user.id)
         end
       }
     }

+ 12 - 12
app/controllers/tickets_controller.rb

@@ -304,22 +304,22 @@ class TicketsController < ApplicationController
 
     # get related users
     assets = {}
-    assets[ User.to_online_model.to_sym ] = {}
+    assets[ User.to_app_model ] = {}
     assets = ticket.assets(assets)
 
     # get attributes to update
     attributes_to_change = Ticket::ScreenOptions.attributes_to_change( :user => current_user, :ticket => ticket )
 
     attributes_to_change[:owner_id].each { |user_id|
-      if !assets[ User.to_online_model.to_sym ][user_id]
-        assets[ User.to_online_model.to_sym ][user_id] = User.user_data_full( user_id )
+      if !assets[ User.to_app_model ][user_id]
+        assets[ User.to_app_model ][user_id] = User.user_data_full( user_id )
       end
     }
 
     attributes_to_change[:group_id__owner_id].each {|group_id, user_ids|
       user_ids.each {|user_id|
-        if !assets[ User.to_online_model.to_sym ][user_id]
-          assets[ User.to_online_model.to_sym ][user_id] = User.user_data_full( user_id )
+        if !assets[ User.to_app_model ][user_id]
+          assets[ User.to_app_model ][user_id] = User.user_data_full( user_id )
         end
       }
     }
@@ -362,17 +362,17 @@ class TicketsController < ApplicationController
     )
 
     assets = {}
-    assets[ User.to_online_model.to_sym ] = {}
+    assets[ User.to_app_model ] = {}
     attributes_to_change[:owner_id].each { |user_id|
-      if !assets[ User.to_online_model.to_sym ][user_id]
-        assets[ User.to_online_model.to_sym ][user_id] = User.user_data_full( user_id )
+      if !assets[ User.to_app_model ][user_id]
+        assets[ User.to_app_model ][user_id] = User.user_data_full( user_id )
       end
     }
 
     attributes_to_change[:group_id__owner_id].each {|group_id, user_ids|
       user_ids.each {|user_id|
-        if !assets[ User.to_online_model.to_sym ][user_id]
-          assets[ User.to_online_model.to_sym ][user_id] = User.user_data_full( user_id )
+        if !assets[ User.to_app_model ][user_id]
+          assets[ User.to_app_model ][user_id] = User.user_data_full( user_id )
         end
       }
     }
@@ -387,8 +387,8 @@ class TicketsController < ApplicationController
       owner_ids = []
       ticket.agent_of_group.each { |user|
         owner_ids.push user.id
-        if !assets[ User.to_online_model.to_sym ][user.id]
-          assets[ User.to_online_model.to_sym ][user.id] = User.user_data_full( user.id )
+        if !assets[ User.to_app_model ][user.id]
+          assets[ User.to_app_model ][user.id] = User.user_data_full( user.id )
         end
       }
 

+ 10 - 10
app/models/history/assets.rb

@@ -22,22 +22,22 @@ returns
 
   def assets (data)
 
-    if !data[ User.to_online_model.to_sym ]
-      data[ User.to_online_model.to_sym ] = {}
+    if !data[ User.to_app_model ]
+      data[ User.to_app_model ] = {}
     end
-    if !data[ User.to_online_model.to_sym ][ self['created_by_id'] ]
-      data[ User.to_online_model.to_sym ][ self['created_by_id'] ] = User.user_data_full( self['created_by_id'] )
+    if !data[ User.to_app_model ][ self['created_by_id'] ]
+      data[ User.to_app_model ][ self['created_by_id'] ] = User.user_data_full( self['created_by_id'] )
     end
 
     # fetch meta relations
-    if !data[ History::Object.to_online_model.to_sym ]
-      data[ History::Object.to_online_model.to_sym ] = History::Object.all()
+    if !data[ History::Object.to_app_model ]
+      data[ History::Object.to_app_model ] = History::Object.all()
     end
-    if !data[ History::Type.to_online_model.to_sym ]
-      data[ History::Type.to_online_model.to_sym ] = History::Type.all()
+    if !data[ History::Type.to_app_model ]
+      data[ History::Type.to_app_model ] = History::Type.all()
     end
-    if !data[ History::Attribute.to_online_model.to_sym ]
-      data[ History::Attribute.to_online_model.to_sym ] = History::Attribute.all()
+    if !data[ History::Attribute.to_app_model ]
+      data[ History::Attribute.to_app_model ] = History::Attribute.all()
     end
 
     data

+ 9 - 9
app/models/organization/assets.rb

@@ -22,19 +22,19 @@ returns
 
   def assets (data)
 
-    if !data[ Organization.to_online_model.to_sym ]
-      data[ Organization.to_online_model.to_sym ] = {}
+    if !data[ Organization.to_app_model ]
+      data[ Organization.to_app_model ] = {}
     end
-    if !data[ User.to_online_model.to_sym ]
-      data[ User.to_online_model.to_sym ] = {}
+    if !data[ User.to_app_model ]
+      data[ User.to_app_model ] = {}
     end
-    if !data[ Organization.to_online_model.to_sym ][ self.id ]
-      data[ Organization.to_online_model.to_sym ][ self.id ] = self.attributes
-      data[ Organization.to_online_model.to_sym ][ self.id ][:user_ids] = []
+    if !data[ Organization.to_app_model ][ self.id ]
+      data[ Organization.to_app_model ][ self.id ] = self.attributes
+      data[ Organization.to_app_model ][ self.id ][:user_ids] = []
       users = User.where( :organization_id => self.id ).limit(10)
       users.each {|user|
-        data[ User.to_online_model.to_sym ][ user.id ] = User.user_data_full( user.id )
-        data[ Organization.to_online_model.to_sym ][ self.id ][:user_ids].push user.id
+        data[ User.to_app_model ][ user.id ] = User.user_data_full( user.id )
+        data[ Organization.to_app_model ][ self.id ][:user_ids].push user.id
       }
     end
     data

+ 11 - 11
app/models/ticket/article/assets.rb

@@ -23,24 +23,24 @@ returns
 
   def assets (data)
 
-    if !data[ Ticket::Article.to_online_model.to_sym ]
-      data[ Ticket::Article.to_online_model.to_sym ] = {}
+    if !data[ Ticket::Article.to_app_model ]
+      data[ Ticket::Article.to_app_model ] = {}
     end
-    if !data[ Ticket::Article.to_online_model.to_sym ][ self.id ]
-      data[ Ticket::Article.to_online_model.to_sym ][ self.id ] = self.attributes
+    if !data[ Ticket::Article.to_app_model ][ self.id ]
+      data[ Ticket::Article.to_app_model ][ self.id ] = self.attributes
 
       # add attachment list to article
-      data[ Ticket::Article.to_online_model.to_sym ][ self.id ]['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => self.id )
+      data[ Ticket::Article.to_app_model ][ self.id ]['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => self.id )
     end
 
-    if !data[ User.to_online_model.to_sym ]
-      data[ User.to_online_model.to_sym ] = {}
+    if !data[ User.to_app_model ]
+      data[ User.to_app_model ] = {}
     end
-    if !data[ User.to_online_model.to_sym ][ self['created_by_id'] ]
-      data[ User.to_online_model.to_sym ][ self['created_by_id'] ] = User.user_data_full( self['created_by_id'] )
+    if !data[ User.to_app_model ][ self['created_by_id'] ]
+      data[ User.to_app_model ][ self['created_by_id'] ] = User.user_data_full( self['created_by_id'] )
     end
-    if !data[ User.to_online_model.to_sym ][ self['updated_by_id'] ]
-      data[ User.to_online_model.to_sym ][ self['updated_by_id'] ] = User.user_data_full( self['updated_by_id'] )
+    if !data[ User.to_app_model ][ self['updated_by_id'] ]
+      data[ User.to_app_model ][ self['updated_by_id'] ] = User.user_data_full( self['updated_by_id'] )
     end
     data
   end

Some files were not shown because too many files changed in this diff