Changeset 585
- Timestamp:
- 03/21/07 22:14:47 (2 years ago)
- Files:
-
- branches/baseline/app/controllers/asset_type_controller.rb (modified) (3 diffs)
- branches/baseline/app/controllers/form_category_controller.rb (deleted)
- branches/baseline/app/controllers/form_controller.rb (modified) (4 diffs)
- branches/baseline/app/controllers/form_type_controller.rb (modified) (2 diffs)
- branches/baseline/app/controllers/task_controller.rb (modified) (2 diffs)
- branches/baseline/app/controllers/task_type_controller.rb (modified) (3 diffs)
- branches/baseline/app/helpers/form_category_helper.rb (deleted)
- branches/baseline/app/models/action_key.rb (modified) (1 diff)
- branches/baseline/app/models/asset.rb (modified) (1 diff)
- branches/baseline/app/models/asset_condition_analysis.rb (deleted)
- branches/baseline/app/models/asset_field_value.rb (modified) (1 diff)
- branches/baseline/app/models/asset_type.rb (modified) (2 diffs)
- branches/baseline/app/models/data_type_tag.rb (deleted)
- branches/baseline/app/models/form.rb (modified) (2 diffs)
- branches/baseline/app/models/form_category.rb (deleted)
- branches/baseline/app/models/form_field.rb (modified) (1 diff)
- branches/baseline/app/models/form_field_group.rb (modified) (1 diff)
- branches/baseline/app/models/form_tag.rb (deleted)
- branches/baseline/app/models/form_type.rb (modified) (2 diffs)
- branches/baseline/app/models/keyring.rb (modified) (1 diff)
- branches/baseline/app/models/task.rb (modified) (4 diffs)
- branches/baseline/app/models/task_tag.rb (deleted)
- branches/baseline/app/models/task_type.rb (modified) (1 diff)
- branches/baseline/app/models/user.rb (modified) (1 diff)
- branches/baseline/app/models/user_group.rb (modified) (1 diff)
- branches/baseline/app/views/asset/view.rhtml (modified) (1 diff)
- branches/baseline/app/views/asset_type/_create_or_edit.rhtml (deleted)
- branches/baseline/app/views/asset_type/view.rhtml (modified) (1 diff)
- branches/baseline/app/views/form/_creation_form.rhtml (modified) (1 diff)
- branches/baseline/app/views/form/_recursive_tree.rhtml (deleted)
- branches/baseline/app/views/form/search.rhtml (modified) (1 diff)
- branches/baseline/app/views/form/view.rhtml (modified) (2 diffs)
- branches/baseline/app/views/form_category (deleted)
- branches/baseline/app/views/form_type/change_template.rhtml (modified) (1 diff)
- branches/baseline/app/views/form_type/create_step1.rhtml (modified) (1 diff)
- branches/baseline/app/views/form_type/create_step2.rhtml (modified) (1 diff)
- branches/baseline/app/views/task/create.rhtml (modified) (1 diff)
- branches/baseline/app/views/task/view.rhtml (modified) (2 diffs)
- branches/baseline/config/menu.rb (modified) (1 diff)
- branches/baseline/db/migrate/001_initial.rb (deleted)
- branches/baseline/db/migrate/002_initial_data.rb (deleted)
- branches/baseline/db/migrate/021_version_one_dot_two_tables.rb (deleted)
- branches/baseline/db/migrate/022_version_one_dot_two_data.rb (deleted)
- branches/baseline/db/migrate/023_version_one_dot_two_data_type_tags.rb (deleted)
- branches/baseline/db/temp_models.rb (modified) (3 diffs)
- branches/baseline/test/fixtures/form_categories.yml (deleted)
- branches/baseline/test/fixtures/form_types.yml (modified) (8 diffs)
- branches/baseline/test/functional/asset_controller_test.rb (modified) (3 diffs)
- branches/baseline/test/functional/asset_type_controller_test.rb (modified) (3 diffs)
- branches/baseline/test/functional/attachment_controller_test.rb (modified) (1 diff)
- branches/baseline/test/functional/data_permission_controller_test.rb (modified) (1 diff)
- branches/baseline/test/functional/form_category_controller_test.rb (deleted)
- branches/baseline/test/functional/form_controller_test.rb (modified) (4 diffs)
- branches/baseline/test/functional/form_type_controller_test.rb (modified) (3 diffs)
- branches/baseline/test/functional/task_controller_test.rb (modified) (1 diff)
- branches/baseline/test/functional/task_type_controller_test.rb (modified) (2 diffs)
- branches/baseline/test/functional/timeline_controller_test.rb (modified) (1 diff)
- branches/baseline/test/test_helper.rb (modified) (2 diffs)
- branches/baseline/test/unit/asset_condition_analysis_test.rb (deleted)
- branches/baseline/test/unit/data_type_tag_test.rb (deleted)
- branches/baseline/test/unit/form_category_test.rb (deleted)
- branches/baseline/test/unit/form_field_test.rb (modified) (4 diffs)
- branches/baseline/test/unit/form_template_test.rb (modified) (2 diffs)
- branches/baseline/test/unit/form_test.rb (modified) (4 diffs)
- branches/baseline/test/unit/form_type_test.rb (modified) (3 diffs)
- branches/baseline/test/unit/timeline_event_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/baseline/app/controllers/asset_type_controller.rb
r540 r585 17 17 [_('Name'), :name], 18 18 [_('Icon'), :asset_type_icon], 19 [_('Typical maintenance time interval'), :print_typical_maintenance_time_interval]20 19 ] 21 20 @actions = [ … … 44 43 [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 45 44 [_('Icon'), :select_asset_type_icon, 'asset_type_icon_id'], 46 [_('Typical maintenance time interval'), :input_field_with_enable_check_box, :select_time_interval, 'typical_maintenance_time_interval', {}, 'typical_maintenance_time_interval_enabled', 1, {:onclick => 'update_time_interval_field("typical_maintenance_time_interval")'}],47 45 [_('Description'), :markup_text_area, 'description', { :cols => 100, :rows => 20 }] 48 46 ] 49 params[:model][:set_typical_maintenance_time_interval] = nil if request.post? and params[:typical_maintenance_time_interval_enabled] != '1' 50 common_create(AssetType, 'name', {:action => 'list'}, {:action => 'list'}, 'asset_type/create_or_edit') 47 common_create(AssetType, 'name', {:action => 'list'}, {:action => 'list'}) 51 48 end 52 49 … … 56 53 [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 57 54 [_('Icon'), :select_asset_type_icon, 'asset_type_icon_id'], 58 [_('Typical maintenance time interval'), :input_field_with_enable_check_box, :select_time_interval, 'typical_maintenance_time_interval', {}, 'typical_maintenance_time_interval_enabled', 1, {:onclick => 'update_time_interval_field("typical_maintenance_time_interval")'}],59 55 [_('Description'), :markup_text_area, 'description', { :cols => 100, :rows => 20 }] 60 56 ] 61 params[:model][:set_typical_maintenance_time_interval] = nil if request.post? and params[:typical_maintenance_time_interval_enabled] != '1' 62 common_edit(AssetType, 'name', {:action => 'list'}, {:action => 'list'}, 'asset_type/create_or_edit') 57 common_edit(AssetType, 'name', {:action => 'list'}, {:action => 'list'}) 63 58 end 64 59 branches/baseline/app/controllers/form_controller.rb
r540 r585 48 48 end 49 49 50 redirect_to(:action => 'create', :id => params[:form_type][:id] , :cause_task_id => params[:cause_task_id]) and return if request.post?50 redirect_to(:action => 'create', :id => params[:form_type][:id]) and return if request.post? 51 51 52 52 @title = _('Select the form type to fill out') 53 53 54 form_types = params[:tag_id].nil? ? FormType.find(:all, :conditions => ['ready = ?', true], :readonly => true) : FormTag.find(params[:tag_id]).form_types54 form_types = FormType.find(:all, :conditions => ['ready = ?', true], :readonly => true) 55 55 56 56 redirect_with_message(_('No form types defined.'), :back) and return if form_types.empty? 57 57 58 @hidden_fields = [ ['cause_task_id', params[:cause_task_id].to_i] ] if params[:cause_task_id]59 58 @fields = [ [_('Form type'), 'form_type', 'id', form_types.collect { |type| [type.name, type.id] }] ] 60 59 render(:partial => 'shared/select', :layout => 'mainlevel', … … 75 74 @form.editable = true 76 75 @form.creator = session[:user] 77 @cause_task_id = params[:cause_task_id] if params[:cause_task_id]78 76 # Form cookies are used to match image field values in the session 79 77 # to specific form creation / edit form. … … 96 94 end 97 95 98 @form.cause_task_id = @cause_task_id if @cause_task_id99 96 100 97 if @form.validate_fields and @form.valid? … … 239 236 end 240 237 241 @form_categories = FormCategory.find(:all, :readonly => true, :order => 'name')242 243 238 find_selected_assets 239 240 @form_types = FormType.find(:all, :readonly => true, :conditions => ['ready = ?', true]) 244 241 245 242 # Form types were selected branches/baseline/app/controllers/form_type_controller.rb
r540 r585 18 18 def list 19 19 @title = _('Form types') 20 @fields = [ [_('Category'), :category_name],21 [_('Name'), :name ],22 [_('Editable forms'), :editable ],20 @fields = [ 21 [_('Name'), :name, 'name'], 22 [_('Editable forms'), :editable, 'editable'], 23 23 [_('Form count'), :form_count], 24 24 [_('Template'), :form_template] … … 47 47 def create_step1 48 48 @title = _('New form type wizard Step 1 of 4') 49 # Find objects50 @form_categories = FormCategory.find :all, :readonly => true, :order => 'name'51 52 # Options for selection box53 @options = @form_categories.collect { |c| [c.name, c.id] }54 55 if @options.empty?56 flash[:error] = _('No form categories')57 redirect_to :action => 'list'58 end59 49 60 50 if request.post? branches/baseline/app/controllers/task_controller.rb
r577 r585 204 204 @title = _('Create new task') 205 205 @hide_subaction_links = true 206 @cause_form_id = params[:cause_form_id] if params[:cause_form_id] 207 @task_types = params[:tag_id].nil? ? TaskType.find(:all, :order => 'name') : TaskTag.find(params[:tag_id]).task_types 206 @task_types = TaskType.find(:all, :order => 'name') 208 207 209 208 if @task_types.empty? … … 221 220 @task = Task.new params[:task] 222 221 @task.asset = @selected_asset 223 @task.cause_form_id = @cause_form_id if @cause_form_id224 222 @task.starting_time = nil unless params[:starting_time_enabled] 225 223 @task.deadline = nil unless params[:deadline_enabled] branches/baseline/app/controllers/task_type_controller.rb
r554 r585 18 18 @title = _('Task types') 19 19 @fields = [ [_('Name'), :name], 20 [_('Tag'), :task_tag],21 20 [_('Description'), :description], 22 21 [_('Template'), :task_template], 23 22 [_('Task count'), :task_count] 24 23 ] 25 @items = items_for_page(TaskType, :order => ' task_tag_id,name')24 @items = items_for_page(TaskType, :order => 'name') 26 25 @actions = [ 27 26 [_('Edit'), {:action=> 'edit', :image=>'16x16/edit.gif'}], … … 35 34 @fields = [ 36 35 [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 37 [_('Tag'), :select, 'task_tag_id', TaskTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ],38 36 [_('Description'), :text_field, 'description', { :size => 40, :maxlength => 80 } ], 39 37 ] … … 45 43 @fields = [ 46 44 [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 47 [_('Tag'), :select, 'task_tag_id', TaskTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ],48 45 [_('Description'), :text_field, 'description', { :size => 40, :maxlength => 80 } ] 49 46 ] branches/baseline/app/models/action_key.rb
r577 r585 10 10 validates_uniqueness_of :name 11 11 validates_length_of :name, :maximum => 80 12 validates_length_of :info, :maximum => 80 12 validates_length_of :info, :maximum => 80, :allow_nil => true 13 13 # Callbacks 14 14 # Associations 15 has_and_belongs_to_many :keyrings 15 has_and_belongs_to_many :keyrings, :uniq => true, :order => 'name' 16 16 17 17 # Function: ActionKey.model_name branches/baseline/app/models/asset.rb
r576 r585 32 32 acts_as_tree :order => 'code' 33 33 34 include AssetConditionAnalysis35 36 34 exports_automatic_fields_from :asset_type 37 35 exports_automatic_field 'cmms_asset_code', :string, :code branches/baseline/app/models/asset_field_value.rb
r560 r585 6 6 attr_protected :id, :type, :asset_id 7 7 # Validation 8 validates_presence_of :asset_field_id # can't validate :asset, brokes asset creation8 validates_presence_of :asset_field_id 9 9 validates_uniqueness_of :asset_field_id, :scope => :asset_id 10 10 # Callbacks branches/baseline/app/models/asset_type.rb
r576 r585 6 6 class AssetType < ActiveRecord::Base 7 7 # Protection 8 attr_accessible :name, :description, :asset_type_icon_id , :set_typical_maintenance_time_interval8 attr_accessible :name, :description, :asset_type_icon_id 9 9 # Validation 10 10 validates_presence_of :name, :asset_type_icon #, :typical_maintenance_time_interval 11 11 validates_uniqueness_of :name 12 validates_size_of :name, :maximum => 40 13 validates_numericality_of :typical_maintenance_time_interval, :allow_nil => true, :only_integer => true 14 validates_each :typical_maintenance_time_interval, :allow_nil => true do |model, attr, value| 15 model.errors.add(attr, GetText._('must be positive')) if value < 1 16 end 12 validates_length_of :name, :maximum => 40 17 13 # Callbacks 18 14 before_destroy :destroy_associated_data # This should be the last before_destroy callback! … … 29 25 icon = AssetTypeIcon.new(:file => file_field) 30 26 self.asset_type_icon = icon if icon.save 31 end32 33 # Times in units of seconds34 MINUTE = 6035 HOUR = 60*MINUTE36 DAY = 24*HOUR37 YEAR = 365*DAY38 MONTH = YEAR/1239 40 # Setter for +typical_maintenance_time_interval+.41 # +time_interval+:: Hash with unit keys :years, :months, :days, :hours, :minutes.42 def set_typical_maintenance_time_interval=(time_interval)43 if time_interval == nil44 self.typical_maintenance_time_interval = nil45 return46 end47 48 time_interval = time_interval.inject({}) do |time, (unit, value)|49 time[unit.to_sym] = value.to_i50 time51 end52 self.typical_maintenance_time_interval = (YEAR*(time_interval[:years] || 0) +53 MONTH*(time_interval[:months] || 0) +54 DAY*(time_interval[:days] || 0) +55 HOUR*(time_interval[:hours] || 0) +56 MINUTE*(time_interval[:minutes] || 0)).round57 end58 59 # Gets +typical_maintenance_time_interval+ in a Hash with60 # unit keys :years, :months, :days, :hours, :minutes.61 def get_typical_maintenance_time_interval62 return nil if self.typical_maintenance_time_interval.nil?63 left = self.typical_maintenance_time_interval64 result = {}65 [[:years, YEAR], [:months, MONTH], [:days, DAY], [:hours, HOUR]].each { |unit_key, unit|66 result[unit_key] = left/unit67 left -= result[unit_key]*unit68 }69 result[:minutes] = left/MINUTE70 result71 end72 73 # Returns +typical_maintenance_time_interval+ in readable string74 def print_typical_maintenance_time_interval75 time = self.get_typical_maintenance_time_interval76 return '-' unless time77 result = []78 result.push sprintf(n_('%d year', '%d years', time[:years]), time[:years]) if time[:years] > 079 result.push sprintf(n_('%d month', '%d months', time[:months]), time[:months]) if time[:months] > 080 result.push sprintf(n_('%d day', '%d days', time[:days]), time[:days]) if time[:days] > 081 result.push sprintf(n_('%d hour', '%d hours', time[:hours]), time[:hours]) if time[:hours] > 082 result.push sprintf(n_('%d minute', '%d minutes', time[:minutes]), time[:minutes]) if time[:minutes] > 083 case result.length84 when 085 return '-'86 when 187 return result.first88 else89 return result[0, result.length-1].join(', ') + ' ' + _('and') + ' ' + result.last90 end91 27 end 92 28 branches/baseline/app/models/form.rb
r577 r585 10 10 # Associations 11 11 belongs_to :form_type 12 belongs_to :cause_task, :class_name => 'Task', :foreign_key => 'cause_task_id' # task which caused this form13 has_one :effect_task, :class_name => 'Task', :foreign_key => 'cause_form_id' # task which was caused by this form14 12 has_many :form_field_values, :dependent => :delete_all 15 13 has_many :form_events, :dependent => :delete_all … … 183 181 end 184 182 185 def form_category186 self.form_type.form_category if self.form_type187 end188 189 def form_tag190 self.form_type.form_category.form_tag if self.form_type191 end192 193 183 protected 194 184 branches/baseline/app/models/form_field.rb
r581 r585 7 7 attr_protected :id, :form_type_id 8 8 # Validation 9 validates_presence_of :name, :user_field_name, :type_code 9 validates_presence_of :name, :user_field_name, :type_code, :form_type_id 10 10 validates_uniqueness_of :user_field_name, :scope => "form_type_id" 11 validates_length_of :user_field_name, :maximum => 40 11 12 validates_length_of :name, :maximum => 40 12 13 # Callbacks branches/baseline/app/models/form_field_group.rb
r520 r585 11 11 # Callbacks 12 12 # Associations 13 has_many :form_fields, :order => "place", :dependent => : delete_all13 has_many :form_fields, :order => "place", :dependent => :nullify 14 14 belongs_to :form_type 15 15 end branches/baseline/app/models/form_type.rb
r581 r585 4 4 class FormType < ActiveRecord::Base 5 5 # Protection 6 attr_protected :id , :editable, :ready6 attr_protected :id 7 7 # Validation 8 8 validates_presence_of :name 9 9 validates_uniqueness_of :name 10 10 validates_length_of :name, :maximum => 40 11 validates_inclusion_of :ready, :in => [true, false] 12 validates_inclusion_of :editable, :in => [true, false] 11 13 # Callbacks 12 14 before_save :create_html_template_and_images … … 14 16 has_one :form_template, :dependent => :destroy 15 17 has_one :form_html_template, :dependent => :destroy 16 has_many :form_fields, :dependent => :de lete_all, :order => 'form_field_group_id, place'18 has_many :form_fields, :dependent => :destroy, :order => 'form_field_group_id, place' 17 19 has_many :form_field_groups, :dependent => :destroy, :order => 'place' 18 has_many :forms 20 has_many :forms, :order => 'created_at' 19 21 has_many :form_template_images, :dependent => :destroy 20 belongs_to :form_category21 22 22 exports_automatic_fields_from :form_category23 23 exports_automatic_field 'cmms_form_type_name', :string, :name 24 24 25 26 # Returns the name of the category this form type belongs to.27 def category_name28 return self.form_category.name29 end30 25 31 26 # Returns the number of forms of this form type branches/baseline/app/models/keyring.rb
r520 r585 9 9 validates_uniqueness_of :name 10 10 validates_length_of :name, :maximum => 40 11 validates_length_of :info, :maximum => 80 11 validates_length_of :info, :maximum => 80, :allow_nil => true 12 12 # Callbacks 13 13 # Associations branches/baseline/app/models/task.rb
r577 r585 7 7 class Task < ProtectedAssetData 8 8 # Protection 9 attr_protected :id, :asset_id, :responsible_user_id, :created_by, :created_at, :ready , :cause_form_id9 attr_protected :id, :asset_id, :responsible_user_id, :created_by, :created_at, :ready 10 10 # Validation 11 11 validates_presence_of :short_description … … 16 16 belongs_to :task_type 17 17 belongs_to :responsible_user, :class_name => 'User', :foreign_key => 'responsible_user_id' 18 belongs_to :cause_form, :class_name => 'Form', :foreign_key => 'cause_form_id' # form which caused this task19 has_one :effect_form, :class_name => 'Form', :foreign_key => 'cause_task_id' # form which was caused by this task20 18 has_many :task_events, :dependent => :delete_all 21 19 has_many :data_permissions, :dependent => :delete_all, :class_name => 'TaskPermission' … … 66 64 end 67 65 68 # Calculates the average times from the open state to the assigned, accepted and closed states.69 # FIXME: Doesn't calculate times from reopen to assigned, accepted and closed states.70 def Task.average_times_from_open_state(conditions)71 return [TaskEvent.TYPES[:ASSIGNED], TaskEvent.TYPES[:ACCEPTED], TaskEvent.TYPES[:CLOSED] ].collect { |event_type|72 wos = Task.find_authorized_to_read(:all, conditions)73 74 times = wos.collect { |wo|75 puts wo.task_events.find(:all).select {|e| e.event_type == event_type }.first76 state = wo.task_events.find(:first, :conditions => ['event_type = ?', event_type])77 if state78 state.created_at - wo.created_at79 else80 nil81 end82 }.compact83 84 if times.empty?85 086 else87 average = 0.088 times.each { |time| average += time }89 average / times.size90 end91 }.collect { |time| (time / 60.0).round }92 end93 94 def Task.calculate_resource_usage(conditions, time_span, time_delta)95 conditions[0] = conditions[0] + " AND state in (?) AND (starting_time IS NOT NULL OR deadline IS NOT NULL) AND estimated_working_time != 0.0 "96 conditions.push([Task.NEW, Task.ASSIGNED, Task.ACCEPTED])97 wos = Task.find_authorized_to_read(:all, :conditions => conditions)98 99 # Generate a list of resource usage changes. Each entry is a [time, change] pair.100 # The change will be positive at the starting time of the task and negative101 # at the deadline.102 resource_usage_changes = []103 for wo in wos104 if wo.starting_time105 resource_usage_changes.push([wo.starting_time, wo.estimated_working_time])106 else107 resource_usage_changes.push([Time.now, wo.estimated_working_time])108 end109 resource_usage_changes.push([wo.deadline, -wo.estimated_working_time]) if wo.deadline110 end111 resource_usage_changes.sort! { |a,b| a.first <=> b.first }112 113 samples = []114 time = Time.now115 time_offset = 0116 resource_usage = 0117 # Iterate trough the time span making changes to the resource usage using the array118 # generated at the previous code block. Sample of the resource usage is stored119 # in the samples array every time delta.120 while time_offset <= time_span121 while not resource_usage_changes.empty? and resource_usage_changes.first.first <= time + time_offset122 resource_usage += resource_usage_changes.first.last123 resource_usage_changes.delete_at(0)124 end125 126 samples.push(resource_usage)127 time_offset += time_delta128 end129 130 return samples131 end132 133 66 def initialize(args=nil) 134 67 super(args) … … 285 218 end 286 219 287 def task_tag288 self.task_type.task_tag if self.task_type289 end290 291 220 def comments_as_string 292 221 comments = self.task_events.find(:all, :readonly => true).collect { |event| [event.created_at, event.creator, event.comment_text] } branches/baseline/app/models/task_type.rb
r577 r585 9 9 validates_uniqueness_of :name 10 10 validates_length_of :name, :maximum => 40 11 validates_length_of :description, :maximum => 80 11 validates_length_of :description, :maximum => 80, :allow_nil => true 12 12 validates_associated :task_template 13 13 # Callbacks 14 14 # Associations 15 belongs_to :task_tag16 15 has_many :tasks 17 16 has_one :task_template, :dependent => :destroy branches/baseline/app/models/user.rb
r577 r585 9 9 attr_protected :id 10 10 # Validation 11 validates_uniqueness_of :login , :on => :create11 validates_uniqueness_of :login 12 12 validates_confirmation_of :password 13 13 validates_length_of :login, :within => 3..40 branches/baseline/app/models/user_group.rb
r539 r585 9 9 validates_uniqueness_of :name 10 10 validates_length_of :name, :maximum => 40 11 validates_length_of :info, :maximum => 80 11 validates_length_of :info, :maximum => 80, :allow_nil => true 12 12 # Callbacks 13 13 # Associations 14 14 has_and_belongs_to_many :users, :uniq => true, :order => 'login' 15 has_many :assets_user_groups, :dependent => :de stroy15 has_many :assets_user_groups, :dependent => :delete_all 16 16 has_many :assets, :through => :assets_user_groups 17 17 has_many :form_permissions, :dependent => :delete_all branches/baseline/app/views/asset/view.rhtml
r525 r585 1 1 <%= render(:partial => 'view_table') %> 2 <br/>3 <% if @asset.asset_type and @asset.asset_type.typical_maintenance_time_interval -%>4 <% analysis_results = maintenance_need(@asset) -%>5 <% else -%>6 <% analysis_results = '' -%>7 <% end -%>8 <% analysis_results += condition_analysis_results(@asset) -%>9 <% unless analysis_results.empty? -%>10 <h3><%= _('Condition monitor') %></h3>11 <div id="asset_condition">12 <%= analysis_results %>13 </div>14 <% end -%>branches/baseline/app/views/asset_type/view.rhtml
r516 r585 4 4 <td><span class="asset_type_<%= @asset_type.id %>"><%= h(@asset_type.name) %></span></td> 5 5 </tr> 6 <% if @asset_type.typical_maintenance_time_interval -%>7 <tr>8 <th><%= _('Typical maintenance time interval') %></th>9 <td><%= @asset_type.print_typical_maintenance_time_interval %></td>10 </tr>11 <% end -%>12 6 <tr> 13 7 <th><%= _('Description:') %></th> branches/baseline/app/views/form/_creation_form.rhtml
r511 r585 14 14 15 15 <%= hidden_field_tag('form_cookie', @form_cookie) %> 16 <%= hidden_field_tag(:cause_task_id, @cause_task_id) %>17 16 18 17 <% for group in field_groups -%> branches/baseline/app/views/form/search.rhtml
r488 r585 1 1 <%= form_tag({:action => 'search'}, :id => 'search_form') %> 2 2 <table class="form"> 3 <% for form_category in @form_categories -%> 4 <% next if form_category.form_types.empty? %> 3 <% for form_type in @form_types -%> 5 4 <tr> 6 <th rowspan="<%= form_category.form_types.count + 1 %>"><%= h(form_category.name) %></th> 5 <th><%= h(form_type.name) %></th> 6 <td> 7 <%= check_box_tag("form_types[]", form_type.id, @selected_types.include?(form_type))%> 8 </td> 7 9 </tr> 8 <% for form_type in form_category.form_types -%>9 <tr>10 <td>11 <%= check_box_tag("form_types[]", form_type.id, @selected_types.include?(form_type))%>12 <%= h(form_type.name) %>13 </td>14 </tr>15 <% end -%>16 10 <% end -%> 17 11 <tr> branches/baseline/app/views/form/view.rhtml
r550 r585 1 <% if @form.cause_task -%>2 <%= _('Cause task') + ': ' + link_to_task(@form.cause_task, true) %>3 <% end -%>4 5 1 <% content_for("form_style") do -%> 6 2 <%= @form_style %> … … 25 21 <td><%= link_to(image_tag('16x16/download.png') + _('Download'), 26 22 {:action => 'download', :id => @form.id}) %></td> 27 <% if @form.effect_task.is_a?(Task) -%>28 <td><%= _('Effect task') + ': ' + link_to_task(@form.effect_task, true) %></td>29 <% elsif form_tag = @form.form_tag and effect_task_tag = form_tag.effect_task_tag -%>30 <td><%= link_to(image_tag('16x16/task.png') + _('Create task'),31 {:controller => 'task', :action => 'create',32 :cause_form_id => @form.id,33 :tag_id => effect_task_tag.id }) %></td>34 <% end -%>35 23 </tr> 36 24 </table> branches/baseline/app/views/form_type/change_template.rhtml
r511 r585 14 14 <table class="form"> 15 15 <tr> 16 <th><%= _('Form category') %></th> 17 <td><%= h(@form_type.form_category.name) %></td> 18 </tr> 19 <tr> 20 <th><%= _('Type name') %></th> 16 <th><%= _('Name') %></th> 21 17 <td><%= h(@form_type.name) %></td> 22 18 </tr> branches/baseline/app/views/form_type/create_step1.rhtml
r511 r585 5 5 <table class="form"> 6 6 <tr> 7 <th><%= _('Form category') %></th> 8 <td><%= select("form_type", "form_category_id", @options) %></td> 9 </tr> 10 <tr> 11 <th><%= _('Type name') %></th> 7 <th><%= _('Name') %></th> 12 8 <td><%= text_field("form_type", "name", :size => 30, :maxlength => 40) %></td> 13 9 </tr> branches/baseline/app/views/form_type/create_step2.rhtml
r511 r585 4 4 <table class="form"> 5 5 <tr> 6 <th><%= _('Form category') %></th> 7 <td><%= h(@form_type.form_category.name) %></td> 8 </tr> 9 <tr> 10 <th><%= _('Type name') %></th> 6 <th><%= _('Name') %></th> 11 7 <td><%= h(@form_type.name) %></td> 12 8 </tr> branches/baseline/app/views/task/create.rhtml
r511 r585 5 5 <%= form_tag(:action => 'create') %> 6 6 7 <% if @cause_form_id -%>8 <%= hidden_field_tag(:cause_form_id, @cause_form_id) %>9 <% end -%>10 7 <table class="form"> 11 8 <tr> branches/baseline/app/views/task/view.rhtml
r578 r585 1 1 <%= error_messages_for :task %> 2 3 <% if @task.cause_form -%>4 <%= _('Cause form') + ': ' + link_to_form(@task.cause_form, true) %>5 <% end -%>6 2 7 3 <div id="task"> … … 72 68 <td><%= link_to(image_tag('16x16/download.png') + _('Download'), 73 69 {:action => 'download', :id => @task.id}) %></td> 74 <% if @task.is_closed? -%>75 <% if @task.effect_form.is_a?(Form) -%>76 <td><%= _('Effect form') + ': ' + link_to_form(@task.effect_form, true) %></td>77 <% elsif task_tag = @task.task_tag and78 effect_form_tag = task_tag.effect_form_tag -%>79 <td><%= link_to(image_tag('16x16/form.png') + _('Create form'),80 {:controller => 'form', :action => 'select_form_type',81 :cause_task_id => @task.id,82 :tag_id => effect_form_tag.id }) %></td>83 <% end -%>84 <% end -%>85 70 </tr> 86 71 </table> branches/baseline/config/menu.rb
r574 r585 98 98 ), 99 99 MenuButton.new(_('Form types'), '22x22/menu_form_type.gif', 100 MenuButton.new(_('Form types'), '22x22/menu_form_type.gif', 101 MenuItem.new(_('List'), 'form_type', 'list', '16x16/list.gif'), 102 MenuItem.new(_('Create'), 'form_type', 'create_step1', '16x16/create.gif'), 103 Page.new('form_type', 'create_step2'), 104 Page.new('form_type', 'create_step3'), 105 Page.new('form_type', 'create_step4'), 106 Page.new('form_type', 'update_form_fields'), 107 Page.new('form_type', 'update_form_field_groups'), 108 Page.new('form_type', 'add_form_field_group'), 109 Page.new('form_type', 'add_enumerated_value'), 110 Page.new('form_type', 'remove_enumerated_value'), 111 Page.new('form_type', 'preview'), 112 Page.new('form_type', 'edit'), 113 Page.new('form_type', 'change_template') 114 ), 115 MenuButton.new(_('Form categories'), '22x22/menu_form_category.gif', 116 MenuItem.new(_('List'), 'form_category', 'list', '16x16/list.gif'), 117 MenuItem.new(_('Tree'), 'form_category', 'view_as_tree', '16x16/view_tree.gif'), 118 MenuItem.new(_('Create'), 'form_category', 'create', '16x16/create.gif'), 119 Page.new('form_category', 'edit') 120 ) 100 MenuItem.new(_('List'), 'form_type', 'list', '16x16/list.gif'), 101 MenuItem.new(_('Create'), 'form_type', 'create_step1', '16x16/create.gif'), 102 Page.new('form_type', 'create_step2'), 103 Page.new('form_type', 'create_step3'), 104 Page.new('form_type', 'create_step4'), 105 Page.new('form_type', 'update_form_fields'), 106 Page.new('form_type', 'update_form_field_groups'), 107 Page.new('form_type', 'add_form_field_group'), 108 Page.new('form_type', 'add_enumerated_value'), 109 Page.new('form_type', 'remove_enumerated_value'), 110 Page.new('form_type', 'preview'), 111 Page.new('form_type', 'edit'), 112 Page.new('form_type', 'change_template') 121 113 ), 122 114 MenuButton.new(_('Task types'), '22x22/menu_task.gif', branches/baseline/db/temp_models.rb
r488 r585 43 43 } 44 44 type = case datatype_name 45 when ' Report'46 ' ReportPermissionProfile'47 when ' WorkOrder'