<% 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)}')",
:title => l(:title_notifications_active_deactivate)) %>
<% 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)}')",
:title => l(:title_notifications_not_active_activate)) %>
<% end %>
@@ -154,25 +153,25 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
<% end %>
- <%= 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 },
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
<% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%>
<% 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)}')",
:title => l(:title_unlock_file)) %>
<% 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)}')",
:title => l(:title_lock_file)) %>
<% end %>
<% end %>
<% 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)}')",
:title => l(:title_delete)) %>
<% end %>
@@ -192,7 +191,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
@@ -194,4 +194,4 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
jQuery("#manipulation_form").submit();
};
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb
index 8f2d8248..38a1532b 100644
--- a/app/views/dmsf_upload/upload_files.html.erb
+++ b/app/views/dmsf_upload/upload_files.html.erb
@@ -13,11 +13,9 @@
<%=l(:heading_uploaded_files)%>
-<%
-i = 1
-form_tag({:action => "commit_files", :id => @project, :folder_id => @folder},
- :method=>:post) do
-%>
+<% i = 1 %>
+<%= form_tag({:action => "commit_files", :id => @project, :folder_id => @folder},
+ :method=>:post) do %>
<% @uploads.each do |upload| %>
<% if upload.locked %>
<%= 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() {
});
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 9afd3f5c..ba5f5f39 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -16,7 +16,36 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-ActionController::Routing::Routes.draw do |map|
- map.resources :dmsf
- map.resources :dmsf_files
+#ActionController::Routing::Routes.draw do |map|
+RedmineApp::Application.routes.draw do
+# 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
diff --git a/init.rb b/init.rb
index 8fd997d0..89723de1 100644
--- a/init.rb
+++ b/init.rb
@@ -17,18 +17,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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)
ProjectsHelper.send(:include, ProjectTabsExtended)
- end
+ end
unless CustomFieldsHelper.included_modules.include?(CustomFieldsHelper)
CustomFieldsHelper.send(:include, RedmineDmsf::Patches::CustomFieldsHelper)
end
Project.send(:include, RedmineDmsf::Patches::ProjectPatch)
+ STDOUT.puts "PATCHES SENT\n"
+ STDOUT.flush
end
Redmine::Plugin.register :redmine_dmsf do
@@ -46,9 +49,9 @@ Redmine::Plugin.register :redmine_dmsf do
"dmsf_max_file_upload" => "0",
"dmsf_max_file_download" => "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_index_database" => "#{RAILS_ROOT}/files/dmsf_index",
+ "dmsf_index_database" => Rails.root.join("files/dmsf_index").to_s,
"dmsf_stemming_lang" => "english",
"dmsf_stemming_strategy" => "STEM_NONE"
}
diff --git a/lib/redmine_dmsf/patches/acts_as_customizable.rb b/lib/redmine_dmsf/patches/acts_as_customizable.rb
index fbc859dd..88a24625 100644
--- a/lib/redmine_dmsf/patches/acts_as_customizable.rb
+++ b/lib/redmine_dmsf/patches/acts_as_customizable.rb
@@ -1,16 +1,16 @@
module Redmine
- module Acts
- module Customizable
- module InstanceMethods
- def available_custom_fields
- cf_classname = self.class.name == 'DmsfFolder' ? 'DmsfFileRevision' : self.class.name
- CustomField.find(:all, :conditions => "type = '#{cf_classname}CustomField'", :order => 'position')
- end
+ module Acts
+ module Customizable
+ module InstanceMethods
+ def available_custom_fields
+ cf_classname = self.class.name == 'DmsfFolder' ? 'DmsfFileRevision' : self.class.name
+ CustomField.find(:all, :conditions => "type = '#{cf_classname}CustomField'", :order => 'position')
+ end
- def show_custom_field_values
- custom_field_values.delete_if { |x| (!x.id && x.id.blank?) || x.value.blank? }
- end
- end
- end
- end
-end
\ No newline at end of file
+ def show_custom_field_values
+ custom_field_values.delete_if { |x| (!x.id && x.id.blank?) || x.value.blank? }
+ end
+ end
+ end
+ end
+end
diff --git a/lib/redmine_dmsf/patches/project_patch.rb b/lib/redmine_dmsf/patches/project_patch.rb
index d200430d..59114331 100644
--- a/lib/redmine_dmsf/patches/project_patch.rb
+++ b/lib/redmine_dmsf/patches/project_patch.rb
@@ -1,9 +1,21 @@
+require_dependency 'project'
module RedmineDmsf
- module Patches
- module ProjectPatch
- def all_dmsf_custom_fields
- @all_dmsf_custom_fields ||= (DmsfFileRevisionCustomField.for_all + dmsf_file_revision_custom_fields).uniq.sort
- end
- end
- end
-end
\ No newline at end of file
+ module Patches
+ module ProjectPatch
+
+ def self.included(base) # :nodoc:
+ base.send(:include, InstanceMethods)
+ base.extend(ClassMethods)
+ 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