First pass of Redmine 2.0 compatibility (NOT WORKING)

This commit is contained in:
Daniel Munn 2012-06-03 11:22:58 +01:00
parent d2cb53a027
commit 5de5804f0d
14 changed files with 122 additions and 77 deletions

View File

@ -24,10 +24,10 @@ class DmsfController < ApplicationController
before_filter :find_folder, :except => [:new, :create, :edit_root, :save_root] before_filter :find_folder, :except => [:new, :create, :edit_root, :save_root]
before_filter :find_parent, :only => [:new, :create] before_filter :find_parent, :only => [:new, :create]
verify :method => :post, :only => [:delete_entries, :create, :save, :delete, :save_root, :notify_activate, :notify_deactivate], # verify :method => :post, :only => [:delete_entries, :create, :save, :delete, :save_root, :notify_activate, :notify_deactivate],
:render => { :nothing => true, :status => :method_not_allowed } # :render => { :nothing => true, :status => :method_not_allowed }
helper :all helper :all
def show def show
if @folder.nil? if @folder.nil?

View File

@ -25,11 +25,11 @@ class DmsfFilesController < ApplicationController
before_filter :find_revision, :only => [:delete_revision] before_filter :find_revision, :only => [:delete_revision]
before_filter :authorize before_filter :authorize
verify :method => :post, :only => [:create_revision, :delete_revision, :delete, :lock, :unlock, :notify_activate, :notify_deactivate], # verify :method => :post, :only => [:create_revision, :delete_revision, :delete, :lock, :unlock, :notify_activate, :notify_deactivate],
:render => { :nothing => true, :status => :method_not_allowed } # :render => { :nothing => true, :status => :method_not_allowed }
helper :all
helper :all
def show def show
# download is put here to provide more clear and usable links # download is put here to provide more clear and usable links
if params.has_key?(:download) if params.has_key?(:download)

View File

@ -24,10 +24,10 @@ class DmsfFilesCopyController < ApplicationController
before_filter :find_file before_filter :find_file
before_filter :authorize before_filter :authorize
verify :method => :post, :only => [:create, :move], :render => { :nothing => true, :status => :method_not_allowed } # verify :method => :post, :only => [:create, :move], :render => { :nothing => true, :status => :method_not_allowed }
helper :all
helper :all
def new def new
@target_project = DmsfFile.allowed_target_projects_on_copy.detect {|p| p.id.to_s == params[:target_project_id]} if params[:target_project_id] @target_project = DmsfFile.allowed_target_projects_on_copy.detect {|p| p.id.to_s == params[:target_project_id]} if params[:target_project_id]
@target_project ||= @project if User.current.allowed_to?(:file_manipulation, @project) @target_project ||= @project if User.current.allowed_to?(:file_manipulation, @project)

View File

@ -25,8 +25,8 @@ class DmsfUploadController < ApplicationController
before_filter :authorize before_filter :authorize
before_filter :find_folder, :except => [:upload_file] before_filter :find_folder, :except => [:upload_file]
verify :method => :post, :only => [:upload_files, :upload_file, :commit_files], # verify :method => :post, :only => [:upload_files, :upload_file, :commit_files],
:render => { :nothing => true, :status => :method_not_allowed } # :render => { :nothing => true, :status => :method_not_allowed }
helper :all helper :all

View File

@ -59,5 +59,9 @@ module DmsfHelper
return Redmine::MimeType.css_class_of(filename) return Redmine::MimeType.css_class_of(filename)
end end
end end
def plugin_asset_path(plugin, asset_type, source)
return "/plugin_assets/#{plugin}/#{asset_type}/#{source}"
end
end end

View File

@ -1,5 +1,5 @@
<div class="box"> <div class="box">
<% form_tag({:controller => "dmsf_upload", :action => "upload_files", :id => @project, :folder_id => @folder}, <%= form_tag({:controller => "dmsf_upload", :action => "upload_files", :id => @project},
:id => "uploadform", :method=>:post, :multipart => true) do %> :id => "uploadform", :method=>:post, :multipart => true) do %>
<% if Setting.attachment_max_size.to_i >= 102400 %> <% if Setting.attachment_max_size.to_i >= 102400 %>
<div class="upload_select"> <div class="upload_select">
@ -79,7 +79,7 @@
uploader = jQuery("div",uploader); uploader = jQuery("div",uploader);
uploader.plupload({ uploader.plupload({
runtimes : 'html5,flash,html4', runtimes : 'html5,flash,html4',
url : '<%= url_for({:controller => "dmsf_upload", :action => "upload_file", :id => @project, :folder_id => @folder}) %>', url : '<%= url_for({:controller => "dmsf_upload", :action => "upload_file", :id => @project}) %>',
max_file_size : "100mb", max_file_size : "100mb",
max_file_count: '<%= Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i if Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i > 0 %>', max_file_count: '<%= Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i if Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i > 0 %>',
multipart: true, multipart: true,
@ -89,7 +89,7 @@
rename: true, rename: true,
// Flash settings // Flash settings
flash_swf_url : '<%= Engines::RailsExtensions::AssetHelpers.plugin_asset_path("redmine_dmsf", "javascripts", "plupload/plupload.flash.swf") %>' flash_swf_url : '<%= plugin_asset_path(:redmine_dmsf, "javascripts", "plupload/plupload.flash.swf") %>'
}); });
jQuery(".plupload_scroll",uploader).resizable({ jQuery(".plupload_scroll",uploader).resizable({
handles: "s" handles: "s"

View File

@ -3,8 +3,9 @@
<div class="contextual"> <div class="contextual">
<% if User.current.allowed_to?(:folder_manipulation, @project) %> <% if User.current.allowed_to?(:folder_manipulation, @project) %>
<% if @folder.nil? %> <% if @folder.nil? %>
<%= link_to("", {:action => "edit_root", :id => @project}, <%= link_to("", :method => :edit_root, :title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") %> &nbsp;
:title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") %> &nbsp; <!-- = link_to("", {:resources => :dmsf, :action => "edit_root", :id => @project},
:title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") --> &nbsp;
<% else @folder.nil? %> <% else @folder.nil? %>
<%= link_to("", {:action => "edit", :id => @project, :folder_id => @folder }, <%= link_to("", {:action => "edit", :id => @project, :folder_id => @folder },
:title => l(:link_edit, :title => h(@folder.title)), :class => "icon icon-edit") %> &nbsp; :title => l(:link_edit, :title => h(@folder.title)), :class => "icon icon-edit") %> &nbsp;
@ -25,10 +26,8 @@
</div> </div>
<%= render "custom_fields", :object => @folder %> <%= render "custom_fields", :object => @folder %>
</div> </div>
<% <%= form_tag({:method => :entries_operation, :id => @project, :folder_id => @folder}, :method => :post,
form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder}, :method => :post, :class => "dmfs_entries", :id => "entries_form") do %>
:class => "dmfs_entries", :id => "entries_form") do
%>
<%= hidden_field_tag("action") %> <%= hidden_field_tag("action") %>
<div class="controls" style="float: left"> <div class="controls" style="float: left">
<%= submit_tag(l(:submit_download), :title => l(:title_download_checked), :name => "download_entries") %> <%= submit_tag(l(:submit_download), :title => l(:title_download_checked), :name => "download_entries") %>
@ -72,11 +71,11 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<% if User.current.allowed_to?(:file_approval, @project) %> <% if User.current.allowed_to?(:file_approval, @project) %>
<div class="right_icon_box"> <div class="right_icon_box">
<% if subfolder.notification %> <% if subfolder.notification %>
<%= link_to_function(image_tag("notify.png", :plugin => "redmine_dmsf"), <%= link_to_function(image_tag("notify.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project, :folder_id => subfolder)}')", "manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project, :folder_id => subfolder)}')",
:title => l(:title_notifications_active_deactivate)) %> :title => l(:title_notifications_active_deactivate)) %>
<% else %> <% else %>
<%= link_to_function(image_tag("notifynot.png", :plugin => "redmine_dmsf"), <%= link_to_function(image_tag("notifynot.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')", "manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
:title => l(:title_notifications_not_active_activate)) %> :title => l(:title_notifications_not_active_activate)) %>
<% end %> <% end %>
@ -91,7 +90,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
</div> </div>
<% end %> <% end %>
<div style="float: right"> <div style="float: right">
<%= link_to_function(image_tag("delete.png", :plugin => "redmine_dmsf"), <%= 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)}')", "confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}')",
:title => l(:title_delete))%> :title => l(:title_delete))%>
</div> </div>
@ -119,12 +118,12 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<td class="modified"> <td class="modified">
<%= file.last_revision.updated_at.strftime("%Y-%m-%d %H:%M") %> <%= file.last_revision.updated_at.strftime("%Y-%m-%d %H:%M") %>
<% if file.locked_for_user? %> <% if file.locked_for_user? %>
<%= link_to(image_tag("locked.png", :plugin => "redmine_dmsf"), <%= link_to(image_tag("locked.png", :plugin => :redmine_dmsf),
{:controller => "users", :action => "show", :id => file.locks[0].user }, {:controller => "users", :action => "show", :id => file.locks[0].user },
:title => l(:title_locked_by_user, :user => file.locks[0].user.to_s)) %> :title => l(:title_locked_by_user, :user => file.locks[0].user.to_s)) %>
<% else <% else
if file.locked? %> if file.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 %> <% end %>
<% end %> <% end %>
</td> </td>
@ -132,9 +131,9 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<%= file.last_revision.version %> <%= file.last_revision.version %>
<% case file.last_revision.workflow <% case file.last_revision.workflow
when 1 then %><%= image_tag("waitingforapproval.png", :title => l(:title_waiting_for_approval), when 1 then %><%= image_tag("waitingforapproval.png", :title => l(:title_waiting_for_approval),
:plugin => "redmine_dmsf") %> :plugin => :redmine_dmsf) %>
<% when 2 then %><%= image_tag("approved.png", :title => l(:title_approved), <% when 2 then %><%= image_tag("approved.png", :title => l(:title_approved),
:plugin => "redmine_dmsf") %> :plugin => :redmine_dmsf) %>
<% end %> <% end %>
</td> </td>
<td class="author"><%= h(file.last_revision.user) %></td> <td class="author"><%= h(file.last_revision.user) %></td>
@ -142,11 +141,11 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<% if User.current.allowed_to?(:file_approval, @project) %> <% if User.current.allowed_to?(:file_approval, @project) %>
<div class="right_icon_box"> <div class="right_icon_box">
<% if file.notification %> <% if file.notification %>
<%= link_to_function(image_tag("notify.png", :plugin => "redmine_dmsf"), <%= link_to_function(image_tag("notify.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'notify_deactivate', :id => file)}')", "manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'notify_deactivate', :id => file)}')",
:title => l(:title_notifications_active_deactivate)) %> :title => l(:title_notifications_active_deactivate)) %>
<% else %> <% else %>
<%= link_to_function(image_tag("notifynot.png", :plugin => "redmine_dmsf"), <%= link_to_function(image_tag("notifynot.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'notify_activate', :id => file)}')", "manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'notify_activate', :id => file)}')",
:title => l(:title_notifications_not_active_activate)) %> :title => l(:title_notifications_not_active_activate)) %>
<% end %> <% end %>
@ -154,25 +153,25 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<% end %> <% end %>
<div class="right_icon_box" style="width: 70px;"> <div class="right_icon_box" style="width: 70px;">
<div style="float: left"> <div style="float: left">
<%= link_to(image_tag("filedetails.png", :plugin => "redmine_dmsf", :class =>"detail_icon"), <%= link_to(image_tag("filedetails.png", :plugin => :redmine_dmsf, :class =>"detail_icon"),
{:controller => "dmsf_files", :action => :show, :id => file }, {:controller => "dmsf_files", :action => :show, :id => file },
:title => l(:link_details, :title =>h(file.last_revision.title))) %> :title => l(:link_details, :title =>h(file.last_revision.title))) %>
</div> </div>
<div style="float: right; width: 44px;"> <div style="float: right; width: 44px;">
<% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%> <% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%>
<% if file.locked? %> <% if file.locked? %>
<%= link_to_function(image_tag("unlock.png", :plugin => "redmine_dmsf"), <%= link_to_function(image_tag("unlock.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'unlock', :id => file)}')", "manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'unlock', :id => file)}')",
:title => l(:title_unlock_file)) %> :title => l(:title_unlock_file)) %>
<% else %> <% else %>
<%= link_to_function(image_tag("lock.png", :plugin => "redmine_dmsf"), <%= link_to_function(image_tag("lock.png", :plugin => :redmine_dmsf),
"manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'lock', :id => file)}')", "manipulation_link('#{url_for(:controller => "dmsf_files", :action => 'lock', :id => file)}')",
:title => l(:title_lock_file)) %> :title => l(:title_lock_file)) %>
<% end %> <% end %>
&nbsp; &nbsp;
<% end %> <% end %>
<% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %> <% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %>
<%= link_to_function(image_tag("delete.png", :plugin => "redmine_dmsf"), <%= link_to_function(image_tag("delete.png", :plugin => :redmine_dmsf),
"confirmation_link('#{url_for(:controller => "dmsf_files", :action => 'delete', :id => file)}')", "confirmation_link('#{url_for(:controller => "dmsf_files", :action => 'delete', :id => file)}')",
:title => l(:title_delete)) %> :title => l(:title_delete)) %>
<% end %> <% end %>
@ -192,7 +191,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<script type="text/javascript"> <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) %>")) { 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").attr("action", "<%= url_for(:method => :delete_entries, :id => @project, :folder_id => @folder) %>");
jQuery("#entries_form").submit(); jQuery("#entries_form").submit();
} }
}) })
@ -227,7 +226,7 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
jQuery("#browser").dataTable({ jQuery("#browser").dataTable({
"bJQueryUI": true, "bJQueryUI": true,
"oLanguage": { "oLanguage": {
'sUrl': '<%= Engines::RailsExtensions::AssetHelpers.plugin_asset_path("redmine_dmsf", "javascripts", sUrl) %>' 'sUrl': '<%= plugin_asset_path(:redmine_dmsf, 'javascripts', sUrl) %>'
}, },
"bAutoWidth": false, "bAutoWidth": false,
"bPaginate": false, "bPaginate": false,

View File

@ -17,10 +17,10 @@ if !User.current.allowed_to?(:file_approval, @project)
else else
selected_workflow = @file.last_revision.workflow selected_workflow = @file.last_revision.workflow
end end
form_for(:dmsf_file_revision, @revision, :url => {:action => "create_revision", :id => @file},
:html => {:method=>:post, :multipart => true, :id => "new_revision_form"}) do |f|
%> %>
<%= form_for(@revision, :url => {:action => "create_revision", :id => @file},
:html => {:method=>:post, :multipart => true, :id => "new_revision_form"}) do |f| %>
<div class="clear"> <div class="clear">
<div class="splitcontentleft"> <div class="splitcontentleft">
<p> <p>

View File

@ -162,7 +162,7 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
jQuery(".access-table").dataTable({ jQuery(".access-table").dataTable({
"bJQueryUI": true, "bJQueryUI": true,
"oLanguage": { "oLanguage": {
'sUrl': '<%= Engines::RailsExtensions::AssetHelpers.plugin_asset_path("redmine_dmsf", "javascripts", sUrl) %>' 'sUrl': '/plugin_assets/<%= :redmine_dmsf %>/javascripts/<%= sUrl%>'
} }
}); });
</script> </script>
@ -194,4 +194,4 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
jQuery("#manipulation_form").submit(); jQuery("#manipulation_form").submit();
}; };
</script> </script>
<% end %> <% end %>

View File

@ -13,11 +13,9 @@
</div> </div>
<h3><%=l(:heading_uploaded_files)%></h3> <h3><%=l(:heading_uploaded_files)%></h3>
<% <% i = 1 %>
i = 1 <%= form_tag({:action => "commit_files", :id => @project, :folder_id => @folder},
form_tag({:action => "commit_files", :id => @project, :folder_id => @folder}, :method=>:post) do %>
:method=>:post) do
%>
<% @uploads.each do |upload| %> <% @uploads.each do |upload| %>
<% if upload.locked %> <% if upload.locked %>
<%= render(:partial => 'upload_file_locked', :locals => {:upload => upload, :i => i}) %> <%= render(:partial => 'upload_file_locked', :locals => {:upload => upload, :i => i}) %>
@ -38,4 +36,4 @@ form_tag({:action => "commit_files", :id => @project, :folder_id => @folder},
jQuery(document).ready(function() { jQuery(document).ready(function() {
}); });
</script> </script>
<% end %> <% end %>

View File

@ -16,7 +16,36 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
ActionController::Routing::Routes.draw do |map| #ActionController::Routing::Routes.draw do |map|
map.resources :dmsf RedmineApp::Application.routes.draw do
map.resources :dmsf_files # map.resources :dmsf
# map.resources :dmsf_files
resources :dmsf
# resources :dmsf_files
post '/dmsf/:id/upload/files', :controller => 'dmsf_upload', :action => 'upload_files'
post '/dmsf/:id/upload/file', :controller => 'dmsf_upload', :action => 'upload_file'
post '/dmsf/:id/upload/commit', :controller => 'dmsf_upload', :action => 'commit_files'
#/dmsf/files - dmsf_files controller
post '/dmsf/files/:id/notify/activate', :controller => 'dmsf_files', :action => 'notify_activate'
post '/dmsf/files/:id/notify/deactivate', :controller => 'dmsf_files', :action => 'notify_deactivate'
post '/dmsf/files/:id/lock', :controller => 'dmsf_files', :action => 'lock'
post '/dmsf/files/:id/unlock', :controller => 'dmsf_files', :action => 'unlock'
post '/dmsf/files/:id/delete', :controller => 'dmsf_files', :action => 'delete'
post '/dmsf/files/:id/revision/create', :controller => 'dmsf_files', :action => 'create_revision'
post '/dmsf/files/revision/:id/delete', :controller => 'dmsf_files', :action => 'delete_revision'
get '/dmsf/files/:id/download', :controller => 'dmsf_files', :action => 'show', :download => ''
get '/dmsf/files/:id/revision/:download/download', :controller => 'dmsf_files', :action => 'show', :download => /\d*/
get '/dmsf/files/:id', :controller => 'dmsf_files', :action => 'show'
# post '/dmsf/files/:id/revision/delete'
#
# files_copy controller
##
##### POST :create, :move
get '/dmsf/files/:id/copy', :controller => 'dmsf_files_copy', :action => 'new'
end end

13
init.rb
View File

@ -17,18 +17,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'redmine' require 'redmine'
require 'dispatcher' #require 'dispatcher'
Dispatcher.to_prepare :redmine_dmsf do #Dispatcher.to_prepare :redmine_dmsf do
Rails.configuration.to_prepare do
unless ProjectsHelper.included_modules.include?(ProjectTabsExtended) unless ProjectsHelper.included_modules.include?(ProjectTabsExtended)
ProjectsHelper.send(:include, ProjectTabsExtended) ProjectsHelper.send(:include, ProjectTabsExtended)
end end
unless CustomFieldsHelper.included_modules.include?(CustomFieldsHelper) unless CustomFieldsHelper.included_modules.include?(CustomFieldsHelper)
CustomFieldsHelper.send(:include, RedmineDmsf::Patches::CustomFieldsHelper) CustomFieldsHelper.send(:include, RedmineDmsf::Patches::CustomFieldsHelper)
end end
Project.send(:include, RedmineDmsf::Patches::ProjectPatch) Project.send(:include, RedmineDmsf::Patches::ProjectPatch)
STDOUT.puts "PATCHES SENT\n"
STDOUT.flush
end end
Redmine::Plugin.register :redmine_dmsf do Redmine::Plugin.register :redmine_dmsf do
@ -46,9 +49,9 @@ Redmine::Plugin.register :redmine_dmsf do
"dmsf_max_file_upload" => "0", "dmsf_max_file_upload" => "0",
"dmsf_max_file_download" => "0", "dmsf_max_file_download" => "0",
"dmsf_max_email_filesize" => "0", "dmsf_max_email_filesize" => "0",
"dmsf_storage_directory" => "#{RAILS_ROOT}/files/dmsf", "dmsf_storage_directory" => Rails.root.join('files/dmsf').to_s, #{RAILS_ROOT}/files/dmsf",
"dmsf_zip_encoding" => "utf-8", "dmsf_zip_encoding" => "utf-8",
"dmsf_index_database" => "#{RAILS_ROOT}/files/dmsf_index", "dmsf_index_database" => Rails.root.join("files/dmsf_index").to_s,
"dmsf_stemming_lang" => "english", "dmsf_stemming_lang" => "english",
"dmsf_stemming_strategy" => "STEM_NONE" "dmsf_stemming_strategy" => "STEM_NONE"
} }

View File

@ -1,16 +1,16 @@
module Redmine module Redmine
module Acts module Acts
module Customizable module Customizable
module InstanceMethods module InstanceMethods
def available_custom_fields def available_custom_fields
cf_classname = self.class.name == 'DmsfFolder' ? 'DmsfFileRevision' : self.class.name cf_classname = self.class.name == 'DmsfFolder' ? 'DmsfFileRevision' : self.class.name
CustomField.find(:all, :conditions => "type = '#{cf_classname}CustomField'", :order => 'position') CustomField.find(:all, :conditions => "type = '#{cf_classname}CustomField'", :order => 'position')
end end
def show_custom_field_values def show_custom_field_values
custom_field_values.delete_if { |x| (!x.id && x.id.blank?) || x.value.blank? } custom_field_values.delete_if { |x| (!x.id && x.id.blank?) || x.value.blank? }
end end
end end
end end
end end
end end

View File

@ -1,9 +1,21 @@
require_dependency 'project'
module RedmineDmsf module RedmineDmsf
module Patches module Patches
module ProjectPatch module ProjectPatch
def all_dmsf_custom_fields
@all_dmsf_custom_fields ||= (DmsfFileRevisionCustomField.for_all + dmsf_file_revision_custom_fields).uniq.sort def self.included(base) # :nodoc:
end base.send(:include, InstanceMethods)
end base.extend(ClassMethods)
end end
end
module ClassMethods
end
module InstanceMethods
def all_dmsf_custom_fields
@all_dmsf_custom_fields ||= (DmsfFileRevisionCustomField.for_all).uniq.sort # + dmsf_file_revision_custom_fields).uniq.sort
end
end
end
end
end