From d8390053f3aa3a4d1bcf9e043075e7e3fc7bda35 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Fri, 28 Feb 2014 12:31:18 +0100 Subject: [PATCH] #183 Link to & Link from added --- app/controllers/dmsf_links_controller.rb | 91 ++++--- app/models/dmsf_file_revision.rb | 6 +- app/models/dmsf_link.rb | 10 +- app/models/dmsf_mailer.rb | 6 +- app/views/dmsf/_dir.html.erb | 20 +- app/views/dmsf/_file.html.erb | 14 +- app/views/dmsf/edit.html.erb | 6 +- app/views/dmsf/show.html.erb | 38 ++- app/views/dmsf_files/show.html.erb | 24 +- app/views/dmsf_links/_form.html.erb | 69 +++-- app/views/dmsf_mailer/files_deleted.html.erb | 2 +- app/views/dmsf_mailer/files_deleted.text.erb | 2 +- app/views/dmsf_mailer/files_updated.html.erb | 2 +- app/views/dmsf_mailer/files_updated.text.erb | 2 +- .../my/blocks/_locked_documents.html.erb | 2 +- app/views/my/blocks/_open_approvals.html.erb | 2 +- assets/images/filetypes/docx_gray.png | Bin 401 -> 0 bytes assets/images/filetypes/pptx_gray.png | Bin 419 -> 0 bytes assets/images/filetypes/vsdx_gray.png | Bin 389 -> 0 bytes assets/images/filetypes/xlsx_gray.png | Bin 405 -> 0 bytes assets/stylesheets/dmsf.css | 19 +- config/locales/cs.yml | 19 +- config/locales/de.yml | 30 ++- config/locales/en.yml | 21 +- config/locales/es.yml | 21 +- config/locales/fr.yml | 17 +- config/locales/ja.yml | 20 +- config/locales/ru.yml | 20 +- config/locales/sl.yml | 22 +- config/locales/zh.yml | 21 +- test/fixtures/dmsf_files.yml | 8 + test/functional/dmsf_links_controller_test.rb | 235 ++++++++++++++++-- 32 files changed, 557 insertions(+), 192 deletions(-) delete mode 100644 assets/images/filetypes/docx_gray.png delete mode 100644 assets/images/filetypes/pptx_gray.png delete mode 100644 assets/images/filetypes/vsdx_gray.png delete mode 100644 assets/images/filetypes/xlsx_gray.png diff --git a/app/controllers/dmsf_links_controller.rb b/app/controllers/dmsf_links_controller.rb index 016a9e09..9116bd01 100644 --- a/app/controllers/dmsf_links_controller.rb +++ b/app/controllers/dmsf_links_controller.rb @@ -1,6 +1,6 @@ # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2014 Karel Pičman +# Copyright (C) 2011-14 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -25,44 +25,75 @@ class DmsfLinksController < ApplicationController before_filter :authorize def new - @dmsf_link = DmsfLink.new - @dmsf_link.project_id = @project.id - @dmsf_link.target_type = DmsfFolder.model_name - @dmsf_link.dmsf_folder_id = params[:dmsf_folder_id] + @dmsf_link = DmsfLink.new(:project_id => params[:project_id]) - if params[:dmsf_link].present? - @dmsf_link.target_project_id = params[:dmsf_link][:target_project_id] - @target_folder_id = DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil + if params[:dmsf_link].present? + # Reload + @dmsf_link.dmsf_folder_id = params[:dmsf_link][:dmsf_folder_id] + @dmsf_file_id = params[:dmsf_link][:dmsf_file_id] + @type = params[:dmsf_link][:type] + @dmsf_link.target_project_id = params[:dmsf_link][:target_project_id] + @target_folder_id = params[:dmsf_link][:target_folder_id].to_i if params[:reload].blank? && DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) else - @dmsf_link.target_project_id = @project.id - @target_folder_id = @dmsf_link.dmsf_folder_id - end + # Link from/to + @dmsf_link.dmsf_folder_id = params[:dmsf_folder_id] + @dmsf_file_id = params[:dmsf_file_id] + @type = params[:type] + @dmsf_link.target_project_id = params[:project_id] + @target_folder_id = params[:dmsf_folder_id].to_i if params[:dmsf_folder_id].present? + end render :layout => !request.xhr? end def create @dmsf_link = DmsfLink.new - @dmsf_link.project_id = @project.id - @dmsf_link.target_project_id = params[:dmsf_link][:target_project_id] - @dmsf_link.dmsf_folder_id = params[:dmsf_link][:dmsf_folder_id] - if params[:dmsf_link][:target_file_id].present? - @dmsf_link.target_id = params[:dmsf_link][:target_file_id] - @dmsf_link.target_type = DmsfFile.model_name + if params[:dmsf_link][:type] == 'link_from' + # Link from + @dmsf_link.project_id = params[:dmsf_link][:project_id] + @dmsf_link.dmsf_folder_id = params[:dmsf_link][:dmsf_folder_id] + @dmsf_link.target_project_id = params[:dmsf_link][:target_project_id] + if params[:dmsf_link][:target_file_id].present? + @dmsf_link.target_id = params[:dmsf_link][:target_file_id] + @dmsf_link.target_type = DmsfFile.model_name + else + @dmsf_link.target_id = DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil + @dmsf_link.target_type = DmsfFolder.model_name + end + @dmsf_link.name = params[:dmsf_link][:name] + + if @dmsf_link.save + flash[:notice] = l(:notice_successful_create) + redirect_to dmsf_folder_path(:id => @project.id, :folder_id => @dmsf_link.dmsf_folder_id) + else + render :action => 'new' + end else - @dmsf_link.target_id = DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil - @dmsf_link.target_type = DmsfFolder.model_name - end - - @dmsf_link.name = params[:dmsf_link][:name] - - if @dmsf_link.save - flash[:notice] = l(:notice_successful_create) - redirect_to dmsf_folder_path(:id => @project.id, :folder_id => @dmsf_link.dmsf_folder_id) - else - render :action => 'new' - end + # Link to + @dmsf_link.project_id = params[:dmsf_link][:target_project_id] + @dmsf_link.dmsf_folder_id = DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil + @dmsf_link.target_project_id = params[:dmsf_link][:project_id] + if params[:dmsf_link][:dmsf_file_id].present? + @dmsf_link.target_id = params[:dmsf_link][:dmsf_file_id] + @dmsf_link.target_type = DmsfFile.model_name + else + @dmsf_link.target_id = params[:dmsf_link][:dmsf_folder_id] + @dmsf_link.target_type = DmsfFolder.model_name + end + @dmsf_link.name = params[:dmsf_link][:name] + + if @dmsf_link.save + flash[:notice] = l(:notice_successful_create) + if params[:dmsf_link][:dmsf_file_id].present? + redirect_to dmsf_file_path(@dmsf_link.target_file) + else + redirect_to edit_dmsf_path(:id => params[:dmsf_link][:project_id], :folder_id => params[:dmsf_link][:dmsf_folder_id]) + end + else + render :action => 'new' + end + end end def destroy @@ -88,4 +119,4 @@ class DmsfLinksController < ApplicationController render_404 end -end +end \ No newline at end of file diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index 80031b3a..d426ea75 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -203,11 +203,7 @@ class DmsfFileRevision < ActiveRecord::Base when 2 then self.major_version + 1 else self.major_version end - end - - def display_title - return self.title - end + end def new_storage_filename raise DmsfAccessError, 'File id is not set' unless self.file.id diff --git a/app/models/dmsf_link.rb b/app/models/dmsf_link.rb index dd64bcf3..f9311444 100644 --- a/app/models/dmsf_link.rb +++ b/app/models/dmsf_link.rb @@ -1,6 +1,6 @@ # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2014 Karel Pičman +# Copyright (C) 2011-14 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -24,7 +24,7 @@ class DmsfLink < ActiveRecord::Base validates :name, :presence => true validates :target_id, :presence => true validates_length_of :name, :maximum => 255 - scope :visible, :conditions => 'deleted = 0' + scope :visible, :conditions => 'deleted = 0' def target_folder_id if self.target_type == DmsfFolder.model_name @@ -36,7 +36,7 @@ class DmsfLink < ActiveRecord::Base end def target_folder - DmsfFolder.find self.target_folder_id if self.target_folder_id + DmsfFolder.find_by_id self.target_folder_id if self.target_folder_id end def target_file_id @@ -44,11 +44,11 @@ class DmsfLink < ActiveRecord::Base end def target_file - DmsfFile.find self.target_file_id if self.target_file_id + DmsfFile.find_by_id self.target_file_id if self.target_file_id end def target_project - Project.find self.target_project_id + Project.find_by_id self.target_project_id end def folder diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index 92c54af3..f0962a1f 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -28,8 +28,7 @@ class DmsfMailer < Mailer files = files.select { |file| file.notify? } redmine_headers 'Project' => project.identifier if project - - @user = user + @files = files @project = project @@ -45,8 +44,7 @@ class DmsfMailer < Mailer files = files.select { |file| file.notify? } redmine_headers 'Project' => project.identifier if project - - @user = user + @files = files @project = project diff --git a/app/views/dmsf/_dir.html.erb b/app/views/dmsf/_dir.html.erb index 703b1d37..5dd597a4 100644 --- a/app/views/dmsf/_dir.html.erb +++ b/app/views/dmsf/_dir.html.erb @@ -21,11 +21,11 @@ <% locked_for_user = subfolder.locked_for_user? %> <% locked = subfolder.locked? %> -<%= check_box_tag(link ? 'dir_links[]' : 'subfolders[]', - link ? link.id : subfolder.id, false, :title => l(:title_check_for_zip_download_or_email)) %> +<%= check_box_tag(name, id, false, + :title => l(:title_check_for_zip_download_or_email)) %> - <%= link_to(h(link ? link.name : subfolder.title), - dmsf_folder_path(:id => @project, :folder_id => subfolder), + <%= link_to(h(title), + dmsf_folder_path(:id => project, :folder_id => subfolder), :class => 'icon icon-folder') %>
[<%= subfolder.files.visible.count %>]
@@ -54,21 +54,21 @@
<% unless locked %> <%= link_to('', - edit_dmsf_path(:id => @project, :folder_id => subfolder), + edit_dmsf_path(:id => project, :folder_id => subfolder), :title => l(:link_edit, :title => h(subfolder.title)), :class => 'icon icon-edit') %> <%= link_to('', - lock_dmsf_path(:id => @project, :folder_id => subfolder), + lock_dmsf_path(:id => project, :folder_id => subfolder), :title => l(:title_lock_file), :class => 'icon icon-dmsf-lock') %> <% if subfolder.notification %> <%= link_to('', - notify_deactivate_dmsf_path(:id => @project, :folder_id => subfolder), + notify_deactivate_dmsf_path(:id => project, :folder_id => subfolder), :title => l(:title_notifications_active_deactivate), :class => 'icon icon-notification-on') %> <% else %> <%= link_to('', - notify_activate_dmsf_path(:id => @project, :folder_id => subfolder), + notify_activate_dmsf_path(:id => project, :folder_id => subfolder), :title => l(:title_notifications_not_active_activate), :class => 'icon icon-notification-off') %> <% end %> @@ -81,7 +81,7 @@ :class => 'icon icon-del') %> <% else %> <%= link_to('', - delete_dmsf_path(:id => @project, :folder_id => @folder, :delete_folder_id => subfolder), + delete_dmsf_path(:id => project, :folder_id => @folder, :delete_folder_id => subfolder), :data => {:confirm => l(:text_are_you_sure)}, :title => l(:title_delete), :class => 'icon icon-del') %> @@ -90,7 +90,7 @@ <% if (!locked_for_user || @force_file_unlock_allowed) && subfolder.unlockable? %> <%= link_to('', - unlock_dmsf_path(:id => @project, :folder_id => subfolder), + unlock_dmsf_path(:id => project, :folder_id => subfolder), :title => l(:title_unlock_file), :class => 'icon icon-dmsf-unlock')%> <% end %> diff --git a/app/views/dmsf/_file.html.erb b/app/views/dmsf/_file.html.erb index 74c09186..7028e2ef 100644 --- a/app/views/dmsf/_file.html.erb +++ b/app/views/dmsf/_file.html.erb @@ -1,7 +1,7 @@ <%#= # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2014 Karel Pičman +# Copyright (C) 2011-14 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,11 +22,11 @@ <% locked = file.locked? %> <% wf = DmsfWorkflow.find_by_id(file.last_revision.dmsf_workflow_id) %> -<%= check_box_tag(link ? 'file_links[]' : 'files[]', - link ? link.id : file.id, false, :title => l(:title_check_for_zip_download_or_email)) %> +<%= check_box_tag(name, id, false, + :title => l(:title_check_for_zip_download_or_email)) %> <% file_download_url = url_for({:only_path => false, :controller => :dmsf_files, :action => 'show', :id => file, :download => ''}) %> - <%= link_to(h(link ? link.name : file.last_revision.display_title), + <%= link_to(h(title), file_download_url, :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}", :title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version), @@ -58,7 +58,7 @@ <%= link_to( file.last_revision.workflow_str(false), log_dmsf_workflow_path( - :project_id => @project.id, + :project_id => project.id, :id => wf.id, :dmsf_file_revision_id => file.last_revision.id), :title => DmsfWorkflow.assignments_to_users_str(wf.next_assignments(file.last_revision.id)), @@ -125,7 +125,7 @@ <% if index %> <%= link_to('', action_dmsf_workflow_path( - :project_id => @project.id, + :project_id => project.id, :id => wf.id, :dmsf_workflow_step_assignment_id => assignments[index].id, :dmsf_file_revision_id => file.last_revision.id), @@ -165,7 +165,7 @@ <% if @workflows_available %> <%= link_to('', assign_dmsf_workflow_path( - :project_id => @project.id, + :project_id => project.id, :dmsf_file_revision_id => file.last_revision.id), :title => l(:label_dmsf_wokflow_action_assign), :class => 'icon icon-dmsf-none', diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb index 25af034f..db729539 100644 --- a/app/views/dmsf/edit.html.erb +++ b/app/views/dmsf/edit.html.erb @@ -36,7 +36,11 @@ notify_activate_dmsf_path(:id => @project, :folder_id => @folder), :title => l(:title_notifications_not_active_activate), :class => 'icon icon-notification-off') %> - <% end %> + <% end %> + <%= link_to(l(:label_link_to), + new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder.id, :type => 'link_to'), + :title => l(:link_create_link), + :class => 'icon icon-link') %> <%= link_to(l(:button_copy), copy_folder_path(:id => @folder), :title => l(:title_copy), :class => 'icon icon-copy') %> <%= link_to(l(:button_delete), diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index ee880ed5..14ac5ded 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -79,8 +79,8 @@ <% end %> <% end %> <% if @file_manipulation_allowed %> - <%= link_to(l(:label_create_link), - new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder ? @folder.id : @folder, :target_project_id => @project.id), + <%= link_to(l(:label_link_from), + new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder ? @folder.id : @folder, :type => 'link_from'), :title => l(:link_create_link), :class => 'icon icon-link') unless @locked_for_user %> <% end %> @@ -131,12 +131,26 @@ <% @subfolders.each do |subfolder| %> - <%= render(:partial => 'dir', :locals => {:subfolder => subfolder, :link => nil}) %> + <%= render(:partial => 'dir', + :locals => { + :project => @project, + :subfolder => subfolder, + :link => nil, + :id => subfolder.id, + :name => 'subfolders[]', + :title => subfolder.title }) %> <% end %> <% @dir_links.each do |link| %> - <%= render(:partial => 'dir', :locals => {:subfolder => link.target_folder, :link => link}) %> + <%= render(:partial => 'dir', + :locals => { + :project => link.target_project, + :subfolder => link.target_folder, + :link => link, + :id => link.id, + :name => 'dir_links[]', + :title => link.name }) %> <% end %> <% @files.each do |file| %> @@ -145,7 +159,13 @@ <% next %> <% end %> - <%= render(:partial => 'file', :locals => {:file => file, :link => nil}) %> + <%= render(:partial => 'file', :locals => { + :project => @project, + :file => file, + :link => nil, + :id => file.id, + :name => 'files[]', + :title => file.title }) %> <% end %> <% @file_links.each do |link| %> @@ -154,7 +174,13 @@ <% next %> <% end %> - <%= render(:partial => 'file', :locals => {:file => link.target_file, :link => link}) %> + <%= render(:partial => 'file', :locals => { + :project => link.target_project, + :file => link.target_file, + :link => link, + :id => link.id, + :name => 'file_links[]', + :title => link.name }) %> <% end %> diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb index e5ec47e0..46087c0f 100644 --- a/app/views/dmsf_files/show.html.erb +++ b/app/views/dmsf_files/show.html.erb @@ -30,16 +30,20 @@ :title => l(:title_lock_file), :class => 'icon icon-dmsf-lock') %> <% if @file.notification %> - <%= link_to(l(:label_notifications_off), - notify_deactivate_dmsf_files_path(:id => @file), - :title => l(:title_notifications_active_deactivate), - :class => 'icon icon-notification-on') %> - <% else %> - <%= link_to(l(:label_notifications_on), - notify_activate_dmsf_files_path(:id => @file), - :title => l(:title_notifications_not_active_activate), - :class => 'icon icon-notification-off') %> - <% end %> + <%= link_to(l(:label_notifications_off), + notify_deactivate_dmsf_files_path(:id => @file), + :title => l(:title_notifications_active_deactivate), + :class => 'icon icon-notification-on') %> + <% else %> + <%= link_to(l(:label_notifications_on), + notify_activate_dmsf_files_path(:id => @file), + :title => l(:title_notifications_not_active_activate), + :class => 'icon icon-notification-off') %> + <% end %> + <%= link_to(l(:label_link_to), + new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @file.folder ? @file.folder.id : nil, :dmsf_file_id => @file.id, :type => 'link_to'), + :title => l(:link_create_link), + :class => 'icon icon-link') %> <%= link_to(l(:button_copy), copy_file_path(:id => @file), :title => l(:title_copy), :class => 'icon icon-copy') %> <%= delete_link @file %> diff --git a/app/views/dmsf_links/_form.html.erb b/app/views/dmsf_links/_form.html.erb index b719a1b1..091c56c6 100644 --- a/app/views/dmsf_links/_form.html.erb +++ b/app/views/dmsf_links/_form.html.erb @@ -1,6 +1,6 @@ <%# Redmine plugin for Document Management System "Features" # -# Copyright (C) 2014 Karel Pičman +# Copyright (C) 2011-14 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -21,34 +21,59 @@
-<%= render(:partial => '/dmsf/path', :locals => {:folder => @dmsf_link.folder, :filename => nil}) %> +<% type = (@type || params[:dmsf_link].blank?) ? @type : params[:dmsf_link][:type] %> +<% dmsf_file_id = (@dmsf_file_id || params[:dmsf_link].blank?) ? @dmsf_file_id : params[:dmsf_link][:dmsf_file_id] %> +<% target_folder_id = (@target_folder_id || params[:dmsf_link].blank? || !DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id])) ? @target_folder_id : params[:dmsf_link][:target_folder_id].to_i %> + +<% if dmsf_file_id %> + <% file = DmsfFile.find_by_id dmsf_file_id%> + <% title = file.title if file %> +<% end %> + +<%= render(:partial => '/dmsf/path', :locals => {:folder => @dmsf_link.folder, :filename => title}) %> <%= labelled_form_for @dmsf_link do |f| %> <%= error_messages_for @dmsf_link %> <%= f.hidden_field :project_id, :value => @dmsf_link.project_id %> <%= f.hidden_field :dmsf_folder_id, :value => @dmsf_link.dmsf_folder_id if @dmsf_link.dmsf_folder_id %> + <%= f.hidden_field :type, :value => type %> + <%= f.hidden_field :dmsf_file_id, :value => dmsf_file_id %>
-

- <%= f.select(:target_project_id, +

+ <% if type == 'link_from' %> + <%= label_tag('dmsf_link[target_project_id]', l(:label_source_project), :class => 'required') %> + <% else %> + <%= label_tag('dmsf_link[target_project_id]', l(:label_target_project), :class => 'required') %> + <% end %> + <%= select_tag('dmsf_link[target_project_id]', project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, - :selected => @dmsf_link.target_project), - {:required => true}) %> -

-

- <%= f.select(:target_folder_id, - folder_tree_options_for_select(DmsfFolder.directory_tree(@dmsf_link.target_project), - :selected => @target_folder_id), - {:required => true}) %> -

-

- <%= f.select(:target_file_id, - options_for_select( - DmsfFolder.file_list( - (@target_folder_id ? DmsfFolder.find(@target_folder_id).files : @dmsf_link.target_project.dmsf_files).visible), - @target_file_id)) %> + :selected => @dmsf_link.target_project)) %>

- <%= f.text_field :name, :size => 40, :maxlength => 255, :required => true, :value => @dmsf_link.name %> + <% if type == 'link_from' %> + <%= label_tag('dmsf_link[target_folder_id]', l(:label_source_folder)) %> + <% else %> + <%= label_tag('dmsf_link[target_folder_id]', l(:label_target_folder)) %> + <% end %> + <%= select_tag('dmsf_link[target_folder_id]', + folder_tree_options_for_select(DmsfFolder.directory_tree(@dmsf_link.target_project), + :selected => target_folder_id)) %> +

+ <% if type == 'link_from' %> +

+ <% if target_folder_id %> + <% folder = DmsfFolder.find_by_id target_folder_id %> + <% files = folder.files.visible if folder %> + <% else %> + <% files = @dmsf_link.target_project.dmsf_files.visible if @dmsf_link.target_project %> + <% end %> + <%= f.select(:target_file_id, + options_for_select(DmsfFolder.file_list(files), params[:dmsf_link].present? ? params[:dmsf_link][:target_file_id] : nil)) %> +

+ <% end %> +

+ <%= label_tag('dmsf_link[name]', l(:label_link_name), :class => 'required') %> + <%= text_field_tag 'dmsf_link[name]', @dmsf_link.name, :size => 40, :maxlength => 255 %>

<%= f.submit l(:button_create) %> @@ -56,9 +81,9 @@ \ No newline at end of file diff --git a/app/views/dmsf_mailer/files_deleted.html.erb b/app/views/dmsf_mailer/files_deleted.html.erb index 3ac0d9c4..dc6734ab 100644 --- a/app/views/dmsf_mailer/files_deleted.html.erb +++ b/app/views/dmsf_mailer/files_deleted.html.erb @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= link_to @user, user_path(@user, :only_path => false) %> <%= l(:text_email_doc_deleted) %> +<%= link_to User.current, user_path(User.current, :only_path => false) %> <%= l(:text_email_doc_deleted) %> <%= link_to @project, project_path(@project, :only_path => false) %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %>

diff --git a/app/views/dmsf_mailer/files_deleted.text.erb b/app/views/dmsf_mailer/files_deleted.text.erb index 92f9ba4d..ae78d992 100644 --- a/app/views/dmsf_mailer/files_deleted.text.erb +++ b/app/views/dmsf_mailer/files_deleted.text.erb @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= @user.name %> <%= l(:text_email_doc_deleted) %> <%= @project.name %> <%= l(:text_email_doc_follows) %> +<%= User.current.name %> <%= l(:text_email_doc_deleted) %> <%= @project.name %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %> <%= h(file.dmsf_path_str) %> (<%= file.name %>) <% if file.last_revision %> diff --git a/app/views/dmsf_mailer/files_updated.html.erb b/app/views/dmsf_mailer/files_updated.html.erb index 046f01bf..8de4d931 100644 --- a/app/views/dmsf_mailer/files_updated.html.erb +++ b/app/views/dmsf_mailer/files_updated.html.erb @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= link_to @user, user_path(@user, :only_path => false) %> <%= l(:text_email_doc_updated) %> +<%= link_to User.current, user_path(User.current, :only_path => false) %> <%= l(:text_email_doc_updated) %> <%= link_to @project, project_path(@project, :only_path => false) %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %>

diff --git a/app/views/dmsf_mailer/files_updated.text.erb b/app/views/dmsf_mailer/files_updated.text.erb index 77b49c5d..147a1922 100644 --- a/app/views/dmsf_mailer/files_updated.text.erb +++ b/app/views/dmsf_mailer/files_updated.text.erb @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= @user.name %> <%= l(:text_email_doc_updated) %> +<%= User.current.name %> <%= l(:text_email_doc_updated) %> <%= @project.name %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %> <%= h(file.dmsf_path_str) %> (<%= file.name %>), diff --git a/app/views/my/blocks/_locked_documents.html.erb b/app/views/my/blocks/_locked_documents.html.erb index 8ef44bef..3615e774 100644 --- a/app/views/my/blocks/_locked_documents.html.erb +++ b/app/views/my/blocks/_locked_documents.html.erb @@ -62,7 +62,7 @@ <%= link_to_project(file.project) %> - <%= link_to(h(file.last_revision.display_title), + <%= link_to(h(file.title), {:controller => 'dmsf_files', :action => :show, :id => file }, :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}") %> diff --git a/app/views/my/blocks/_open_approvals.html.erb b/app/views/my/blocks/_open_approvals.html.erb index ab915a6f..bc574d05 100644 --- a/app/views/my/blocks/_open_approvals.html.erb +++ b/app/views/my/blocks/_open_approvals.html.erb @@ -55,7 +55,7 @@ <% if assignment.dmsf_file_revision && assignment.dmsf_file_revision.file %> - <%= link_to(h(assignment.dmsf_file_revision.display_title), + <%= link_to(h(assignment.dmsf_file_revision.title), {:controller => 'dmsf_files', :action => :show, :id => assignment.dmsf_file_revision.file }) %> <% end %> diff --git a/assets/images/filetypes/docx_gray.png b/assets/images/filetypes/docx_gray.png deleted file mode 100644 index 3de9b344e949f74ce1fd45d9d2f1e4718f7c9c09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 401 zcmV;C0dD?@P)Px#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^h<5CsX$ zd(^f7009+AL_t(2&sEUBP84wz#qrN>CcK5EjfIT`hQy5x78X|8kXTv5BlrZ?Xl*nh z!3Qu_3#&Z^6|n#cC`dH&XTjN-o!_x=qU<@%P44&JoSXqLNv-YOXf@av_^)x=G?}H& zO|CP|W|GZ7^(i!t9Jn+!bK}B0uue7x6)!AmRr+b2RE@DiCtmvKl{c0VyzQZC=B`7X zC1;pBL9B_0ZNn>fT>Ig>V-x3|s{3UWR5gC$i!+~{x{nxRB#Pk$emVCX2VSEQkB#~t z!x|Gy?%{zaXvMCtB0AL+`(UrnJy$&HQ*^4|RzVFKE#eziM5pijeV+YGo?HH)`U`X- vb`~0asF*JTqlN1tw}CAbMW<5~b49@)qFbU1MYb`?00000NkvXXu0mjfmieGc diff --git a/assets/images/filetypes/pptx_gray.png b/assets/images/filetypes/pptx_gray.png deleted file mode 100644 index f254194645c9392f3138c98db0668e75dc613bb7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 419 zcmV;U0bKrxP)Px#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^h<5Ct}R z9r=p@00AdSL_t(2&sESrOO|0A#qrORmpnK)1g=36`Vv9}rLn0O(AetJAk8lN0)kY~ zArS|mFhj&aB!sbRW;`$pYIw zlsX%B3=J@6!7GjMR0!dXlpT9*(v-&@nsV%Je+(6=HEGF&-zH=kSHcmNg(_vUPRz=N ziVO383Xjyj<4(5bom1zE&Rc8#2p@eGLXol=FYWjyEZQ}rQ7!c=ic~z;x;Cxx)q9Or z_<}{D=>NSRPyQ{BF&{{Ofg*$t#k44ofy`glX(f`FeQ1ryD>1lV=9dL{wo896;&978nDhhA{> zniD9%@*uyBeV#gZpo^>i1m+!=a*wr&ca$4Q99+}Wq_Cq4C>wnMW|MS0F zb=w@XRv^4a4!|xfdw4&yU{kD}am5$x=(R`UN&sgSeP;Mzu-TUYyuLWbS zY+KVmZa-a1QzHW>u{>VUg)jDBi{392RUBcPb90TR#M$e@Tdmh{M`k@!oNjwf z!Ro@$-!h#V_p@xf3%shKX)I-*VRfwyTbiUZ6;1 en253KLHkgt1%FSponZrp6N9I#pUXO@geCxgxRIFv diff --git a/assets/images/filetypes/xlsx_gray.png b/assets/images/filetypes/xlsx_gray.png deleted file mode 100644 index 0ed8a0f2857bf847238512aef5ef53e8b3b455e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 405 zcmV;G0c!qPx#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^h<5C;Pu zm|rRY009|EL_t(2&sET`Yt?ZS#_`wH5B>)h%Y>V)BBEo(>Z*u?CCe6F^FOf8W*7^C z!7$J|l?8D{SQ(f^i^-MU>;3-vJO;na-Sd|Vbn`AdoUS-hw>WhU&qtkf-w#fFR@YHf`$k=U>!h7GHdG6E!rmEoO2$j}tSNybN z>Y863c`F`^h&M{(x~Z#XPMmq>rhXhoMVaH&H@9%&$PI%y#Hy&u%z<}W$Da7@*ot1P zspE|@w{9Km`QeYxI`I+r#Go`6?`_%y4^;O@7lYE;Pz?tCs6iazt{9AY@8#iz^IX!t z@(&n9d{|2Kj;dbdQ>oLq*I00000NkvXXu0mjfwU@K; diff --git a/assets/stylesheets/dmsf.css b/assets/stylesheets/dmsf.css index 3eb2951e..d37049b1 100644 --- a/assets/stylesheets/dmsf.css +++ b/assets/stylesheets/dmsf.css @@ -323,10 +323,14 @@ tr.gray .icon-folder { background-image: url(../images/folder_gray.png); } .icon-file.filetype-odp { background-image: url(../images/filetypes/odp.png); } .icon-file.filetype-odg { background-image: url(../images/filetypes/odg.png); } -tr.gray .icon-file.filetype-doc, .icon-file.filetype-docx { background-image: url(../images/filetypes/doc_gray.png); } -tr.gray .icon-file.filetype-xls, .icon-file.filetype-xlsx { background-image: url(../images/filetypes/xls_gray.png); } -tr.gray .icon-file.filetype-ppt, .icon-file.filetype-pptx { background-image: url(../images/filetypes/ppt_gray.png); } -tr.gray .icon-file.filetype-vsd, .icon-file.filetype-vsdx { background-image: url(../images/filetypes/vsd_gray.png); } +tr.gray .icon-file.filetype-doc { background-image: url(../images/filetypes/doc_gray.png); } +tr.gray .icon-file.filetype-docx { background-image: url(../images/filetypes/doc_gray.png); } +tr.gray .icon-file.filetype-xls { background-image: url(../images/filetypes/xls_gray.png); } +tr.gray .icon-file.filetype-xlsx { background-image: url(../images/filetypes/xls_gray.png); } +tr.gray .icon-file.filetype-ppt { background-image: url(../images/filetypes/ppt_gray.png); } +tr.gray .icon-file.filetype-pptx { background-image: url(../images/filetypes/ppt_gray.png); } +tr.gray .icon-file.filetype-vsd { background-image: url(../images/filetypes/vsd_gray.png); } +tr.gray .icon-file.filetype-vsdx { background-image: url(../images/filetypes/vsd_gray.png); } tr.gray .icon-file.filetype-mpp { background-image: url(../images/filetypes/mpp_gray.png); } tr.gray .icon-file.filetype-odt { background-image: url(../images/filetypes/odt_gray.png); } tr.gray .icon-file.filetype-ods { background-image: url(../images/filetypes/ods_gray.png); } @@ -352,4 +356,9 @@ tr.gray .icon-file.application-x-gzip { background-image: url(../images/filetype /* Links */ .gray { color: #AAA } -.gray a, .gray a:link, .gray a:visited{ color: #484848; text-decoration: none; } \ No newline at end of file +.gray a, .gray a:link, .gray a:visited{ color: #484848; text-decoration: none; } + +label.required:after { + content: " *"; + color: #bb0000; +} \ No newline at end of file diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 72a59aeb..52887000 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1,7 +1,8 @@ # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2013 Karel Pičman +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2011-14 Karel Pičman +# # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -191,8 +192,8 @@ cs: title_copy: Kopírovat error_folder_cannot_be_copied: Složka nemůže být zkopírována notice_folder_copied: Složka zkopírována - error_max_email_filesize_exceeded: "Přesáhli jste maximální velikost souboru, který lze poslat emailem. (%{number} MB)" + error_max_email_filesize_exceeded: "Přesáhli jste maximální velikost souboru, který lze poslat emailem. (%{number} MB)" note_maximum_email_filesize: Omezí se maximální velikost souboru, který může být poslán emailem. 0 znamená neomezený. Číslo je v MB. label_maximum_email_filesize: Maximální velikost souboru emailu header_minimum_filesize: Chyba souboru. @@ -271,13 +272,21 @@ cs: text_email_to_proceed: Pro schválení klikněte na zaškrtávací ikonku vedle dokumentu v text_email_to_see_history: Pro zobrazení historie schvalovacího procesu klikněte na status dokumentu v text_email_to_see_status: Pro zobrazení aktuálního stavu schvalovacího procesu klikněte na status dokumentu v + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents title_create_link: Vytvořit symbolický odkaz - label_create_link: Vytvořit odkaz + label_link_from: Odkaz z + label_link_to: Odkaz do label_notifications_on: Zapnout notifikace label_notifications_off: Vypnout notifikace - field_target_file: Cílový soubor + field_target_file: Zdrojový soubor title_download_entries: Historie stahování + label_link_name: Název odkazu + label_target_folder: Cílový adresář + label_source_folder: Zdrojový adresář + label_target_project: Cílový projekt + label_source_project: Zdrojový projekt text_email_doc_updated_subject: "Dokumenty projektu %{project} aktualizovány" text_email_doc_updated: právě aktualizoval dokumenty projektu diff --git a/config/locales/de.yml b/config/locales/de.yml index 5a189d54..ff410094 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1,7 +1,8 @@ # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Terrence Miller -# Copyright (C) 2013 Christian Wetting +# Copyright (C) 2011 Terrence Miller +# Copyright (C) 2013 Christian Wetting +# Copyright (C) 2011-14 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -36,6 +37,7 @@ de: error_folder_is_not_empty: Ordner ist nicht leer error_folder_title_is_already_used: Titel wird schon benutzt. Denk dir was Neues aus. notice_folder_details_were_saved: Ordnerdetails wurden gespeichert + error_folder_is_locked: Order ist gesperrt error_file_is_locked: Datei ist gesperrt notice_file_deleted: Datei gelöscht error_at_least_one_revision_must_be_present: Es muss mindestens eine Version existieren @@ -214,9 +216,7 @@ de: select_option_webdav_readonly: nur Lesen select_option_webdav_readwrite: Lesen/Schreiben label_webdav_strategy: Webdav Strategie - note_webdav_strategy: Erlaubt dem Administrator den Wechsel der WebDav Nutzung zwischen nur lesend und auch schreibenden Zugriffen. - - # Not translated + note_webdav_strategy: Erlaubt dem Administrator den Wechsel der WebDav Nutzung zwischen nur lesend und auch schreibenden Zugriffen. error_unable_delete_dmsf_workflow: Unable to delete the workflow error_empty_note: The note can't be empty @@ -238,7 +238,7 @@ de: label_dmsf_wokflow_action_assign: Assign an approval workflow label_dmsf_wokflow_action_start: Start workflow label_dmsf_workflow_add_approver: "Add a new approver with a logical function:" - label_or: or + label_or: oder label_action: Action label_note: Note title_none: None @@ -272,13 +272,27 @@ de: text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project + + text_email_doc_updated_subject: "Documents of %{project} updated" + text_email_doc_updated: has just actualized documents of + text_email_doc_follows: as follows + text_email_doc_deleted_subject: "Documents of %{project} deleted" + text_email_doc_deleted: has just deleted documents of label_links_only: links only my: diff --git a/config/locales/en.yml b/config/locales/en.yml index 00b15479..a7a30a18 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,8 +1,8 @@ # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2012 Daniel Munn -# Copyright (C) 2013 karel Pičman +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2012 Daniel Munn +# Copyright (C) 2011-14 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -110,8 +110,7 @@ en: label_created: Created label_changed: Changed info_changed_by_user: "%{changed} by" - label_filename: Filename - label_approval_workflow: Workflow + label_filename: Filename label_mime: Mime label_size: Size heading_new_revision: New Revision @@ -277,11 +276,17 @@ en: label_my_locked_documents: My locked documents title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project text_email_doc_updated_subject: "Documents of %{project} updated" text_email_doc_updated: has just actualized documents of @@ -296,4 +301,4 @@ en: openap_provals: Open approvals label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX - note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB. + note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB. \ No newline at end of file diff --git a/config/locales/es.yml b/config/locales/es.yml index a5545ab3..c0a248a0 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -2,6 +2,8 @@ # # Copyright (C) 2011 Vít Jonáš # +# +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -51,9 +53,7 @@ es: warning_file_notifications_already_activated: Las notificaciones del archivo seleccionado ya estaban activadas previamente notice_file_notifications_activated: Notificación de archivo activado warning_file_notifications_already_deactivated: Las notificaciones del archivo seleccionado ya estaban desactivadas previamente - notice_file_notifications_deactivated: Notificación de archivo desactivada - - # Not translated + notice_file_notifications_deactivated: Notificación de archivo desactivada link_details: "%{title} details" link_edit: "Edit %{title}" submit_create: Create @@ -272,13 +272,21 @@ es: text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project text_email_doc_updated_subject: "Documents of %{project} updated" text_email_doc_updated: has just actualized documents of @@ -291,7 +299,6 @@ es: blocks: locked_documents: Locked documents open_approvals: Open approvals - - + label_maximum_ajax_upload_filesize: Maximum file size uploadable via AJAX note_maximum_ajax_upload_filesize: Limits maximum file size that can uploaded via standard AJAX interface otherwise Redmine standard upload form must be used. Number is in MB. \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index b6d41304..ca857ef9 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -2,7 +2,7 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2013 karel Pičman +# Copyright (C) 2014 Atmis # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -110,8 +110,7 @@ fr: label_created: Créé label_changed: Modifié info_changed_by_user: "%{changed} par" - label_filename: Fichier - label_approval_workflow: Flux de validation + label_filename: Fichier label_mime: Type label_size: Taille heading_new_revision: Nouvelle révision @@ -277,11 +276,17 @@ fr: label_my_locked_documents: Mes documents verrouillés title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project text_email_doc_updated_subject: "Documents of %{project} updated" text_email_doc_updated: has just actualized documents of @@ -296,4 +301,4 @@ fr: open_approvals: Approbations en attente label_maximum_ajax_upload_filesize: Taille maximale de fichier pour téléversement via AJAX - note_maximum_ajax_upload_filesize: "Taille maximale, en méga octets, de fichier pour téléversement via l'interface standard AJAX. Sinon l'interface standard de Redmine doit être utilisée." + note_maximum_ajax_upload_filesize: "Taille maximale, en méga octets, de fichier pour téléversement via l'interface standard AJAX. Sinon l'interface standard de Redmine doit être utilisée." \ No newline at end of file diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 52f445f9..2e513374 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -2,6 +2,8 @@ # # Copyright (C) 2011 Vít Jonáš # +# +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -189,9 +191,7 @@ ja: warning_no_project_to_copy_folder_to: フォルダをコピーするプロジェクトがありません title_copy: コピー error_folder_cannot_be_copied: フォルダをコピーできません - notice_folder_copied: フォルダをコピーしました - - # Not translated + notice_folder_copied: フォルダをコピーしました error_max_email_filesize_exceeded: "You've exceeded the maximum filesize for sending via email. (%{number} MB)" note_maximum_email_filesize: "Limits maximum filesize that can be sent via email. 0 means unlimited. Number is in MB." @@ -272,13 +272,21 @@ ja: text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in - + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents + title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project text_email_doc_updated_subject: "Documents of %{project} updated" text_email_doc_updated: has just actualized documents of diff --git a/config/locales/ru.yml b/config/locales/ru.yml index f5243495..6df546b6 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -2,6 +2,8 @@ # # Copyright (C) 2011 Vít Jonáš # +# +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -215,9 +217,7 @@ ru: select_option_webdav_readwrite: "Чтение/Запись" label_webdav_strategy: "Стратегия WebDAV" note_webdav_strategy: "Позволяет администратору решить в каком режиме предоставить доступ к WebDAV для конечных пользователей (Только для чтения или Чтение+Запись)." - - # Not translated - + error_unable_delete_dmsf_workflow: Unable to delete the workflow error_empty_note: The note can't be empty error_workflow_assign: An error occured while assigning @@ -272,13 +272,21 @@ ru: text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in - + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents + title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project text_email_doc_updated_subject: "Documents of %{project} updated" text_email_doc_updated: has just actualized documents of diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 37e1e287..d7209f60 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -2,6 +2,8 @@ # # Copyright (C) 2011 # +# +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -173,8 +175,7 @@ sl: heading_access_last: Zadnji label_dmsf_updated: Arhiv posodobljen title_total_size_of_all_files: Skupna velikost vseh datotek v tej mapi - project_module_dmsf: Arhiv - + project_module_dmsf: Arhiv warning_no_project_to_copy_file_to: Ni projekta kamor bi kopiral datoteko comment_copied_from: "Skopirano iz %{source}" notice_file_copied: Datoteka skopirana @@ -216,8 +217,7 @@ sl: select_option_webdav_readwrite: "Beri/Piši" label_webdav_strategy: Webdav strategija note_webdav_strategy: "Omogoči administratorju da odloči ali je webdav platforma na voljo izključno za branje ali beri/piši za končne uporabnike." - - # Not translated + error_unable_delete_dmsf_workflow: Unable to delete the workflow error_empty_note: "The note can't be empty" error_workflow_assign: An error occured while assigning @@ -272,13 +272,21 @@ sl: text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in - + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents + title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project text_email_doc_updated_subject: "Documents of %{project} updated" text_email_doc_updated: has just actualized documents of diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 954d6048..85d1e22c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2,6 +2,8 @@ # # Copyright (C) 2011 Vít Jonáš # +# +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -173,10 +175,7 @@ zh: heading_access_last: 末次 label_dmsf_updated: DMSF updated title_total_size_of_all_files: 文件夹所有文件总大小 - project_module_dmsf: 文档管家 - - # Not translated - + project_module_dmsf: 文档管家 warning_no_project_to_copy_file_to: No project to copy file to comment_copied_from: "Copied from %{source}" notice_file_copied: File copied @@ -273,13 +272,21 @@ zh: text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in - + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents + title_create_link: Create a symbolic link - label_create_link: Create link + label_link_from: Link from + label_link_to: Link to label_notifications_on: Notifications on label_notifications_off: Notifications off - field_target_file: Target file + field_target_file: Source file title_download_entries: Download entries + label_link_name: Link name + label_target_folder: Target folder + label_source_folder: Source folder + label_target_project: Target project + label_source_project: Source project text_email_doc_updated_subject: "Documents of %{project} updated" text_email_doc_updated: has just actualized documents of diff --git a/test/fixtures/dmsf_files.yml b/test/fixtures/dmsf_files.yml index 1f22141f..aeeab644 100644 --- a/test/fixtures/dmsf_files.yml +++ b/test/fixtures/dmsf_files.yml @@ -46,3 +46,11 @@ dmsf_files_005: deleted: 0 deleted_by_user_id: NULL +dmsf_files_006: + id: 6 + project_id: 2 + dmsf_folder_id: 3 + name: "test.txt" + notification: 0 + deleted: 0 + deleted_by_user_id: NULL \ No newline at end of file diff --git a/test/functional/dmsf_links_controller_test.rb b/test/functional/dmsf_links_controller_test.rb index a8e34fff..41f412c4 100644 --- a/test/functional/dmsf_links_controller_test.rb +++ b/test/functional/dmsf_links_controller_test.rb @@ -25,49 +25,69 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def setup @user_admin = User.find_by_id 1 - @user_member = User.find_by_id 2 - @user_non_member = User.find_by_id 3 - @project1 = Project.find_by_id 1 - assert_not_nil @project1 - @project1.enable_module! :dmsf + @user_member = User.find_by_id 2 + assert_not_nil @user_member + @user_non_member = User.find_by_id 3 @role_manager = Role.where(:name => 'Manager').first assert_not_nil @role_manager @role_manager.add_permission! :file_manipulation - @folder1 = DmsfFolder.find_by_id 1 - @file1 = DmsfFile.find_by_id 1 + @role_developer = Role.where(:name => 'Developer').first + assert_not_nil @role_developer + @role_developer.add_permission! :file_manipulation + @project1 = Project.find_by_id 1 + assert_not_nil @project1 + @project1.enable_module! :dmsf + @project2 = Project.find_by_id 2 + assert_not_nil @project2 + @project2.enable_module! :dmsf + @folder1 = DmsfFolder.find_by_id 1 # project1/folder1 + @folder2 = DmsfFolder.find_by_id 2 # project1/folder1/folder2 + @folder3 = DmsfFolder.find_by_id 3 # project2/folder3 + @file1 = DmsfFile.find_by_id 1 # project1/file1 + @file2 = DmsfFile.find_by_id 2 # project2/file2 + @file4 = DmsfFile.find_by_id 4 # project1/folder2/file4 + @file6 = DmsfFile.find_by_id 6 # project2/folder3/file6 @request.session[:user_id] = @user_member.id @file_link = DmsfLink.find_by_id 1 @request.env['HTTP_REFERER'] = dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) end - def test_truth + def test_truth assert_kind_of User, @user_admin assert_kind_of User, @user_member assert_kind_of User, @user_non_member assert_kind_of Project, @project1 + assert_kind_of Project, @project2 assert_kind_of Role, @role_manager + assert_kind_of Role, @role_developer assert_kind_of DmsfFolder, @folder1 + assert_kind_of DmsfFolder, @folder2 + assert_kind_of DmsfFolder, @folder3 assert_kind_of DmsfFile, @file1 + assert_kind_of DmsfFile, @file2 + assert_kind_of DmsfFile, @file4 + assert_kind_of DmsfFile, @file6 assert_kind_of DmsfLink, @file_link end - def test_authorize - # Admin + def test_authorize_admin @request.session[:user_id] = @user_admin.id get :new, :project_id => @project1.id assert_response :success - assert_template 'new' + assert_template 'new' + end - # Non member - @request.session[:user_id] = @user_non_member.id - get :new, :project_id => @project1.id + def test_authorize_non_member + @request.session[:user_id] = @user_non_member.id + get :new, :project_id => @project2.id assert_response :forbidden + end - # Member + def test_authorize_member @request.session[:user_id] = @user_member.id get :new, :project_id => @project1.id assert_response :success - + # Without the module @project1.disable_module!(:dmsf) get :new, :project_id => @project1.id @@ -85,17 +105,190 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase assert_response :success end - def test_create + def test_create_file_link_from + # 1. File link in a folder from another folder assert_difference 'DmsfLink.count', +1 do post :create, :dmsf_link => { :project_id => @project1.id, - :target_project_id => @project1.id, + :target_project_id => @project2.id, :dmsf_folder_id => @folder1.id, - :target_file_id => @file1.id, - :name => 'file_link' - } + :target_file_id => @file6.id, + :target_folder_id => @folder3.id, + :name => 'file_link', + :type => 'link_from' + } end assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) + + # 2. File link in a folder from another root folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :dmsf_folder_id => @folder1.id, + :target_project_id => @project2.id, + :target_file_id => @file2.id, + :target_folder_id => 'Documents', + :name => 'file_link', + :type => 'link_from' + } + end + assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) + + # 3. File link in a root folder from another folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :target_project_id => @project2.id, + :target_file_id => @file6.id, + :target_folder_id => @folder3.id, + :name => 'file_link', + :type => 'link_from' + } + end + assert_redirected_to dmsf_folder_path(:id => @project1.id) + + # 4. File link in a root folder from another root folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :target_project_id => @project2.id, + :target_file_id => @file2.id, + :name => 'file_link', + :type => 'link_from' + } + end + assert_redirected_to dmsf_folder_path(:id => @project1.id) + end + + def test_create_folder_link_from + # 1. Folder link in a folder from another folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :dmsf_folder_id => @folder1.id, + :target_project_id => @project2.id, + :target_folder_id => @folder3.id, + :name => 'folder_link', + :type => 'link_from' + } + end + assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) + + # 2. Folder link in a folder from another root folder + assert_difference 'DmsfLink.count', +0 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :dmsf_folder_id => @folder1.id, + :target_project_id => @project2.id, + :name => 'folder_link', + :type => 'link_from' + } + end + assert_response :success + + # 3. Folder link in a root folder from another folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :target_project_id => @project2.id, + :target_folder_id => @folder3.id, + :name => 'folder_link', + :type => 'link_from' + } + end + assert_redirected_to dmsf_folder_path(:id => @project1.id) + + # 4. Folder link in a root folder from another root folder + assert_difference 'DmsfLink.count', +0 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :target_project_id => @project2.id, + :name => 'folder_link', + :type => 'link_from' + } + end + assert_response :success + end + + def test_create_file_link_to + # 1. File link to a root folder from another folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :dmsf_file_id => @file1.id, + :target_project_id => @project2.id, + :target_folder_id => @folder3.id, + :name => 'file_link', + :type => 'link_to' + } + end + assert_redirected_to dmsf_file_path(@file1) + + # 2. File link to a folder from another folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project2.id, + :dmsf_folder_id => @folder3.id, + :target_project_id => @project1.id, + :target_folder_id => @folder1.id, + :dmsf_file_id => @file6.id, + :name => 'file_link', + :type => 'link_to' + } + end + assert_redirected_to dmsf_file_path(@file6) + + # 3. File link to a root folder from another root folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project2.id, + :target_project_id => @project1.id, + :dmsf_file_id => @file6.id, + :name => 'file_link', + :type => 'link_to' + } + end + assert_redirected_to dmsf_file_path(@file6) + + # 4. File link to a folder from another root folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project2.id, + :dmsf_folder_id => @folder3.id, + :target_project_id => @project1.id, + :dmsf_file_id => @file6.id, + :name => 'file_link', + :type => 'link_to' + } + end + assert_redirected_to dmsf_file_path(@file6) + end + + def test_create_folder_link_to + # 1. Folder link to a root folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :dmsf_folder_id => @folder1.id, + :target_project_id => @project2.id, + :name => 'folder_link', + :type => 'link_to' + } + end + assert_redirected_to edit_dmsf_path(:id => @project1.id, :folder_id => @folder1.id) + + # 2. Folder link to a folder + assert_difference 'DmsfLink.count', +1 do + post :create, :dmsf_link => { + :project_id => @project1.id, + :dmsf_folder_id => @folder1.id, + :target_project_id => @project2.id, + :target_folder_id => @folder3.id, + :name => 'folder_link', + :type => 'link_to' + } + end + assert_redirected_to edit_dmsf_path(:id => @project1.id, :folder_id => @folder1.id) end def test_destroy