Code revision

This commit is contained in:
Karel Picman 2013-11-12 13:44:25 +01:00
parent c0777e292e
commit dc06d7d3ae
8 changed files with 334 additions and 250 deletions

View File

@ -1,7 +1,8 @@
# -*- coding: utf-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>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -20,6 +21,10 @@
class DmsfController < ApplicationController
unloadable
class ZipMaxFilesError < StandardError; end
class EmailMaxFileSize < StandardError; end
class FileNotFound < StandardError; end
before_filter :find_project
before_filter :authorize, :except => [:delete_entries]
before_filter :find_folder, :except => [:new, :create, :edit_root, :save_root]
@ -51,44 +56,40 @@ class DmsfController < ApplicationController
if selected_folders.nil? && selected_files.nil?
flash[:warning] = l(:warning_no_entries_selected)
redirect_to :action => "show", :id => @project, :folder_id => @folder
redirect_to :action => 'show', :id => @project, :folder_id => @folder
return
end
if !params[:email_entries].blank?
if params[:email_entries].present?
email_entries(selected_folders, selected_files)
else
download_entries(selected_folders, selected_files)
end
rescue ZipMaxFilesError
flash[:error] = l(:error_max_files_exceeded, :number => Setting.plugin_redmine_dmsf["dmsf_max_file_download"].to_i.to_s)
redirect_to({:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder})
flash[:error] = l(:error_max_files_exceeded, :number => Setting.plugin_redmine_dmsf['dmsf_max_file_download'])
redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder})
rescue EmailMaxFileSize
flash[:error] = l(:error_max_email_filesize_exceeded, :number => Setting.plugin_redmine_dmsf["dmsf_max_email_filesize"].to_s)
redirect_to({:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder})
flash[:error] = l(:error_max_email_filesize_exceeded, :number => Setting.plugin_redmine_dmsf['dmsf_max_email_filesize'])
redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder})
rescue FileNotFound
render_404
rescue DmsfAccessError
render_403
end
def entries_email
@email_params = params[:email]
if @email_params["to"].strip.blank?
if @email_params['to'].strip.blank?
flash.now[:error] = l(:error_email_to_must_be_entered)
render :action => "email_entries"
render :action => 'email_entries'
return
end
DmsfMailer.send_documents(User.current, @email_params["to"], @email_params["cc"],
@email_params["subject"], @email_params["zipped_content"], @email_params["body"]).deliver
File.delete(@email_params["zipped_content"])
flash[:notice] = l(:notice_email_sent, @email_params["to"])
redirect_to({:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder})
end
class ZipMaxFilesError < StandardError
end
class EmailMaxFileSize < StandardError
end
DmsfMailer.send_documents(User.current, @email_params['to'], @email_params['cc'],
@email_params['subject'], @email_params['zipped_content'], @email_params['body']).deliver
File.delete(@email_params['zipped_content'])
flash[:notice] = l(:notice_email_sent, @email_params['to'])
redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder})
end
def delete_entries
selected_folders = params[:subfolders]
@ -99,7 +100,7 @@ class DmsfController < ApplicationController
failed_entries = []
deleted_files = []
deleted_folders = []
unless selected_folders.nil?
if selected_folders
if User.current.allowed_to?(:folder_manipulation, @project)
selected_folders.each do |subfolderid|
subfolder = DmsfFolder.visible.find(subfolderid)
@ -114,11 +115,11 @@ class DmsfController < ApplicationController
flash[:error] = l(:error_user_has_not_right_delete_folder)
end
end
unless selected_files.nil?
if selected_files
if User.current.allowed_to?(:file_manipulation, @project)
selected_files.each do |fileid|
file = DmsfFile.visible.find(fileid)
next if file.nil?
next unless file
if file.project != @project || !file.delete
failed_entries.push(file)
else
@ -130,25 +131,27 @@ class DmsfController < ApplicationController
end
end
unless deleted_files.empty?
deleted_files.each {|f| log_activity(f, "deleted")}
deleted_files.each do |f|
log_activity(f, 'deleted')
end
DmsfMailer.files_deleted(User.current, deleted_files).deliver
end
if failed_entries.empty?
flash[:notice] = l(:notice_entries_deleted)
else
flash[:warning] = l(:warning_some_entries_were_not_deleted, :entries => failed_entries.map{|e| e.title}.join(", "))
flash[:warning] = l(:warning_some_entries_were_not_deleted, :entries => failed_entries.map{|e| e.title}.join(', '))
end
end
redirect_to :controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder
redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder
end
# Folder manipulation
def new
@folder = DmsfFolder.new #Bugfix form error
@folder = DmsfFolder.new
@pathfolder = @parent
render :action => "edit"
render :action => 'edit'
end
def create
@ -157,10 +160,10 @@ class DmsfController < ApplicationController
@folder.user = User.current
if @folder.save
flash[:notice] = l(:notice_folder_created)
redirect_to({:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder})
redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder})
else
@pathfolder = @parent
render :action => "edit"
render :action => 'edit'
end
end
@ -171,29 +174,29 @@ class DmsfController < ApplicationController
def save
unless params[:dmsf_folder]
redirect_to :controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder
redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder
return
end
@pathfolder = copy_folder(@folder)
@folder.attributes = params[:dmsf_folder]
if @folder.save
flash[:notice] = l(:notice_folder_details_were_saved)
redirect_to :controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder
redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder
else
render :action => "edit"
render :action => 'edit'
end
end
def delete
check_project(@delete_folder = DmsfFolder.visible.find(params[:delete_folder_id]))
if !@delete_folder.nil?
if @delete_folder
if @delete_folder.delete
flash[:notice] = l(:notice_folder_deleted)
else
flash[:error] = @delete_folder.errors[:base][0]
end
end
redirect_to :controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder
redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder
rescue DmsfAccessError
render_403
end
@ -205,7 +208,7 @@ class DmsfController < ApplicationController
@project.dmsf_description = params[:project][:dmsf_description]
@project.save!
flash[:notice] = l(:notice_folder_details_were_saved)
redirect_to :controller => "dmsf", :action => "show", :id => @project
redirect_to :controller => 'dmsf', :action => 'show', :id => @project
end
def notify_activate
@ -261,7 +264,7 @@ class DmsfController < ApplicationController
flash[:notice] = l(:notice_folder_locked)
end
redirect_to params[:current] ? params[:current] :
{:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder.folder}
{:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder}
end
def unlock
@ -278,25 +281,9 @@ class DmsfController < ApplicationController
end
end
redirect_to params[:current] ? params[:current] :
{:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder.folder}
{:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder}
end
# def assign
# end
#
# def assignment
# revision = DmsfFileRevision.find_by_id params[:dmsf_file_revision_id]
# if revision
# revision.set_workflow(params[:dmsf_workflow_id], params[:action])
# revision.assign_workflow(params[:dmsf_workflow_id])
# if request.post? && revision.save
# flash[:notice] = l(:notice_successful_create)
# end
# end
# redirect_to params[:current] ? params[:current] :
# {:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder.folder}
# end
private
def log_activity(file, action)
@ -307,31 +294,31 @@ class DmsfController < ApplicationController
zip = DmsfZip.new
zip_entries(zip, selected_folders, selected_files)
ziped_content = "#{DmsfHelper.temp_dir}/#{DmsfHelper.temp_filename("dmsf_email_sent_documents.zip")}";
ziped_content = "#{DmsfHelper.temp_dir}/#{DmsfHelper.temp_filename('dmsf_email_sent_documents.zip')}";
File.open(ziped_content, "wb") do |f|
zip_file = File.open(zip.finish, "rb")
File.open(ziped_content, 'wb') do |f|
zip_file = File.open(zip.finish, 'rb')
while (buffer = zip_file.read(8192))
f.write(buffer)
end
end
max_filesize = Setting.plugin_redmine_dmsf["dmsf_max_email_filesize"].to_f
max_filesize = Setting.plugin_redmine_dmsf['dmsf_max_email_filesize'].to_f
if max_filesize > 0 && File.size(ziped_content) > max_filesize * 1048576
raise EmailMaxFileSize
end
zip.files.each do |f|
log_activity(f,"emailing zip")
log_activity(f, 'emailing zip')
audit = DmsfFileRevisionAccess.new(:user_id => User.current.id, :dmsf_file_revision_id => f.last_revision.id,
:action => DmsfFileRevisionAccess::EmailAction)
audit.save!
end
@email_params = {"zipped_content" => ziped_content}
render :action => "email_entries"
@email_params = {'zipped_content' => ziped_content}
render :action => 'email_entries'
ensure
zip.close unless zip.nil?
zip.close if zip
end
def download_entries(selected_folders, selected_files)
@ -339,36 +326,39 @@ class DmsfController < ApplicationController
zip_entries(zip, selected_folders, selected_files)
zip.files.each do |f|
log_activity(f,"download zip")
log_activity(f, 'download zip')
audit = DmsfFileRevisionAccess.new(:user_id => User.current.id, :dmsf_file_revision_id => f.last_revision.id,
:action => DmsfFileRevisionAccess::DownloadAction)
audit.save!
end
send_file(zip.finish,
:filename => filename_for_content_disposition(@project.name + "-" + DateTime.now.strftime("%y%m%d%H%M%S") + ".zip"),
:type => "application/zip",
:disposition => "attachment")
:filename => filename_for_content_disposition("#{@project.name}-#{DateTime.now.strftime('%y%m%d%H%M%S')}.zip"),
:type => 'application/zip',
:disposition => 'attachment')
ensure
zip.close unless zip.nil?
zip.close if zip
end
def zip_entries(zip, selected_folders, selected_files)
if selected_folders && selected_folders.is_a?(Array)
selected_folders.each do |selected_folder_id|
check_project(folder = DmsfFolder.visible.find(selected_folder_id))
zip.add_folder(folder, (@folder.dmsf_path_str unless @folder.nil?)) unless folder.nil?
zip.add_folder(folder, @folder.dmsf_path_str) if folder
end
end
if selected_files && selected_files.is_a?(Array)
selected_files.each do |selected_file_id|
check_project(file = DmsfFile.visible.find(selected_file_id))
zip.add_file(file, (@folder.dmsf_path_str unless @folder.nil?)) unless file.nil?
check_project(file = DmsfFile.visible.find(selected_file_id))
if file && file.last_revision && File.exists?(file.last_revision.disk_file)
zip.add_file(file, (@folder.dmsf_path_str if @folder))
else
raise FileNotFound
end
end
end
max_files = 0
max_files = Setting.plugin_redmine_dmsf["dmsf_max_file_download"].to_i
max_files = Setting.plugin_redmine_dmsf['dmsf_max_file_download'].to_i
if max_files > 0 && zip.files.length > max_files
raise ZipMaxFilesError, zip.files.length
end
@ -381,21 +371,21 @@ class DmsfController < ApplicationController
end
def find_folder
@folder = DmsfFolder.visible.find(params[:folder_id]) if params.keys.include?("folder_id")
@folder = DmsfFolder.visible.find(params[:folder_id]) if params.keys.include?('folder_id')
check_project(@folder)
rescue DmsfAccessError
render_403
end
def find_parent
@parent = DmsfFolder.visible.find(params[:parent_id]) if params.keys.include?("parent_id")
@parent = DmsfFolder.visible.find(params[:parent_id]) if params.keys.include?('parent_id')
check_project(@parent)
rescue DmsfAccessError
render_403
end
def check_project(entry)
if !entry.nil? && entry.project != @project
if entry && entry.project != @project
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
end
end

View File

@ -1,3 +1,25 @@
<%#=
# 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>
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<% html_title(l(:dmsf)) %>
<div class="contextual">
@ -5,11 +27,11 @@
<% if @folder.nil? %>
&nbsp;
<%= link_to('', {:action => 'edit_root', :id => @project},
:title => l(:link_edit, :title => l(:link_documents)), :class => 'icon icon-edit') %>
:title => l(:link_edit, :title => l(:link_documents)), :class => 'icon icon-edit') %>
<% elsif (@folder && !@folder.locked_for_user? ) %>
&nbsp;
<%= link_to('', {:action => 'edit', :id => @project, :folder_id => @folder },
:title => l(:link_edit, :title => h(@folder.title)), :class => 'icon icon-edit') %>
:title => l(:link_edit, :title => h(@folder.title)), :class => 'icon icon-edit') %>
<% end %>
<% if @folder && (!@folder.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)) %>
<% if @folder.locked? %>
@ -56,8 +78,7 @@
<div class="dmsf-header">
<div class="wiki">
<%= textilizable(@folder ? @folder.description : @project.dmsf_description) %>
</div>
<%#= render 'custom_fields', :object => @folder %>
</div>
</div>
<%= error_messages_for('dmsf_workflow') %>
@ -68,8 +89,8 @@
<div class="controls" style="float: left">
<%= submit_tag(l(:submit_download), :title => l(:title_download_checked), :name => 'download_entries') %>
<%= submit_tag(l(:submit_email), :title => l(:title_send_checked_by_email), :name => 'email_entries') %>
<% if User.current.allowed_to?(:file_manipulation, @project) && (!@folder.nil? && !@folder.locked_for_user?) %>
<button type="button" id="entries_delete_button" title="<%=l(:title_delete_checked)%>"><%=l(:button_delete)%></button>
<% if User.current.allowed_to?(:file_manipulation, @project) && (@folder && !@folder.locked_for_user?) %>
<button type="button" id="entries_delete_button" title="<%= l(:title_delete_checked) %>"><%= l(:button_delete) %></button>
<% end %>
</div>
<table class="display entries" id="browser">
@ -92,22 +113,20 @@
<tbody>
<% @subfolders.each do |subfolder| %>
<tr class="dir">
<td class="check"><%= check_box_tag("subfolders[]", subfolder.id, false, :title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="check"><%= check_box_tag('subfolders[]', subfolder.id, false, :title => l(:title_check_for_zip_download_or_email)) %></td>
<td class="title">
<%= link_to(h(subfolder.title),
{:action => "show", :id => @project, :folder_id => subfolder},
:class => "icon icon-folder") %>
<div class="filename" title="<%= l(:title_number_of_files_in_directory)%>">[<%= subfolder.deep_file_count %>]</div>
<%#= render 'custom_fields', :object => subfolder %>
{:action => 'show', :id => @project, :folder_id => subfolder}, :class => 'icon icon-folder') %>
<div class="filename" title="<%= l(:title_number_of_files_in_directory)%>">[<%= subfolder.deep_file_count %>]</div>
</td>
<td class="size" title="<%= l(:title_total_size_of_all_files)%>"><%= number_to_human_size(subfolder.deep_size) %></td>
<td class="modified"><%= format_time(subfolder.updated_at) %>
<% if subfolder.locked_for_user? %>
<%= link_to(image_tag("locked.png", :plugin => :redmine_dmsf),
{:controller => "users", :action => "show", :id => subfolder.lock.reverse[0].user },
:title => l(:title_locked_by_user, :user => subfolder.lock.reverse[0].user.to_s)) %>
<%= link_to(image_tag('locked.png', :plugin => :redmine_dmsf),
{:controller => 'users', :action => 'show', :id => subfolder.lock.reverse[0].user },
:title => l(:title_locked_by_user, :user => subfolder.lock.reverse[0].user.to_s)) %>
<% elsif subfolder.locked? %>
<%= image_tag("lockedbycurrent.png", :title => l(:title_locked_by_you), :plugin => :redmine_dmsf) %>
<%= image_tag('lockedbycurrent.png', :title => l(:title_locked_by_you), :plugin => :redmine_dmsf) %>
<% end %>
</td>
<td class="version"></td>
@ -118,12 +137,12 @@
<div class="right_icon_box" style="width:26px;">
<% if subfolder.notification %>
<%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project, :folder_id => subfolder)}')",
:title => l(:title_notifications_active_deactivate)) %>
"manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project, :folder_id => subfolder)}')",
:title => l(:title_notifications_active_deactivate)) %>
<% else %>
<%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
:title => l(:title_notifications_not_active_activate)) %>
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
:title => l(:title_notifications_not_active_activate)) %>
<% end %>
</div>
<% end %>
@ -131,8 +150,8 @@
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
<div style="float: left">
<%= link_to(image_tag('edit.png', :class =>'detail_icon'),
{:action => 'edit', :id => @project, :folder_id => subfolder },
:title => l(:link_edit, :title => h(subfolder.title))) unless subfolder.locked_for_user? %>
{:action => 'edit', :id => @project, :folder_id => subfolder },
:title => l(:link_edit, :title => h(subfolder.title))) unless subfolder.locked_for_user? %>
</div>
<% end %>
<div style="float: right; width: 44px;">
@ -140,23 +159,24 @@
<% if subfolder.locked? %>
<% if subfolder.unlockable? %>
<%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'unlock',
:id => @project, :folder_id => subfolder)}')",
:title => l(:title_unlock_file))%>
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'unlock',
:id => @project, :folder_id => subfolder)}')",
:title => l(:title_unlock_file))%>
<% else %>
<%= image_tag('locked.png', :plugin => :redmine_dmsf, :title => l(:title_folder_parent_locked, :name => subfolder.lock.reverse[0].folder.title)) %>
<%= image_tag('locked.png', :plugin => :redmine_dmsf,
:title => l(:title_folder_parent_locked, :name => subfolder.lock.reverse[0].folder.title)) %>
<% end %>
<% else %>
<%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'lock',
:id => @project, :folder_id => subfolder)}')",
:title => l(:title_lock_file)) %>
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'lock',
:id => @project, :folder_id => subfolder)}')",
:title => l(:title_lock_file)) %>
<% end %>
&nbsp;
<% end %>
<%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
"confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}')",
:title => l(:title_delete)) unless (subfolder.locked_for_user?)%>
"confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
:title => l(:title_delete)) unless subfolder.locked_for_user? %>
</div>
</div>
<br class="clear" />
@ -177,20 +197,19 @@
<td class="title">
<% file_download_url = url_for({:only_path => false, :controller => :dmsf_files, :action => 'show', :id => file, :download => ''}) %>
<%= link_to(h(file.last_revision.display_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),
'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_download_url}") %>
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),
'data-downloadurl' => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_download_url}") %>
<div class="filename" title="<%= l(:title_filename_for_download)%>"><%= h(file.display_name) %></div>
<%#= render 'custom_fields', :object => file.last_revision %>
</td>
<td class="size"><%= number_to_human_size(file.last_revision.size) %></td>
<td class="modified">
<%= format_time(file.last_revision.updated_at) %>
<% if file.locked_for_user? %>
<%= link_to(image_tag('locked.png', :plugin => :redmine_dmsf),
{:controller => 'users', :action => 'show', :id => file.lock.reverse[0].user },
:title => l(:title_locked_by_user, :user => file.lock.reverse[0].user.to_s)) %>
{:controller => 'users', :action => 'show', :id => file.lock.reverse[0].user },
:title => l(:title_locked_by_user, :user => file.lock.reverse[0].user.to_s)) %>
<% elsif file.locked? %>
<%= image_tag('lockedbycurrent.png', :title => l(:title_locked_by_you), :plugin => :redmine_dmsf) %>
<% end %>
@ -216,12 +235,12 @@
<div class="right_icon_box" style="width:26px;">
<% if file.notification %>
<%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_deactivate', :id => file)}')",
:title => l(:title_notifications_active_deactivate)) %>
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_deactivate', :id => file)}')",
:title => l(:title_notifications_active_deactivate)) %>
<% else %>
<%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_activate', :id => file)}')",
:title => l(:title_notifications_not_active_activate)) %>
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_activate', :id => file)}')",
:title => l(:title_notifications_not_active_activate)) %>
<% end %>
<% case file.last_revision.workflow %>
<% when DmsfWorkflow::STATE_WAITING_FOR_APPROVAL %>
@ -261,50 +280,51 @@
<% else %>
<% if workflows_available %>
<%= link_to(
image_tag('none.png', :plugin => :redmine_dmsf),
assign_dmsf_workflow_path(
:project_id => @project.id,
:dmsf_file_revision_id => file.last_revision.id),
:title => l(:label_dmsf_wokflow_action_assign),
:remote => true) %>
image_tag('none.png', :plugin => :redmine_dmsf),
assign_dmsf_workflow_path(
:project_id => @project.id,
:dmsf_file_revision_id => file.last_revision.id),
:title => l(:label_dmsf_wokflow_action_assign),
:remote => true) %>
<% end %>
<% end %>
</div>
<% end %>
<div class="right_icon_box" style="width: 70px">
<div style="float: left">
<%= link_to(image_tag('filedetails.png', :plugin => :redmine_dmsf, :class =>"detail_icon"),
{:controller => "dmsf_files", :action => :show, :id => file },
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
<%= link_to(image_tag('filedetails.png', :plugin => :redmine_dmsf, :class =>'detail_icon'),
{:controller => "dmsf_files", :action => :show, :id => file },
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
</div>
<div style="float: right; width: 44px;">
<% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%>
<% if file.locked? %>
<% if file.unlockable? %>
<%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'unlock', :id => file)}')",
:title => l(:title_unlock_file))%>
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'unlock', :id => file)}')",
:title => l(:title_unlock_file))%>
<% else %>
<%= image_tag('locked.png', :plugin => :redmine_dmsf, :title => l(:title_file_parent_locked, :name => file.folder.lock.reverse[0].folder.title)) %>
<%= image_tag('locked.png', :plugin => :redmine_dmsf,
:title => l(:title_file_parent_locked, :name => file.folder.lock.reverse[0].folder.title)) %>
<% end%>
<% else %>
<%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'lock', :id => file)}')",
:title => l(:title_lock_file)) %>
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'lock', :id => file)}')",
:title => l(:title_lock_file)) %>
<% end %>
&nbsp;
<% end %>
<% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %>
<%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
"confirmation_link('#{url_for(:controller => 'dmsf_files', :action => 'delete', :id => file)}')",
:title => l(:title_delete)) %>
"confirmation_link('#{url_for(:controller => 'dmsf_files', :action => 'delete', :id => file)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
:title => l(:title_delete)) %>
<% end %>
</div>
</div>
<br class="clear" />
</td>
<td class="hidden">1</td>
<td class="hidden"><%= file.last_revision.size %></td>
<td class="hidden"><%= file.last_revision.size %></td>
</tr>
<% end %>
</tbody>
@ -313,91 +333,80 @@
<% end %>
<script type="text/javascript">
jQuery("#entries_delete_button").click(function(event) {
jQuery('#entries_delete_button').click(function(event) {
if(window.confirm("<%= l(:question_do_you_really_want_to_delete_entries) %>")) {
jQuery("#entries_form").attr("action", "<%= url_for(:action => :delete_entries, :id => @project, :folder_id => @folder) %>");
jQuery("#entries_form").submit();
jQuery('#entries_form').attr('action', "<%= url_for(:action => :delete_entries, :id => @project, :folder_id => @folder) %>");'
jQuery('#entries_form').submit();
}
});
jQuery("#check_all_entries").click(function(event) {
jQuery('#check_all_entries').click(function(event) {
var $this = jQuery(this);
if($this.prop("checked")) {
jQuery("input[type=checkbox]", jQuery("#browser > tbody")).prop("checked", true);
if($this.prop('checked')) {
jQuery('input[type=checkbox]', jQuery('#browser > tbody')).prop('checked', true);
} else {
jQuery("input[type=checkbox]", jQuery("#browser > tbody")).prop("checked", false);
jQuery('input[type=checkbox]', jQuery('#browser > tbody')).prop('checked', false);
}
});
</script>
<%
sUrl = "jquery.dataTables/en.json"
sUrl = 'jquery.dataTables/en.json'
sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !I18n.locale.to_s.match(/^en.*/)
%>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "jquery-ui/jquery-ui-1.9.2.css", :plugin => "redmine_dmsf" %>
<%= stylesheet_link_tag "plupload/jquery.ui.plupload.css", :plugin => "redmine_dmsf" %>
<%= stylesheet_link_tag "jquery.dataTables/jquery-ui.dataTables.css", :plugin => "redmine_dmsf" %>
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
<%= stylesheet_link_tag 'jquery-ui/jquery-ui-1.9.2.css', :plugin => 'redmine_dmsf' %>
<%= stylesheet_link_tag 'plupload/jquery.ui.plupload.css', :plugin => 'redmine_dmsf' %>
<%= stylesheet_link_tag 'jquery.dataTables/jquery-ui.dataTables.css', :plugin => 'redmine_dmsf' %>
<%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag "jquery-1.6.1.min.js", :plugin => "redmine_dmsf" %>
<%= javascript_include_tag "jquery-ui-1.8.13.min.js", :plugin => "redmine_dmsf" %>
<%= javascript_include_tag "jquery.dataTables/jquery.dataTables.min.js", :plugin => "redmine_dmsf" %>
<%= javascript_include_tag 'jquery-1.6.1.min.js', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery-ui-1.8.13.min.js', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery("#browser").dataTable({
"bJQueryUI": true,
"oLanguage": {
'sUrl': '<%= plugin_asset_path(:redmine_dmsf, 'javascripts', sUrl) %>'
jQuery('#browser').dataTable({
'bJQueryUI': true,
'oLanguage': {
'sUrl': "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', sUrl) %>"
},
"bAutoWidth": false,
"bPaginate": false,
"aaSorting": [[1,'asc']],
"aaSortingFixed": [[8,'asc']],
"aoColumnDefs": [
{ "bSearchable": false, "aTargets": [0, 7, 8, 9] },
{ "bSortable": false, "aTargets": [0, 7, 8] },
{ "iDataSort": 9, "aTargets": [ 2 ] }
'bAutoWidth': false,
'bPaginate': false,
'aaSorting': [[1,'asc']],
'aaSortingFixed': [[8,'asc']],
'aoColumnDefs': [
{ 'bSearchable': false, 'aTargets': [0, 7, 8, 9] },
{ 'bSortable': false, 'aTargets': [0, 7, 8] },
{ 'iDataSort': 9, 'aTargets': [ 2 ] }
],
"fnInitComplete": function() {
jQuery("div.controls").prependTo(jQuery("#browser_wrapper div.fg-toolbar")[0]);
'fnInitComplete': function() {
jQuery('div.controls').prependTo(jQuery('#browser_wrapper div.fg-toolbar')[0]);
},
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
'fnInfoCallback': function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
return "<%= l(:label_number_of_folders)%>: <%= @subfolders.length %>, <%= l(:label_number_of_documents)%>: <%= @files.length %>";
}
});
jQuery("[data-downloadurl]").each(function() {
var url = this.getAttribute("data-downloadurl");
jQuery('[data-downloadurl]').each(function() {
var url = this.getAttribute('data-downloadurl');
if (this.addEventListener) {
this.addEventListener("dragstart", function(e) {
this.addEventListener('dragstart', function(e) {
if (e.dataTransfer) {
e.dataTransfer.setData("DownloadURL", url);
e.dataTransfer.setData('DownloadURL', url);
}
},false);
}
});
jQuery("#entries_form").submit(function () {
jQuery('#entries_form').submit(function () {
jQuery(this).removeAttr('data-submitted');
});
});
function manipulation_link(action) {
jQuery("#entries_form").attr("action", action);
jQuery("#entries_form").submit();
};
function confirmation_link(action) {
if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_entry) %>")) return;
jQuery("#entries_form").attr("action", action);
jQuery("#entries_form").submit();
};
});
</script>
<% end %>
<%= render(:partial => 'multi_upload') if (User.current.allowed_to?(:file_manipulation, @project) &&
(@folder.nil? || (!@folder.nil? &&!@folder.locked_for_user?))) %>
(@folder.nil? || (@folder && !@folder.locked_for_user?))) %>
<br/>

View File

@ -1,3 +1,25 @@
<%#=
# 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>
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<% html_title(l(:dmsf)) %>
<div class="contextual">
@ -8,36 +30,36 @@
<%= image_tag('locked.png', :plugin => :redmine_dmsf, :title => l(:title_file_parent_locked, :name => @file.lock.reverse[0].folder.title)) %>
<% else %>
<%= link_to_function(image_tag('unlock.png', :plugin => 'redmine_dmsf'),
"manipulation_link('#{url_for(:action => 'unlock', :id => @file, :current => request.url)}')",
:title => l(:title_unlock_file)) %>
"manipulation_link('#{url_for(:action => 'unlock', :id => @file, :current => request.url)}')",
:title => l(:title_unlock_file)) %>
<% end %>
<% else %>
<%= link_to_function(image_tag('lock.png', :plugin => 'redmine_dmsf'),
"manipulation_link('#{url_for(:action => 'lock', :id => @file, :current => request.url)}')",
:title => l(:title_lock_file)) %>
"manipulation_link('#{url_for(:action => 'lock', :id => @file, :current => request.url)}')",
:title => l(:title_lock_file)) %>
<% end %>
<% end %>
<% if User.current.allowed_to?(:file_manipulation, @project) && !@file.locked_for_user? %>
&nbsp;
<%= link_to_function(image_tag('delete.png', :plugin => 'redmine_dmsf'),
"confirmation_link('#{url_for(:action => 'delete', :id => @file)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
:title => l(:title_delete)) %>
"confirmation_link('#{url_for(:action => 'delete', :id => @file)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
:title => l(:title_delete)) %>
<% end %>
<% if User.current.allowed_to?(:file_approval, @project) %>
&nbsp;
<% if @file.notification %>
<%= link_to_function(image_tag('notify.png', :plugin => 'redmine_dmsf'),
"manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @file, :current => request.url)}')",
:title => l(:title_notifications_active_deactivate)) %>
"manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @file, :current => request.url)}')",
:title => l(:title_notifications_active_deactivate)) %>
<% else %>
<%= link_to_function(image_tag('notifynot.png', :plugin => 'redmine_dmsf'),
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @file, :current => request.url)}')",
:title => l(:title_notifications_not_active_activate)) %>
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @file, :current => request.url)}')",
:title => l(:title_notifications_not_active_activate)) %>
<% end %>
<% end %>
<% end %>
&nbsp;
<%= link_to(image_tag('copy.png'), {:controller => :dmsf_files_copy, :action => "new", :id => @file }, :title => l(:title_copy_or_move)) %>
<%= link_to(image_tag('copy.png'), {:controller => :dmsf_files_copy, :action => 'new', :id => @file }, :title => l(:title_copy_or_move)) %>
</div>
<h2>
@ -54,10 +76,8 @@
<%= error_messages_for('file') %>
<%= error_messages_for('revision') %>
<%= render(:partial => 'file_new_revision') if User.current.allowed_to?(:file_manipulation, @file.project) %>
<%= form_tag('', :id => 'manipulation_form') %>
<%= form_tag('', :id => 'entries_form') %>
<h3><%= l(:heading_revisions) %></h3>
<% @file.revisions.visible[@revision_pages.current.offset,@revision_pages.items_per_page].each do |revision| %>
@ -67,12 +87,12 @@
<div class="controls" style="float: right">
<%= link_to_function(image_tag('rev_downloads.png', :plugin => 'redmine_dmsf'), "$('#revision_access-#{revision.id}').toggle()", :title => 'Download entries')%>
<%= link_to(image_tag('rev_download.png', :plugin => 'redmine_dmsf'),
{:action => 'show', :id => @file, :download => revision},
:title => l(:title_title_version_version_download, :title => h(revision.title), :version => revision.version)) %>
{:action => 'show', :id => @file, :download => revision},
:title => l(:title_title_version_version_download, :title => h(revision.title), :version => revision.version)) %>
<% if User.current.allowed_to?(:file_approval, @project) %>
<%= link_to_function(image_tag('rev_delete.png', :plugin => 'redmine_dmsf'),
"confirmation_link('#{url_for(:action => 'delete_revision', :id => revision)}', '#{l(:question_do_you_really_want_to_delete_this_revision)}')",
:title => l(:title_delete_revision)) %>
"confirmation_link('#{url_for(:action => 'delete_revision', :id => revision)}', '#{l(:question_do_you_really_want_to_delete_this_revision)}')",
:title => l(:title_delete_revision)) %>
<% end %>
</div>
<i><%= l(:info_revision, :rev => revision.id) %></i>
@ -184,19 +204,5 @@
<%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery-1.6.1.min.js', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery-ui-1.8.13.min.js', :plugin => 'redmine_dmsf' %>
<%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %>
<script type="text/javascript">
jQuery.noConflict();
function manipulation_link(action) {
jQuery('#manipulation_form').attr('action', action);
jQuery('#manipulation_form').submit();
};
function confirmation_link(action, question) {
if(!window.confirm(question)) return;
jQuery('#manipulation_form').attr('action', action);
jQuery('#manipulation_form').submit();
};
</script>
<%= javascript_include_tag 'jquery.dataTables/jquery.dataTables.min.js', :plugin => 'redmine_dmsf' %>
<% end %>

View File

@ -0,0 +1,32 @@
/*
* Redmine plugin for Document Management System "Features"
*
* Copyright (C) 2013 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
function manipulation_link(action) {
jQuery('#entries_form').attr('action', action);
jQuery('#entries_form').submit();
};
function confirmation_link(action, question) {
if(!window.confirm(question)) {
return;
}
jQuery('#entries_form').attr('action', action);
jQuery('#entries_form').submit();
};

53
init.rb
View File

@ -23,30 +23,30 @@ require 'redmine_dmsf'
require 'zip'
Redmine::Plugin.register :redmine_dmsf do
name "DMSF"
author "Vit Jonas / Daniel Munn / Karel Picman"
description "Document Management System Features"
version "1.4.6 stable"
url "https://github.com/danmunn/redmine_dmsf"
author_url "https://code.google.com/p/redmine-dmsf/"
name 'DMSF'
author 'Vit Jonas / Daniel Munn / Karel Picman'
description 'Document Management System Features'
version '1.4.7 devel'
url 'https://github.com/danmunn/redmine_dmsf'
author_url 'https://code.google.com/p/redmine-dmsf/'
requires_redmine :version_or_higher => '2.0.3'
requires_redmine :version_or_higher => '2.3.0'
settings :partial => 'settings/dmsf_settings',
:default => {
"dmsf_max_file_upload" => "0",
"dmsf_max_file_download" => "0",
"dmsf_max_email_filesize" => "0",
"dmsf_storage_directory" => Rails.root.join('files/dmsf').to_s,
"dmsf_index_database" => Rails.root.join("files/dmsf_index").to_s,
"dmsf_stemming_lang" => "english",
"dmsf_stemming_strategy" => "STEM_NONE",
"dmsf_webdav" => "1"
'dmsf_max_file_upload' => '0',
'dmsf_max_file_download' => '0',
'dmsf_max_email_filesize' => '0',
'dmsf_storage_directory' => Rails.root.join('files/dmsf').to_s,
'dmsf_index_database' => Rails.root.join('files/dmsf_index').to_s,
'dmsf_stemming_lang' => 'english',
'dmsf_stemming_strategy' => 'STEM_NONE',
'dmsf_webdav' => '1'
}
menu :project_menu, :dmsf, { :controller => "dmsf", :action => "show" }, :caption => :menu_dmsf, :before => :documents, :param => :id
menu :project_menu, :dmsf, { :controller => 'dmsf', :action => 'show' }, :caption => :menu_dmsf, :before => :documents, :param => :id
activity_provider :dmsf_files, :class_name => "DmsfFileRevision", :default => true
activity_provider :dmsf_files, :class_name => 'DmsfFileRevision', :default => true
project_module :dmsf do
permission :view_dmsf_folders, {:dmsf => [:show], :dmsf_folders_copy => [:new, :copy_to, :move_to]}
@ -65,14 +65,7 @@ Redmine::Plugin.register :redmine_dmsf do
# Administration menu extension
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :approvalworkflows, {:controller => 'dmsf_workflows', :action => 'index'}, :caption => :label_dmsf_workflow_plural
end
# Adds stylesheet tag
class DmsfViewListener < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context)
stylesheet_link_tag('dmsf', :plugin => :redmine_dmsf)
end
end
end
Redmine::WikiFormatting::Macros.register do
desc "Wiki link to DMSF file:\n\n" +
@ -85,8 +78,8 @@ Redmine::Plugin.register :redmine_dmsf do
entry = DmsfFile.find(entry_id)
unless entry.nil? || entry.deleted
title = args[1] ? args[1] : entry.title
revision = args[2] ? args[2] : ""
return link_to "#{title}", :controller => "dmsf_files", :action => "show", :id => entry, :download => revision, :only_path => false
revision = args[2] ? args[2] : ''
return link_to "#{title}", :controller => 'dmsf_files', :action => 'show', :id => entry, :download => revision, :only_path => false
end
nil
end
@ -99,13 +92,13 @@ Redmine::Plugin.register :redmine_dmsf do
macro :dmsff do |obj, args|
if args.length < 1
return link_to l(:link_documents), :controller => "dmsf", :action => "show", :id => @project, :only_path => false
return link_to l(:link_documents), :controller => 'dmsf', :action => 'show', :id => @project, :only_path => false
else
entry_id = args[0].strip
entry = DmsfFolder.find(entry_id)
unless entry.nil?
title = args[1] ? args[1] : entry.title
return link_to "#{title}", :controller => "dmsf", :action => "show", :id => entry.project, :folder_id => entry, :only_path => false
return link_to "#{title}", :controller => 'dmsf', :action => 'show', :id => entry.project, :folder_id => entry, :only_path => false
end
end
nil
@ -123,7 +116,7 @@ Redmine::Plugin.register :redmine_dmsf do
entry = DmsfFile.find(entry_id)
unless entry.nil? || entry.deleted
title = args[1] ? args[1] : entry.title
return link_to "#{title}", :controller => "dmsf_files", :action => "show", :id => entry, :only_path => false
return link_to "#{title}", :controller => 'dmsf_files', :action => 'show', :id => entry, :only_path => false
end
nil
end

View File

@ -1,4 +1,24 @@
#Vendor
# 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>
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Vendor
require 'redmine_dmsf/vendored_dav4rack'
# DMSF libraries
@ -6,11 +26,12 @@ require 'redmine_dmsf/patches' #plugin patches
require 'redmine_dmsf/webdav' #DAV4Rack implementation
#Hooks
# Hooks
require 'redmine_dmsf/hooks/view_projects_form_hook'
require 'redmine_dmsf/hooks/base_view_hooks'
module RedmineDmsf
end
#Add plugin's view folder into ActionMailer's paths to search
# Add plugin's view folder into ActionMailer's paths to search
ActionMailer::Base.append_view_path(File.expand_path(File.dirname(__FILE__) + '/../app/views'))

View File

@ -0,0 +1,33 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2013 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
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module RedmineDmsf
module Hooks
include Redmine::Hook
class DmsfViewListener < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context={})
tags = "\n".html_safe + javascript_include_tag('redmine_dmsf', :plugin => :redmine_dmsf)
tags << "\n".html_safe + stylesheet_link_tag('dmsf', :plugin => :redmine_dmsf)
tags
end
end
end
end

View File

@ -5,7 +5,7 @@ module RedmineDmsf
def view_projects_form(context={})
context[:controller].send(:render_to_string, {
:partial => "hooks/redmine_dmsf/view_projects_form",
:partial => 'hooks/redmine_dmsf/view_projects_form',
:locals => context
})