Changeset 585

Show
Ignore:
Timestamp:
03/21/07 22:14:47 (2 years ago)
Author:
jarmo
Message:
  • Form categories removed
  • Form category and task type tags removed
  • Removed asset condition analysis
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/baseline/app/controllers/asset_type_controller.rb

    r540 r585  
    1717                [_('Name'), :name], 
    1818                [_('Icon'), :asset_type_icon], 
    19                 [_('Typical maintenance time interval'), :print_typical_maintenance_time_interval] 
    2019              ] 
    2120    @actions = [ 
     
    4443                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    4544                [_('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")'}], 
    4745                [_('Description'), :markup_text_area, 'description', { :cols => 100, :rows => 20 }] 
    4846              ] 
    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'}) 
    5148  end 
    5249 
     
    5653                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    5754                [_('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")'}], 
    5955                [_('Description'), :markup_text_area, 'description', { :cols => 100, :rows => 20 }] 
    6056              ] 
    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'}) 
    6358  end 
    6459 
  • branches/baseline/app/controllers/form_controller.rb

    r540 r585  
    4848    end 
    4949 
    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? 
    5151 
    5252    @title = _('Select the form type to fill out') 
    5353 
    54     form_types = params[:tag_id].nil? ? FormType.find(:all, :conditions => ['ready = ?', true], :readonly => true) : FormTag.find(params[:tag_id]).form_types 
     54    form_types = FormType.find(:all, :conditions => ['ready = ?', true], :readonly => true) 
    5555 
    5656    redirect_with_message(_('No form types defined.'), :back) and return if form_types.empty? 
    5757 
    58     @hidden_fields = [ ['cause_task_id', params[:cause_task_id].to_i] ] if params[:cause_task_id] 
    5958    @fields = [ [_('Form type'), 'form_type', 'id', form_types.collect { |type| [type.name, type.id] }] ] 
    6059    render(:partial => 'shared/select', :layout => 'mainlevel', 
     
    7574    @form.editable = true 
    7675    @form.creator = session[:user] 
    77     @cause_task_id = params[:cause_task_id] if  params[:cause_task_id] 
    7876    # Form cookies are used to match image field values in the session 
    7977    # to specific form creation / edit form. 
     
    9694      end 
    9795 
    98       @form.cause_task_id = @cause_task_id if @cause_task_id 
    9996 
    10097      if @form.validate_fields and @form.valid? 
     
    239236    end 
    240237 
    241     @form_categories = FormCategory.find(:all, :readonly => true, :order => 'name') 
    242  
    243238    find_selected_assets 
     239 
     240    @form_types = FormType.find(:all, :readonly => true, :conditions => ['ready = ?', true]) 
    244241 
    245242    # Form types were selected 
  • branches/baseline/app/controllers/form_type_controller.rb

    r540 r585  
    1818  def list 
    1919    @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'], 
    2323                [_('Form count'), :form_count], 
    2424                [_('Template'), :form_template] 
     
    4747  def create_step1 
    4848    @title = _('New form type wizard Step 1 of 4') 
    49     # Find objects 
    50     @form_categories = FormCategory.find :all, :readonly => true, :order => 'name' 
    51  
    52     # Options for selection box 
    53     @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     end 
    5949 
    6050    if request.post? 
  • branches/baseline/app/controllers/task_controller.rb

    r577 r585  
    204204    @title = _('Create new task') 
    205205    @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') 
    208207 
    209208    if @task_types.empty? 
     
    221220      @task = Task.new params[:task] 
    222221      @task.asset = @selected_asset 
    223       @task.cause_form_id = @cause_form_id if @cause_form_id 
    224222      @task.starting_time = nil unless params[:starting_time_enabled] 
    225223      @task.deadline = nil unless params[:deadline_enabled] 
  • branches/baseline/app/controllers/task_type_controller.rb

    r554 r585  
    1818    @title = _('Task types') 
    1919    @fields = [ [_('Name'), :name], 
    20                 [_('Tag'), :task_tag], 
    2120                [_('Description'), :description], 
    2221                [_('Template'), :task_template], 
    2322                [_('Task count'), :task_count] 
    2423              ] 
    25     @items = items_for_page(TaskType, :order => 'task_tag_id, name') 
     24    @items = items_for_page(TaskType, :order => 'name') 
    2625    @actions =  [ 
    2726                  [_('Edit'), {:action=> 'edit', :image=>'16x16/edit.gif'}], 
     
    3534    @fields = [ 
    3635                [_('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 } ], 
    3836                [_('Description'), :text_field, 'description', { :size => 40, :maxlength => 80 } ], 
    3937              ] 
     
    4543    @fields = [ 
    4644                [_('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 } ], 
    4845                [_('Description'), :text_field, 'description', { :size => 40, :maxlength => 80 } ] 
    4946              ] 
  • branches/baseline/app/models/action_key.rb

    r577 r585  
    1010  validates_uniqueness_of :name 
    1111  validates_length_of :name, :maximum => 80 
    12   validates_length_of :info, :maximum => 80 
     12  validates_length_of :info, :maximum => 80, :allow_nil => true 
    1313  # Callbacks 
    1414  # Associations 
    15   has_and_belongs_to_many :keyrings 
     15  has_and_belongs_to_many :keyrings, :uniq => true, :order => 'name' 
    1616 
    1717  # Function: ActionKey.model_name 
  • branches/baseline/app/models/asset.rb

    r576 r585  
    3232  acts_as_tree :order => 'code' 
    3333 
    34   include AssetConditionAnalysis 
    35  
    3634  exports_automatic_fields_from :asset_type 
    3735  exports_automatic_field 'cmms_asset_code', :string, :code 
  • branches/baseline/app/models/asset_field_value.rb

    r560 r585  
    66  attr_protected :id, :type, :asset_id 
    77  # Validation 
    8   validates_presence_of :asset_field_id  # can't validate :asset, brokes asset creation 
     8  validates_presence_of :asset_field_id 
    99  validates_uniqueness_of :asset_field_id, :scope => :asset_id 
    1010  # Callbacks 
  • branches/baseline/app/models/asset_type.rb

    r576 r585  
    66class AssetType < ActiveRecord::Base 
    77  # Protection 
    8   attr_accessible :name, :description, :asset_type_icon_id, :set_typical_maintenance_time_interval 
     8  attr_accessible :name, :description, :asset_type_icon_id 
    99  # Validation 
    1010  validates_presence_of :name, :asset_type_icon #, :typical_maintenance_time_interval 
    1111  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 
    1713  # Callbacks 
    1814  before_destroy :destroy_associated_data # This should be the last before_destroy callback! 
     
    2925    icon = AssetTypeIcon.new(:file => file_field) 
    3026    self.asset_type_icon = icon if icon.save 
    31   end 
    32  
    33   # Times in units of seconds 
    34   MINUTE = 60 
    35   HOUR = 60*MINUTE 
    36   DAY = 24*HOUR 
    37   YEAR = 365*DAY 
    38   MONTH = YEAR/12 
    39  
    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 == nil 
    44       self.typical_maintenance_time_interval = nil 
    45       return 
    46     end 
    47  
    48     time_interval = time_interval.inject({}) do |time, (unit, value)| 
    49       time[unit.to_sym] = value.to_i 
    50       time 
    51     end 
    52     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)).round 
    57   end 
    58  
    59   # Gets +typical_maintenance_time_interval+ in a Hash with 
    60   # unit keys :years, :months, :days, :hours, :minutes. 
    61   def get_typical_maintenance_time_interval 
    62     return nil if self.typical_maintenance_time_interval.nil? 
    63     left = self.typical_maintenance_time_interval 
    64     result = {} 
    65     [[:years, YEAR], [:months, MONTH], [:days, DAY], [:hours, HOUR]].each { |unit_key, unit| 
    66       result[unit_key] = left/unit 
    67       left -= result[unit_key]*unit 
    68     } 
    69     result[:minutes] = left/MINUTE 
    70     result 
    71   end 
    72  
    73   # Returns +typical_maintenance_time_interval+ in readable string 
    74   def print_typical_maintenance_time_interval 
    75     time = self.get_typical_maintenance_time_interval 
    76     return '-' unless time 
    77     result = [] 
    78     result.push sprintf(n_('%d year', '%d years', time[:years]), time[:years]) if time[:years] > 0 
    79     result.push sprintf(n_('%d month', '%d months', time[:months]), time[:months]) if time[:months] > 0 
    80     result.push sprintf(n_('%d day', '%d days', time[:days]), time[:days]) if time[:days] > 0 
    81     result.push sprintf(n_('%d hour', '%d hours', time[:hours]), time[:hours]) if time[:hours] > 0 
    82     result.push sprintf(n_('%d minute', '%d minutes', time[:minutes]), time[:minutes]) if time[:minutes] > 0 
    83     case result.length 
    84       when 0 
    85         return '-' 
    86       when 1 
    87         return result.first 
    88       else 
    89         return result[0, result.length-1].join(', ') + ' ' + _('and') + ' ' + result.last 
    90     end 
    9127  end 
    9228 
  • branches/baseline/app/models/form.rb

    r577 r585  
    1010  # Associations 
    1111  belongs_to :form_type 
    12   belongs_to :cause_task, :class_name => 'Task', :foreign_key => 'cause_task_id' # task which caused this form 
    13   has_one :effect_task, :class_name => 'Task', :foreign_key => 'cause_form_id' # task which was caused by this form 
    1412  has_many :form_field_values, :dependent => :delete_all 
    1513  has_many :form_events, :dependent => :delete_all 
     
    183181  end 
    184182 
    185   def form_category 
    186     self.form_type.form_category if self.form_type 
    187   end 
    188  
    189   def form_tag 
    190     self.form_type.form_category.form_tag if self.form_type 
    191   end 
    192  
    193183protected 
    194184 
  • branches/baseline/app/models/form_field.rb

    r581 r585  
    77  attr_protected :id, :form_type_id 
    88  # Validation 
    9   validates_presence_of :name, :user_field_name, :type_code 
     9  validates_presence_of :name, :user_field_name, :type_code, :form_type_id 
    1010  validates_uniqueness_of :user_field_name, :scope => "form_type_id" 
     11  validates_length_of :user_field_name, :maximum => 40 
    1112  validates_length_of :name, :maximum => 40 
    1213  # Callbacks 
  • branches/baseline/app/models/form_field_group.rb

    r520 r585  
    1111  # Callbacks 
    1212  # Associations 
    13   has_many :form_fields, :order => "place", :dependent => :delete_all 
     13  has_many :form_fields, :order => "place", :dependent => :nullify 
    1414  belongs_to :form_type 
    1515end 
  • branches/baseline/app/models/form_type.rb

    r581 r585  
    44class FormType < ActiveRecord::Base 
    55  # Protection 
    6   attr_protected :id, :editable, :ready 
     6  attr_protected :id 
    77  # Validation 
    88  validates_presence_of :name 
    99  validates_uniqueness_of :name 
    1010  validates_length_of :name, :maximum => 40 
     11  validates_inclusion_of :ready, :in => [true, false] 
     12  validates_inclusion_of :editable, :in => [true, false] 
    1113  # Callbacks 
    1214  before_save :create_html_template_and_images 
     
    1416  has_one :form_template, :dependent => :destroy 
    1517  has_one :form_html_template, :dependent => :destroy 
    16   has_many :form_fields, :dependent => :delete_all, :order => 'form_field_group_id, place' 
     18  has_many :form_fields, :dependent => :destroy, :order => 'form_field_group_id, place' 
    1719  has_many :form_field_groups, :dependent => :destroy, :order => 'place' 
    18   has_many :forms 
     20  has_many :forms, :order => 'created_at' 
    1921  has_many :form_template_images, :dependent => :destroy 
    20   belongs_to :form_category 
    2122 
    22   exports_automatic_fields_from :form_category 
    2323  exports_automatic_field 'cmms_form_type_name', :string, :name 
    2424 
    25  
    26   # Returns the name of the category this form type belongs to. 
    27   def category_name 
    28     return self.form_category.name 
    29   end 
    3025 
    3126  # Returns the number of forms of this form type 
  • branches/baseline/app/models/keyring.rb

    r520 r585  
    99  validates_uniqueness_of :name 
    1010  validates_length_of :name, :maximum => 40 
    11   validates_length_of :info, :maximum => 80 
     11  validates_length_of :info, :maximum => 80, :allow_nil => true 
    1212  # Callbacks 
    1313  # Associations 
  • branches/baseline/app/models/task.rb

    r577 r585  
    77class Task < ProtectedAssetData 
    88  # Protection 
    9   attr_protected :id, :asset_id, :responsible_user_id, :created_by, :created_at, :ready, :cause_form_id 
     9  attr_protected :id, :asset_id, :responsible_user_id, :created_by, :created_at, :ready 
    1010  # Validation 
    1111  validates_presence_of :short_description 
     
    1616  belongs_to :task_type 
    1717  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 task 
    19   has_one :effect_form, :class_name => 'Form', :foreign_key => 'cause_task_id' # form which was caused by this task 
    2018  has_many :task_events, :dependent => :delete_all 
    2119  has_many :data_permissions, :dependent => :delete_all, :class_name => 'TaskPermission' 
     
    6664  end 
    6765 
    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 }.first 
    76         state = wo.task_events.find(:first, :conditions => ['event_type = ?', event_type]) 
    77         if state 
    78           state.created_at - wo.created_at 
    79         else 
    80           nil 
    81         end 
    82       }.compact 
    83  
    84       if times.empty? 
    85         0 
    86       else 
    87         average = 0.0 
    88         times.each { |time| average += time } 
    89         average / times.size 
    90       end 
    91     }.collect { |time| (time / 60.0).round } 
    92   end 
    93  
    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 negative 
    101     # at the deadline. 
    102     resource_usage_changes = [] 
    103     for wo in wos 
    104       if wo.starting_time 
    105         resource_usage_changes.push([wo.starting_time, wo.estimated_working_time]) 
    106       else 
    107         resource_usage_changes.push([Time.now, wo.estimated_working_time]) 
    108       end 
    109       resource_usage_changes.push([wo.deadline, -wo.estimated_working_time]) if wo.deadline 
    110     end 
    111     resource_usage_changes.sort! { |a,b| a.first <=> b.first } 
    112  
    113     samples = [] 
    114     time = Time.now 
    115     time_offset = 0 
    116     resource_usage = 0 
    117     # Iterate trough the time span making changes to the resource usage using the array 
    118     # generated at the previous code block. Sample of the resource usage is stored 
    119     # in the samples array every time delta. 
    120     while time_offset <= time_span 
    121       while not resource_usage_changes.empty? and resource_usage_changes.first.first <= time + time_offset 
    122         resource_usage += resource_usage_changes.first.last 
    123         resource_usage_changes.delete_at(0) 
    124       end 
    125  
    126       samples.push(resource_usage) 
    127       time_offset += time_delta 
    128     end 
    129  
    130     return samples 
    131   end 
    132  
    13366  def initialize(args=nil) 
    13467    super(args) 
     
    285218  end 
    286219 
    287   def task_tag 
    288     self.task_type.task_tag if self.task_type 
    289   end 
    290  
    291220  def comments_as_string 
    292221    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  
    99  validates_uniqueness_of :name 
    1010  validates_length_of :name, :maximum => 40 
    11   validates_length_of :description, :maximum => 80 
     11  validates_length_of :description, :maximum => 80, :allow_nil => true 
    1212  validates_associated :task_template 
    1313  # Callbacks 
    1414  # Associations 
    15   belongs_to :task_tag 
    1615  has_many :tasks 
    1716  has_one :task_template, :dependent => :destroy 
  • branches/baseline/app/models/user.rb

    r577 r585  
    99  attr_protected :id 
    1010  # Validation 
    11   validates_uniqueness_of :login, :on => :create 
     11  validates_uniqueness_of :login 
    1212  validates_confirmation_of :password 
    1313  validates_length_of :login, :within => 3..40 
  • branches/baseline/app/models/user_group.rb

    r539 r585  
    99  validates_uniqueness_of :name 
    1010  validates_length_of :name, :maximum => 40 
    11   validates_length_of :info, :maximum => 80 
     11  validates_length_of :info, :maximum => 80, :allow_nil => true 
    1212  # Callbacks 
    1313  # Associations 
    1414  has_and_belongs_to_many :users, :uniq => true, :order => 'login' 
    15   has_many :assets_user_groups, :dependent => :destroy 
     15  has_many :assets_user_groups, :dependent => :delete_all 
    1616  has_many :assets, :through => :assets_user_groups 
    1717  has_many :form_permissions, :dependent => :delete_all 
  • branches/baseline/app/views/asset/view.rhtml

    r525 r585  
    11<%= 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  
    44    <td><span class="asset_type_<%= @asset_type.id %>"><%= h(@asset_type.name) %></span></td> 
    55  </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 -%> 
    126  <tr> 
    137    <th><%= _('Description:') %></th> 
  • branches/baseline/app/views/form/_creation_form.rhtml

    r511 r585  
    1414 
    1515  <%= hidden_field_tag('form_cookie', @form_cookie) %> 
    16   <%= hidden_field_tag(:cause_task_id, @cause_task_id) %> 
    1716 
    1817  <% for group in field_groups -%> 
  • branches/baseline/app/views/form/search.rhtml

    r488 r585  
    11<%= form_tag({:action => 'search'}, :id => 'search_form') %> 
    22    <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 -%> 
    54        <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> 
    79        </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 -%> 
    1610      <% end -%> 
    1711      <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  
    51<% content_for("form_style") do -%> 
    62  <%= @form_style %> 
     
    2521    <td><%= link_to(image_tag('16x16/download.png') + _('Download'), 
    2622                    {: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 -%> 
    3523  </tr> 
    3624</table> 
  • branches/baseline/app/views/form_type/change_template.rhtml

    r511 r585  
    1414  <table class="form"> 
    1515    <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> 
    2117      <td><%= h(@form_type.name) %></td> 
    2218    </tr> 
  • branches/baseline/app/views/form_type/create_step1.rhtml

    r511 r585  
    55  <table class="form"> 
    66    <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> 
    128      <td><%= text_field("form_type", "name", :size => 30, :maxlength => 40) %></td> 
    139    </tr> 
  • branches/baseline/app/views/form_type/create_step2.rhtml

    r511 r585  
    44  <table class="form"> 
    55    <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> 
    117      <td><%= h(@form_type.name) %></td> 
    128    </tr> 
  • branches/baseline/app/views/task/create.rhtml

    r511 r585  
    55<%= form_tag(:action => 'create') %> 
    66 
    7   <% if @cause_form_id -%> 
    8     <%= hidden_field_tag(:cause_form_id, @cause_form_id) %> 
    9   <% end -%> 
    107  <table class="form"> 
    118    <tr> 
  • branches/baseline/app/views/task/view.rhtml

    r578 r585  
    11<%= error_messages_for :task %> 
    2  
    3 <% if @task.cause_form -%> 
    4   <%= _('Cause form') + ': ' + link_to_form(@task.cause_form, true) %> 
    5 <% end -%> 
    62 
    73<div id="task"> 
     
    7268    <td><%= link_to(image_tag('16x16/download.png') + _('Download'), 
    7369                    {: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 and 
    78                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 -%> 
    8570  </tr> 
    8671</table> 
  • branches/baseline/config/menu.rb

    r574 r585  
    9898                  ), 
    9999                  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') 
    121113                  ), 
    122114                  MenuButton.new(_('Task types'), '22x22/menu_task.gif', 
  • branches/baseline/db/temp_models.rb

    r488 r585  
    4343    } 
    4444    type = case datatype_name 
    45            when 'Report
    46              'ReportPermissionProfile' 
    47            when 'WorkOrder