Changeset 439
- Timestamp:
- 01/18/07 04:46:45 (2 years ago)
- Files:
-
- branches/1.2-alpha/app/controllers/action_key_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/controllers/asset_controller.rb (modified) (5 diffs)
- branches/1.2-alpha/app/controllers/asset_tree_controller.rb (modified) (1 diff)
- branches/1.2-alpha/app/controllers/asset_type_controller.rb (modified) (4 diffs)
- branches/1.2-alpha/app/controllers/asset_type_icon_controller.rb (modified) (2 diffs)
- branches/1.2-alpha/app/controllers/attachment_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/controllers/keyring_controller.rb (modified) (5 diffs)
- branches/1.2-alpha/app/controllers/message_controller.rb (modified) (2 diffs)
- branches/1.2-alpha/app/controllers/overview_controller.rb (modified) (1 diff)
- branches/1.2-alpha/app/controllers/report_category_controller.rb (modified) (4 diffs)
- branches/1.2-alpha/app/controllers/report_controller.rb (modified) (6 diffs)
- branches/1.2-alpha/app/controllers/report_type_controller.rb (modified) (9 diffs)
- branches/1.2-alpha/app/controllers/timeline_controller.rb (modified) (1 diff)
- branches/1.2-alpha/app/controllers/type_attachment_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/controllers/user_controller.rb (modified) (10 diffs)
- branches/1.2-alpha/app/controllers/user_group_controller.rb (modified) (4 diffs)
- branches/1.2-alpha/app/controllers/work_order_controller.rb (modified) (9 diffs)
- branches/1.2-alpha/app/controllers/work_order_type_controller.rb (modified) (4 diffs)
- branches/1.2-alpha/app/helpers/application_helper.rb (modified) (1 diff)
- branches/1.2-alpha/app/models/asset.rb (modified) (1 diff)
- branches/1.2-alpha/app/models/message.rb (modified) (2 diffs)
- branches/1.2-alpha/app/models/report_field.rb (modified) (2 diffs)
- branches/1.2-alpha/app/models/report_html_template.rb (modified) (1 diff)
- branches/1.2-alpha/app/models/user.rb (modified) (4 diffs)
- branches/1.2-alpha/app/models/work_order.rb (modified) (3 diffs)
- branches/1.2-alpha/app/views/action_key/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/asset/online_help__change_type.rhtml (deleted)
- branches/1.2-alpha/app/views/asset/online_help__edit.rhtml (deleted)
- branches/1.2-alpha/app/views/asset/online_help__view.rhtml (deleted)
- branches/1.2-alpha/app/views/attachment/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/keyring/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/layouts/mainlevel.rhtml (modified) (5 diffs)
- branches/1.2-alpha/app/views/layouts/online_help.rhtml (deleted)
- branches/1.2-alpha/app/views/message/send_message.rhtml (copied) (copied from trunk/app/views/message/send_message.rhtml)
- branches/1.2-alpha/app/views/message/view.rhtml (modified) (1 diff)
- branches/1.2-alpha/app/views/online_help/_index.rhtml (modified) (1 diff)
- branches/1.2-alpha/app/views/overview/executive_view.rhtml (modified) (1 diff)
- branches/1.2-alpha/app/views/report/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/report_category/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/report_type/change_template.rhtml (modified) (2 diffs)
- branches/1.2-alpha/app/views/report_type/create_step4.rhtml (modified) (1 diff)
- branches/1.2-alpha/app/views/report_type/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/timeline/online_help__index.rhtml (deleted)
- branches/1.2-alpha/app/views/user/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/user/online_help__general_admin.rhtml (deleted)
- branches/1.2-alpha/app/views/user/view.rhtml (modified) (2 diffs)
- branches/1.2-alpha/app/views/user_group/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/work_order/_form.rhtml (modified) (3 diffs)
- branches/1.2-alpha/app/views/work_order/create.rhtml (modified) (1 diff)
- branches/1.2-alpha/app/views/work_order/list.rhtml (modified) (1 diff)
- branches/1.2-alpha/app/views/work_order/online_help__general.rhtml (deleted)
- branches/1.2-alpha/app/views/work_order_type/online_help__general.rhtml (deleted)
- branches/1.2-alpha/config/gettext_hack.rb (copied) (copied from trunk/config/gettext_hack.rb)
- branches/1.2-alpha/config/menu.rb (modified) (1 diff)
- branches/1.2-alpha/config/version.rb (modified) (1 diff)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha01_to_1.2.0-alpha02.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha1_to_1.2.0-alpha2.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha02_to_1.2.0-alpha03.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha2_to_1.2.0-alpha3.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha03_to_1.2.0-alpha04.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha3_to_1.2.0-alpha4.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha04_to_1.2.0-alpha05.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha4_to_1.2.0-alpha5.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha05_to_1.2.0-alpha06.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha5_to_1.2.0-alpha6.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha06_to_1.2.0-alpha07.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha6_to_1.2.0-alpha7.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha07_to_1.2.0-alpha08.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha7_to_1.2.0-alpha8.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha08_to_1.2.0-alpha09.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha8_to_1.2.0-alpha9.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha09_to_1.2.0-alpha10.rb (moved) (moved from branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha9_to_1.2.0-alpha10.rb)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha10_to_1.2.0-alpha11.rb (added)
- branches/1.2-alpha/doc/manual/latex/figure/asset_permission+edit.png (copied) (copied from trunk/doc/manual/latex/figure/asset_permission+edit.png)
- branches/1.2-alpha/doc/manual/latex/figure/asset_type_list.png (modified) (previous)
- branches/1.2-alpha/doc/manual/latex/figure/configuration_navigation_menu.png (copied) (copied from trunk/doc/manual/latex/figure/configuration_navigation_menu.png)
- branches/1.2-alpha/doc/manual/latex/figure/draft_asset_tree_1.png (copied) (copied from trunk/doc/manual/latex/figure/draft_asset_tree_1.png)
- branches/1.2-alpha/doc/manual/latex/figure/draft_asset_tree_2.png (copied) (copied from trunk/doc/manual/latex/figure/draft_asset_tree_2.png)
- branches/1.2-alpha/doc/manual/latex/figure/draft_asset_tree_3.png (copied) (copied from trunk/doc/manual/latex/figure/draft_asset_tree_3.png)
- branches/1.2-alpha/doc/manual/latex/figure/help.png (copied) (copied from trunk/doc/manual/latex/figure/help.png)
- branches/1.2-alpha/doc/manual/latex/figure/work_orders_menu_functions.png (copied) (copied from trunk/doc/manual/latex/figure/work_orders_menu_functions.png)
- branches/1.2-alpha/doc/manual/latex/manual.tex (modified) (3 diffs)
- branches/1.2-alpha/doc/manual/latex/tex/network_maintenance.tex (modified) (1 diff)
- branches/1.2-alpha/doc/manual/latex/tex/preface.tex (modified) (1 diff)
- branches/1.2-alpha/doc/manual/latex/tex/reference_manual.tex (modified) (15 diffs)
- branches/1.2-alpha/doc/manual/latex/tex/title.tex (modified) (1 diff)
- branches/1.2-alpha/doc/manual/pdf/NorfelloCMMS_OS_documentation.pdf (modified) (37 diffs)
- branches/1.2-alpha/po/fi_FI/norfello_cmms.po (modified) (46 diffs)
- branches/1.2-alpha/public/images/admin_bg_3rdlevelnav_active.png (copied) (copied from trunk/public/images/admin_bg_3rdlevelnav_active.png)
- branches/1.2-alpha/public/images/admin_bg_3rdlevelnav_active_bg.png (copied) (copied from trunk/public/images/admin_bg_3rdlevelnav_active_bg.png)
- branches/1.2-alpha/public/images/admin_bg_header.png (copied) (copied from trunk/public/images/admin_bg_header.png)
- branches/1.2-alpha/public/images/admin_bg_selected_asset.gif (copied) (copied from trunk/public/images/admin_bg_selected_asset.gif)
- branches/1.2-alpha/public/images/admin_bg_selected_asset_bg.gif (copied) (copied from trunk/public/images/admin_bg_selected_asset_bg.gif)
- branches/1.2-alpha/public/images/admin_header_logo_small.gif (copied) (copied from trunk/public/images/admin_header_logo_small.gif)
- branches/1.2-alpha/public/images/bg_3rdlevelnav.png (deleted)
- branches/1.2-alpha/public/images/bg_3rdlevelnav_hover.png (deleted)
- branches/1.2-alpha/public/images/header_logo_small.gif (modified) (previous)
- branches/1.2-alpha/public/stylesheets/base.css (modified) (3 diffs)
- branches/1.2-alpha/public/stylesheets/layout.css (modified) (9 diffs)
- branches/1.2-alpha/public/stylesheets/typography.css (modified) (2 diffs)
- branches/1.2-alpha/public/stylesheets/workorders.css (modified) (2 diffs)
- branches/1.2-alpha/script/run_tests (modified) (4 diffs)
- branches/1.2-alpha/test/fixtures/action_keys.yml (modified) (1 diff)
- branches/1.2-alpha/test/fixtures/action_keys_keyrings.yml (modified) (1 diff)
- branches/1.2-alpha/test/fixtures/keyrings.yml (modified) (2 diffs)
- branches/1.2-alpha/test/functional/message_controller_test.rb (modified) (1 diff)
- branches/1.2-alpha/test/functional/user_controller_test.rb (modified) (1 diff)
- branches/1.2-alpha/test/unit/asset_test.rb (modified) (2 diffs)
- branches/1.2-alpha/test/unit/protected_data_test.rb (modified) (3 diffs)
- branches/1.2-alpha/test/unit/report_template_test.rb (modified) (1 diff)
- branches/1.2-alpha/test/unit/user_test.rb (modified) (1 diff)
- branches/1.2-alpha/test/unit/work_order_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2-alpha/app/controllers/action_key_controller.rb
r379 r439 14 14 15 15 def list 16 @help = 'general'17 16 @title = _('Keys') 18 17 @fields = [['Name (controller/action)', :name], ['Information', :info]] … … 22 21 23 22 def create 24 @help = 'general'25 23 @title = _('Create a new key') 26 24 @fields = [ … … 32 30 33 31 def edit 34 @help = 'general'35 32 @title = _('Edit key') 36 33 @fields = [ branches/1.2-alpha/app/controllers/asset_controller.rb
r371 r439 27 27 def view 28 28 @title = _('Asset information') 29 @help = 'view'30 29 31 30 if params[:full_code] or params[:id] … … 64 63 redirect_to(:action => 'create_subasset') and return if AssetType.count == 0 65 64 66 @help = 'general'67 65 @title = _('Select asset type to create') 68 66 … … 78 76 end 79 77 80 @help = 'general'81 78 @title = _('Create a subasset for %s', @selected_asset.code_and_name) 82 79 … … 165 162 166 163 def edit 167 @help = 'edit'168 164 169 165 unless @selected_asset.authorized_to_edit? … … 218 214 219 215 def change_type 220 @help = 'change_type'221 216 @model = @selected_asset 222 217 branches/1.2-alpha/app/controllers/asset_tree_controller.rb
r339 r439 119 119 return redirect_to(:controller => 'timeline', :action => 'index') if request.env['HTTP_REFERER'] =~ /timeline$/x 120 120 121 # Stay on the asset permissions page 122 return redirect_to(:controller => 'asset_permission', :action => 'list') if request.env['HTTP_REFERER'] =~ /asset_permission\/list$/x 123 121 124 # Default is to redirect to asset view 122 125 return redirect_to(:controller => 'asset', :action=> 'view') branches/1.2-alpha/app/controllers/asset_type_controller.rb
r379 r439 13 13 14 14 def list 15 @help = 'general'16 15 @title = _('Asset types') 17 16 @fields = [ … … 29 28 30 29 def view 31 @help = 'general'32 30 @title = _('Asset type information') 33 31 @asset_type = AssetType.find(params[:id], :readonly => true) … … 42 40 end 43 41 44 @help = 'general'45 42 @title = _('Create a new asset type') 46 43 @fields = [ … … 55 52 56 53 def edit 57 @help = 'general'58 54 @title = _('Edit asset type') 59 55 @fields = [ branches/1.2-alpha/app/controllers/asset_type_icon_controller.rb
r299 r439 16 16 17 17 def list 18 @help = 'general'19 18 @title = _('Asset type icons') 20 19 @fields = [ … … 33 32 34 33 def create 35 @help = 'general'36 34 @title = _('Create a new asset type icon') 37 35 @fields = [ branches/1.2-alpha/app/controllers/attachment_controller.rb
r339 r439 19 19 # The choice is saved to session so that it is rememberd when returned to this action. 20 20 def list 21 @help = 'general'22 21 @fields = [ 23 22 [_('Asset'), :asset], … … 54 53 # View file details 55 54 def view 56 @help = 'general'57 55 begin 58 56 @file = Attachment.find_without(:data, params[:id], :include => [:data_permissions, :asset, :creator]) … … 77 75 # Uploads and attaches file to asset @selected_asset 78 76 def attach 79 @help = 'general'80 77 unless @selected_asset.authorized_to_attach_file? 81 78 redirect_with_error_message(msg_unauthorized_operation(_('attach file'), @selected_asset.code_and_name), :action => 'list') branches/1.2-alpha/app/controllers/keyring_controller.rb
r379 r439 13 13 14 14 def list 15 @help = 'general'16 15 @title = _('Keyrings') 17 16 @items = items_for_page(Keyring, :order => 'name') … … 29 28 30 29 def create 31 @help = 'general'32 30 @title = _('Create a new keyring') 33 31 @fields = [ … … 39 37 40 38 def edit 41 @help = 'general'42 39 @title = _('Edit keyring') 43 40 @fields = [ … … 57 54 58 55 def edit_keys 59 @help = 'general'60 56 @keyring = Keyring.find params[:id], :readonly => true 61 57 @items_count = @keyring.action_keys.count … … 103 99 104 100 def edit_owners 105 @help = 'general'106 101 @keyring = Keyring.find params[:id], :readonly => true 107 102 @items_count = @keyring.users.count branches/1.2-alpha/app/controllers/message_controller.rb
r371 r439 19 19 [_('Date'), :created_at], 20 20 [_('From'), :sender_name], 21 [_('Subject'), :subject ]21 [_('Subject'), :subject_text] 22 22 ] 23 23 @actions = [ [_('View'), { :controller => 'message', :action => 'view', :image => '16x16/display'} ] ] … … 44 44 end 45 45 46 def send_message 47 if params[:user_id] 48 @user = User.find(params[:user_id], :readonly => true) 49 @title = _('Send message to %s', @user.name) 50 else 51 @title = _('Send message') 52 @receiver_options = User.find(:all, :readonly => true).collect { |u| [u.login_and_name, u.id] } 53 end 54 55 if request.post? 56 @message = Message.new(params[:message]) 57 @message.sender = session[:user] 58 if @message.save 59 flash[:notice] = _('Message sent') 60 redirect_to(:controller => 'user', :action => 'view', :id => @message.receiver_user_id) 61 end 62 else 63 @message = Message.new 64 end 65 end 66 46 67 def change_state_to_old 47 68 redirect_to :back branches/1.2-alpha/app/controllers/overview_controller.rb
r299 r439 15 15 16 16 def executive_view 17 @title = _('Executive overview') 18 @help = 'general' 17 @title = _('Overview') 19 18 end 20 19 21 20 def worker_view 22 21 @title = _('Worker overview') 23 @help = 'general'24 22 end 25 23 branches/1.2-alpha/app/controllers/report_category_controller.rb
r379 r439 13 13 14 14 def list 15 @help = 'general'16 15 @title = _('Report categories') 17 16 @fields = [ [_('Name'), :name], … … 25 24 26 25 def create 27 @help = 'general'28 26 @title = _('Create a new report category') 29 27 @fields = [ … … 37 35 38 36 def edit 39 @help = 'general'40 37 @title = _('Edit report category') 41 38 @report_category = ReportCategory.find params[:id] … … 58 55 59 56 def view_as_tree 60 @help = 'general'61 57 @title = ('Report category hierarchy') 62 58 @report_categories = ReportCategory.find :all, :readonly => true, :order => 'name' branches/1.2-alpha/app/controllers/report_controller.rb
r375 r439 29 29 # The choice is saved to session so that it is rememberd when returned to this action. 30 30 def list 31 @help = 'general'32 31 33 32 if session[:select_branches] … … 53 52 54 53 @title = _('Select report type to create') 55 @help = 'general'56 54 57 55 report_types = params[:tag_id].nil? ? ReportType.find(:all, :conditions => ['ready = ?', true], :readonly => true) : ReportTag.find(params[:tag_id]).report_types … … 66 64 67 65 def create 68 @help = 'general'69 66 unless @selected_asset.authorized_to_create_report? 70 67 redirect_with_error_message(msg_unauthorized_operation(_('create report'), @selected_asset.code_and_name), :action => 'index') … … 124 121 # Edits an existing report 125 122 def edit 126 @help = 'general'127 123 @title = _('Edit report') 128 124 @report = Report.find(params[:id], :include => [:data_permissions, :report_field_values]) … … 233 229 # Displays the report listing 234 230 def search 235 @help = 'general'236 231 @items_limit = 1000000 # FIXME Fix pagination 237 232 … … 306 301 # Displays the report in html. 307 302 def view 308 @help = 'general'309 303 begin 310 304 @report = Report.find(params[:id], :include => [:data_permissions, :asset]) branches/1.2-alpha/app/controllers/report_type_controller.rb
r371 r439 17 17 # Shows a list of report types. 18 18 def list 19 @help = 'general'20 19 @title = _('Report types') 21 20 @fields = [ [_('Category'), :category_name], … … 47 46 48 47 def create_step1 49 @help = 'general'50 48 @title = _('New report type wizard Step 1 of 4') 51 49 # Find objects … … 75 73 76 74 def create_step2 77 @help = 'general'78 75 @report_type = ReportType.find(params[:id], :conditions => ['ready = ?', false]) 79 76 @report_type.report_fields.clear … … 101 98 102 99 def create_step3 103 @help = 'general'104 100 @report_type = ReportType.find(params[:id], :conditions => ['ready = ?', false]) 105 101 @title = _('New report type wizard Step 3 of 4 (%s)', @report_type.name) … … 107 103 108 104 def create_step4 109 @help = 'general'110 105 setup_create_step4 111 106 end 112 107 113 108 def create_step5 114 @help = 'general'115 109 @report_type = ReportType.find(params[:id], :conditions => ['ready = ?', false]) 116 110 … … 220 214 # Edit existing report type 221 215 def edit 222 @help = 'general'223 216 @title = _('Edit report type') 224 217 @report_type = ReportType.find(params[:id], :conditions => ['ready = ?', true]) … … 267 260 if request.post? 268 261 @new_report_template = ReportTemplate.new(params[:new_report_template]) 269 if @new_report_template.save 262 263 # Check that the new template has the necessary user fields 264 necessary_fields = @report_type.report_fields.collect { |field| field.user_field_name } 265 necessary_fields.delete_if { |name| name.match(/^cmms_/) } # Remove automatic fields 266 @missing_fields = necessary_fields - @new_report_template.get_user_field_declarations.collect { |decl| decl.attributes['text:name'] } 267 268 if @missing_fields.empty? and @new_report_template.save 270 269 @report_type.report_template.destroy if @report_type.report_template 271 270 @report_type.report_template = @new_report_template … … 274 273 flash[:notice] = _('Report template changed.') 275 274 redirect_to(:action => 'list') 275 elsif not @missing_fields.empty? 276 @new_report_template.errors.add_to_base(_('One or more user fields are missing')) 276 277 end 277 278 end … … 291 292 @new_field_group = ReportFieldGroup.new 292 293 @enum_value = EnumeratedValue.new 294 @field_types = [ 295 [_('Integer'), ReportField::INTEGER], 296 [_('String'), ReportField::STRING], 297 [_('Boolean'), ReportField::BOOLEAN], 298 [_('Float'), ReportField::FLOAT], 299 [_('Long string'), ReportField::LONG_STRING], 300 [_('Date'), ReportField::DATE], 301 [_('Time'), ReportField::TIME], 302 [_('Datetime'), ReportField::DATETIME], 303 [_('Enumeration'), ReportField::ENUM], 304 [_('Image'), ReportField::IMAGE], 305 [_('Automatic'), ReportField::AUTOMATIC] 306 ] 293 307 end 294 308 end branches/1.2-alpha/app/controllers/timeline_controller.rb
r299 r439 18 18 # Optionally also lists timeline events for all assets subassets: 19 19 def index 20 @help = 'index'21 20 22 21 if session[:select_branches] branches/1.2-alpha/app/controllers/type_attachment_controller.rb
r339 r439 16 16 17 17 def list 18 @help = 'general'19 18 @fields = [ 20 19 [_('Asset type'), :asset_type], … … 51 50 52 51 def attach 53 @help = 'general'54 52 @asset_type = AssetType.find(params[:id], :readonly => true) 55 53 unless @asset_type.authorized_to_create?(TypeAttachment) … … 78 76 79 77 def view 80 @help = 'general'81 78 begin 82 79 @file = TypeAttachment.find_without(:data, params[:id], :include => [:data_permissions, :asset_type, :creator]) branches/1.2-alpha/app/controllers/user_controller.rb
r371 r439 21 21 22 22 def list 23 @help = 'general_admin'24 23 @title = _('User accounts') 25 24 @fields = [ … … 41 40 42 41 def create 43 @help = 'general_admin'44 42 @title = _('Create new user account') 45 43 @fields = [ … … 57 55 58 56 def edit 59 @help = 'general_admin'60 57 @model = User.find params[:id] 61 58 @title = _('Edit user account: %s', @model.login) … … 93 90 if request.post? 94 91 @model.attributes = params[:model] 95 @model.password = ''# conserve password92 @model.password = nil # conserve password 96 93 if @model.save 97 94 flash[:notice] = _('User information changed') … … 142 139 143 140 def reset_password 144 @help = 'general_admin'145 141 @user = User.find params[:id] 146 142 @title = _('Reset password for user account %s', @user.login) … … 169 165 session[:user] = User.accessing(session[:user]) 170 166 167 expire_fragment(:controller => 'asset_tree', :action => 'asset_tree', :action_suffix => session[:user].login) 171 168 redirect_back_or_default :controller => 'asset', :action => "view" 172 169 else … … 195 192 # Searches users by login or names and lists users. 196 193 def search 197 @help = 'general'198 194 @title = _('Search users') 199 195 @fields = [ … … 220 216 221 217 def view 222 @help = 'general'223 218 @user = User.find params[:id] 224 219 @title = _("%s's user information", @user.login) 225 226 if request.post?227 @message = Message.new(params[:message])228 @message.receiver = @user229 @message.sender = session[:user]230 if @message.save231 flash[:notice] = _('Message sent')232 @message = Message.new233 end234 else235 @message = Message.new236 end237 220 end 238 221 239 222 def edit_my_information 240 @help = 'general'241 223 @model = User.find session[:user].id 242 224 @title = _('My information') … … 260 242 params[:model].delete_if { |key, value| !['email', 'phone', 'lang'].include? key } 261 243 @model.attributes = params[:model] 262 @model.password = ''# conserve password244 @model.password = nil # conserve password 263 245 if @model.save 264 246 session[:user] = @model … … 279 261 280 262 def change_password 281 @help = 'general'282 263 @title = _('Change password') 283 264 @user = User.find session[:user].id branches/1.2-alpha/app/controllers/user_group_controller.rb
r379 r439 17 17 # Lists all user groups 18 18 def list 19 @help = 'general'20 19 @title = _('User groups') 21 20 @items = items_for_page(UserGroup, :order => 'name') … … 36 35 # Create new user group 37 36 def create 38 @help = 'general'39 37 @title = _('Create user group') 40 38 @fields = [ … … 50 48 # Edit user group 51 49 def edit 52 @help = 'general'53 50 @title = _('Edit user group') 54 51 @fields = [ … … 76 73 # View and manage users in user group 77 74 def users 78 @help = 'general'79 75 @user_group = UserGroup.find params[:id] 80 76 @title = _('Users in user group "%s"', @user_group.name) branches/1.2-alpha/app/controllers/work_order_controller.rb
r371 r439 30 30 # The choice is saved to session so that it is rememberd when returned to this action. 31 31 def list 32 @help = 'general'33 32 @fields = [ [_('Asset'), :asset], 34 33 [_('Work order'), :self], … … 37 36 [_('Starting time'), :starting_time], 38 37 [_('Deadline'), :deadline] ] 39 @assigned_field = ['Responsible user', :responsible_user]38 @assigned_field = ['Responsible worker', :responsible_user] 40 39 @actions = [] 41 40 … … 85 84 86 85 def view 87 @help = 'general'88 86 # Find objects 89 87 begin … … 105 103 106 104 @wo_title = _('Work order %s (%s)', @work_order.to_s, @work_order.work_order_type.name) 105 define_priority_options 107 106 108 107 if request.post? … … 112 111 added_worker_ids = new_worker_ids - old_worker_ids 113 112 removed_worker_ids = old_worker_ids - new_worker_ids 113 114 # Trigger the gettext 115 # FIXME: Come up with something better 116 _('You have been removed from the list of workers in this work order') 117 _('You have been added to the list of workers in this work order') 114 118 115 119 for worker_id in removed_worker_ids … … 164 168 165 169 def edit 166 @help = 'general'167 170 # Find objects 168 171 @work_order = WorkOrder.find(params[:id], :include => [:data_permissions, :asset, :creator, :responsible_user]) … … 172 175 return 173 176 end 177 define_priority_options 174 178 @events = @work_order.work_order_events 175 179 @users = User.find :all # Data permissions will change … … 206 210 207 211 def create 208 @help = 'general'209 212 unless @selected_asset.authorized_to_create_work_order? 210 213 redirect_with_error_message(msg_unauthorized_operation(_('create work order'), @selected_asset.code_and_name), :action => 'list') 211 214 return 212 215 end 216 217 define_priority_options 213 218 214 219 @title = _('Create new work order') … … 329 334 end 330 335 end 336 337 def define_priority_options 338 @priority_options = [ 339 [_('Highest'), 6], 340 [_('Very high'), 5], 341 [_('High'), 4], 342 [_('Normal'), 3], 343 [_('Low'), 2], 344 [_('Very low'), 1], 345 [_('Lowest'), 0] 346 ] 347 @priority_to_text = { } 348 @priority_options.each { |text, priority| @priority_to_text[priority] = text } 349 @state_as_text = [_('New'), _('Assigned'), _('Accepted'), _('Closed')] 350 end 331 351 end branches/1.2-alpha/app/controllers/work_order_type_controller.rb
r379 r439 17 17 # Displays the work_order type listing 18 18 def list 19 @help = 'general'20 19 @title = _('Work order types') 21 20 @fields = [ [_('Name'), :name], … … 29 28 30 29 def create 31 @help = 'general'32 30 @title = _('New work order type') 33 31 @fields = [ … … 49 47 50 48 def edit 51 @help = 'general'52 49 @title = _('Edit work order type') 53 50 @fields = [ … … 60 57 61 58 def view_template 62 @help = 'general'63 59 @work_order_template = WorkOrderTemplate.find(:first) 64 60 if @work_order_template branches/1.2-alpha/app/helpers/application_helper.rb
r375 r439 510 510 # Markup buttons 511 511 def markup_buttons(text_area_id) 512 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '*', '*'); \" value=' Bold' title='Bold'/>" +513 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '\\'', '\\''); \" value=' Italic' title='Italic' />" +514 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '_', '_'); \" value=' Underline' title='Underline' />" +515 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '----\\n', ''); \" value=' Ruler' title='Ruler' />" +516 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '- ', ' -'); \" value=' Heading' title='Heading' />" +512 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '*', '*'); \" value='" + _('Bold') + "'/>" + 513 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '\\'', '\\''); \" value='" + _('Italic') + "' />" + 514 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '_', '_'); \" value='" + _('Underline') + "' />" + 515 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '----\\n', ''); \" value='" + _('Ruler') + "' />" + 516 "<input type=button onclick=\"insert_cmms_markup('#{text_area_id}', '- ', ' -'); \" value='" + _('Heading') + "' />" + 517 517 '<script type="text/javascript">' + 518 518 " Element.show('#{text_area_id}_buttons');" + branches/1.2-alpha/app/models/asset.rb
r371 r439 245 245 where_sql = "users.id != #{exclude_user_id} AND " + where_sql if exclude_user_id.is_a?(Integer) 246 246 247 User.find_by_sql("SELECT users.* FROM users, user_groups_users WHERE (#{where_sql})")247 User.find_by_sql("SELECT DISTINCT users.* FROM users, user_groups_users WHERE (#{where_sql})") 248 248 end 249 249