#183 Link to & Link from added

This commit is contained in:
Karel Picman 2014-02-28 12:31:18 +01:00
parent 79a3216d40
commit d8390053f3
32 changed files with 557 additions and 192 deletions

View File

@ -1,6 +1,6 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2014 Karel Pičman <karel.picman@lbcfree.net>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@lbcfree.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -25,17 +25,22 @@ 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?
# 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 = DmsfLinksHelper.is_a_number?(params[:dmsf_link][:target_folder_id]) ? params[:dmsf_link][:target_folder_id].to_i : nil
@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
# 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?
@ -43,25 +48,51 @@ class DmsfLinksController < ApplicationController
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
# 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]
@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'
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

View File

@ -205,10 +205,6 @@ class DmsfFileRevision < ActiveRecord::Base
end
end
def display_title
return self.title
end
def new_storage_filename
raise DmsfAccessError, 'File id is not set' unless self.file.id
filename = DmsfHelper.sanitize_filename(self.name)

View File

@ -1,6 +1,6 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2014 Karel Pičman <karel.picman@lbcfree.net>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@lbcfree.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -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

View File

@ -29,7 +29,6 @@ class DmsfMailer < Mailer
redmine_headers 'Project' => project.identifier if project
@user = user
@files = files
@project = project
@ -46,7 +45,6 @@ class DmsfMailer < Mailer
redmine_headers 'Project' => project.identifier if project
@user = user
@files = files
@project = project

View File

@ -21,11 +21,11 @@
<% locked_for_user = subfolder.locked_for_user? %>
<% locked = subfolder.locked? %>
<td class="check"><%= check_box_tag(link ? 'dir_links[]' : 'subfolders[]',
link ? link.id : subfolder.id, false, :title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="check"><%= check_box_tag(name, id, false,
:title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="title">
<%= 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') %>
<div class="filename" title="<%= l(:title_number_of_files_in_directory)%>">[<%= subfolder.files.visible.count %>]</div>
</td>
@ -54,21 +54,21 @@
<div class="right_icon_box">
<% 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 @@
<span class="icon"></span>
<% 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 %>

View File

@ -1,7 +1,7 @@
<%#=
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2014 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
#
# 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) %>
<td class="check"><%= check_box_tag(link ? 'file_links[]' : 'files[]',
link ? link.id : file.id, false, :title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="check"><%= check_box_tag(name, id, false,
:title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="title">
<% 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',

View File

@ -37,6 +37,10 @@
: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 => @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),

View File

@ -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 @@
<tbody>
<% @subfolders.each do |subfolder| %>
<tr class="dir">
<%= 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 }) %>
</tr>
<% end %>
<% @dir_links.each do |link| %>
<tr class="gray">
<%= 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 }) %>
</tr>
<% end %>
<% @files.each do |file| %>
@ -145,7 +159,13 @@
<% next %>
<% end %>
<tr class="file">
<%= 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 }) %>
</tr>
<% end %>
<% @file_links.each do |link| %>
@ -154,7 +174,13 @@
<% next %>
<% end %>
<tr class="gray">
<%= 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 }) %>
</tr>
<% end %>
</tbody>

View File

@ -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 %>

View File

@ -1,6 +1,6 @@
<%# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2014 Karel Pičman <karel.picman@lbcfree.net>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@lbcfree.net>
#
# 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 @@
<div class="contextual">
</div>
<%= 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 %>
<div class="box dmsf_detail">
<p>
<%= 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}) %>
:selected => @dmsf_link.target_project)) %>
</p>
<p>
<%= f.select(:target_folder_id,
<% 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),
{:required => true}) %>
:selected => target_folder_id)) %>
</p>
<% if type == 'link_from' %>
<p>
<% 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)) %>
</p>
<% end %>
<p>
<%= 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)) %>
</p>
<p>
<%= f.text_field :name, :size => 40, :maxlength => 255, :required => true, :value => @dmsf_link.name %>
<%= label_tag('dmsf_link[name]', l(:label_link_name), :class => 'required') %>
<%= text_field_tag 'dmsf_link[name]', @dmsf_link.name, :size => 40, :maxlength => 255 %>
</p>
</div>
<%= f.submit l(:button_create) %>
@ -56,9 +81,9 @@
<script type="text/javascript">
$('#dmsf_link_target_project_id').change(function () {
$('#content').load("<%= url_for(:action => 'new', :project_id => @project.id, :dmsf_folder_id => @dmsf_link.dmsf_folder_id, :reload => true) %>", $('#new_dmsf_link').serialize());
$('#content').load("<%= url_for(:action => 'new', :project_id => @project.id, :reload => true) %>", $('#new_dmsf_link').serialize());
});
$('#dmsf_link_target_folder_id').change(function () {
$('#content').load("<%= url_for(:action => 'new', :project_id => @project.id, :dmsf_folder_id => @dmsf_link.dmsf_folder_id) %>", $('#new_dmsf_link').serialize());
$('#content').load("<%= url_for(:action => 'new', :project_id => @project.id) %>", $('#new_dmsf_link').serialize());
});
</script>

View File

@ -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| %>
<p>

View File

@ -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 %>

View File

@ -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| %>
<p>

View File

@ -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 %>),

View File

@ -62,7 +62,7 @@
<%= link_to_project(file.project) %>
</td>
<td class="title">
<%= 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)}") %>
</td>

View File

@ -55,7 +55,7 @@
</td>
<td class="title">
<% 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 %>
</td>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

View File

@ -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); }
@ -353,3 +357,8 @@ 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; }
label.required:after {
content: " *";
color: #bb0000;
}

View File

@ -1,7 +1,8 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2013 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
#
#
# 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

View File

@ -1,7 +1,8 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Terrence Miller
# Copyright (C) 2013 Christian Wetting <christian.wetting@kontron.com>
# Copyright (C) 2011 Terrence Miller
# Copyright (C) 2013 Christian Wetting <christian.wetting@kontron.com>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
#
# 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
@ -216,8 +218,6 @@ de:
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
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
@ -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:

View File

@ -1,8 +1,8 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2013 karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -111,7 +111,6 @@ en:
label_changed: Changed
info_changed_by_user: "%{changed} by"
label_filename: Filename
label_approval_workflow: Workflow
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

View File

@ -2,6 +2,8 @@
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
#
#
#
# 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
@ -52,8 +54,6 @@ es:
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
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
@ -292,6 +300,5 @@ es:
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.

View File

@ -2,7 +2,7 @@
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2013 karel Pičman <karel.picman@kontron.com>
# 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
@ -111,7 +111,6 @@ fr:
label_changed: Modifié
info_changed_by_user: "%{changed} par"
label_filename: Fichier
label_approval_workflow: Flux de validation
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

View File

@ -2,6 +2,8 @@
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
#
#
#
# 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
@ -191,8 +193,6 @@ ja:
error_folder_cannot_be_copied: フォルダをコピーできません
notice_folder_copied: フォルダをコピーしました
# Not translated
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."
label_maximum_email_filesize: "Maximum email attachment size"
@ -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

View File

@ -2,6 +2,8 @@
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
#
#
#
# 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
@ -216,8 +218,6 @@ ru:
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

View File

@ -2,6 +2,8 @@
#
# Copyright (C) 2011 <zdravko.balorda@mks.si>
#
#
#
# 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
@ -174,7 +176,6 @@ sl:
label_dmsf_updated: Arhiv posodobljen
title_total_size_of_all_files: Skupna velikost vseh datotek v tej mapi
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
@ -217,7 +218,6 @@ sl:
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

View File

@ -2,6 +2,8 @@
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
#
#
#
# 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
@ -174,9 +176,6 @@ zh:
label_dmsf_updated: DMSF updated
title_total_size_of_all_files: 文件夹所有文件总大小
project_module_dmsf: 文档管家
# Not translated
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

View File

@ -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

View File

@ -26,44 +26,64 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase
def setup
@user_admin = User.find_by_id 1
@user_member = User.find_by_id 2
assert_not_nil @user_member
@user_non_member = User.find_by_id 3
@project1 = Project.find_by_id 1
assert_not_nil @project1
@project1.enable_module! :dmsf
@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'
end
# Non member
def test_authorize_non_member
@request.session[:user_id] = @user_non_member.id
get :new, :project_id => @project1.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
@ -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