First pass of Redmine 2.0 compatibility (NOT WORKING)
This commit is contained in:
parent
d2cb53a027
commit
5de5804f0d
@ -24,8 +24,8 @@ class DmsfController < ApplicationController
|
||||
before_filter :find_folder, :except => [:new, :create, :edit_root, :save_root]
|
||||
before_filter :find_parent, :only => [:new, :create]
|
||||
|
||||
verify :method => :post, :only => [:delete_entries, :create, :save, :delete, :save_root, :notify_activate, :notify_deactivate],
|
||||
:render => { :nothing => true, :status => :method_not_allowed }
|
||||
# verify :method => :post, :only => [:delete_entries, :create, :save, :delete, :save_root, :notify_activate, :notify_deactivate],
|
||||
# :render => { :nothing => true, :status => :method_not_allowed }
|
||||
|
||||
helper :all
|
||||
|
||||
|
||||
@ -25,8 +25,8 @@ class DmsfFilesController < ApplicationController
|
||||
before_filter :find_revision, :only => [:delete_revision]
|
||||
before_filter :authorize
|
||||
|
||||
verify :method => :post, :only => [:create_revision, :delete_revision, :delete, :lock, :unlock, :notify_activate, :notify_deactivate],
|
||||
:render => { :nothing => true, :status => :method_not_allowed }
|
||||
# verify :method => :post, :only => [:create_revision, :delete_revision, :delete, :lock, :unlock, :notify_activate, :notify_deactivate],
|
||||
# :render => { :nothing => true, :status => :method_not_allowed }
|
||||
|
||||
helper :all
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class DmsfFilesCopyController < ApplicationController
|
||||
before_filter :find_file
|
||||
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
|
||||
|
||||
|
||||
@ -25,8 +25,8 @@ class DmsfUploadController < ApplicationController
|
||||
before_filter :authorize
|
||||
before_filter :find_folder, :except => [:upload_file]
|
||||
|
||||
verify :method => :post, :only => [:upload_files, :upload_file, :commit_files],
|
||||
:render => { :nothing => true, :status => :method_not_allowed }
|
||||
# verify :method => :post, :only => [:upload_files, :upload_file, :commit_files],
|
||||
# :render => { :nothing => true, :status => :method_not_allowed }
|
||||
|
||||
helper :all
|
||||
|
||||
|
||||
@ -60,4 +60,8 @@ module DmsfHelper
|
||||
end
|
||||
end
|
||||
|
||||
def plugin_asset_path(plugin, asset_type, source)
|
||||
return "/plugin_assets/#{plugin}/#{asset_type}/#{source}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<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 %>
|
||||
<% if Setting.attachment_max_size.to_i >= 102400 %>
|
||||
<div class="upload_select">
|
||||
@ -79,7 +79,7 @@
|
||||
uploader = jQuery("div",uploader);
|
||||
uploader.plupload({
|
||||
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_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,
|
||||
@ -89,7 +89,7 @@
|
||||
rename: true,
|
||||
|
||||
// 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({
|
||||
handles: "s"
|
||||
|
||||
@ -3,8 +3,9 @@
|
||||
<div class="contextual">
|
||||
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
|
||||
<% if @folder.nil? %>
|
||||
<%= link_to("", {:action => "edit_root", :id => @project},
|
||||
:title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") %>
|
||||
<%= link_to("", :method => :edit_root, :title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") %>
|
||||
<!-- = link_to("", {:resources => :dmsf, :action => "edit_root", :id => @project},
|
||||
:title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") -->
|
||||
<% else @folder.nil? %>
|
||||
<%= link_to("", {:action => "edit", :id => @project, :folder_id => @folder },
|
||||
:title => l(:link_edit, :title => h(@folder.title)), :class => "icon icon-edit") %>
|
||||
@ -25,10 +26,8 @@
|
||||
</div>
|
||||
<%= render "custom_fields", :object => @folder %>
|
||||
</div>
|
||||
<%
|
||||
form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder}, :method => :post,
|
||||
:class => "dmfs_entries", :id => "entries_form") do
|
||||
%>
|
||||
<%= form_tag({:method => :entries_operation, :id => @project, :folder_id => @folder}, :method => :post,
|
||||
:class => "dmfs_entries", :id => "entries_form") do %>
|
||||
<%= hidden_field_tag("action") %>
|
||||
<div class="controls" style="float: left">
|
||||
<%= 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) %>
|
||||
<div class="right_icon_box">
|
||||
<% 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)}')",
|
||||
: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(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_notifications_not_active_activate)) %>
|
||||
<% end %>
|
||||
@ -91,7 +90,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
|
||||
</div>
|
||||
<% end %>
|
||||
<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)}')",
|
||||
:title => l(:title_delete))%>
|
||||
</div>
|
||||
@ -119,12 +118,12 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
|
||||
<td class="modified">
|
||||
<%= file.last_revision.updated_at.strftime("%Y-%m-%d %H:%M") %>
|
||||
<% 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 },
|
||||
:title => l(:title_locked_by_user, :user => file.locks[0].user.to_s)) %>
|
||||
<% else
|
||||
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 %>
|
||||
</td>
|
||||
@ -132,9 +131,9 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
|
||||
<%= file.last_revision.version %>
|
||||
<% case file.last_revision.workflow
|
||||
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),
|
||||
:plugin => "redmine_dmsf") %>
|
||||
:plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
</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) %>
|
||||
<div class="right_icon_box">
|
||||
<% 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 %>
|
||||
<div class="right_icon_box" style="width: 70px;">
|
||||
<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 },
|
||||
: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? %>
|
||||
<%= 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
|
||||
<script type="text/javascript">
|
||||
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").attr("action", "<%= url_for(:method => :delete_entries, :id => @project, :folder_id => @folder) %>");
|
||||
jQuery("#entries_form").submit();
|
||||
}
|
||||
})
|
||||
@ -227,7 +226,7 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
|
||||
jQuery("#browser").dataTable({
|
||||
"bJQueryUI": true,
|
||||
"oLanguage": {
|
||||
'sUrl': '<%= Engines::RailsExtensions::AssetHelpers.plugin_asset_path("redmine_dmsf", "javascripts", sUrl) %>'
|
||||
'sUrl': '<%= plugin_asset_path(:redmine_dmsf, 'javascripts', sUrl) %>'
|
||||
},
|
||||
"bAutoWidth": false,
|
||||
"bPaginate": false,
|
||||
|
||||
@ -17,10 +17,10 @@ if !User.current.allowed_to?(:file_approval, @project)
|
||||
else
|
||||
selected_workflow = @file.last_revision.workflow
|
||||
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="splitcontentleft">
|
||||
<p>
|
||||
|
||||
@ -162,7 +162,7 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
|
||||
jQuery(".access-table").dataTable({
|
||||
"bJQueryUI": true,
|
||||
"oLanguage": {
|
||||
'sUrl': '<%= Engines::RailsExtensions::AssetHelpers.plugin_asset_path("redmine_dmsf", "javascripts", sUrl) %>'
|
||||
'sUrl': '/plugin_assets/<%= :redmine_dmsf %>/javascripts/<%= sUrl%>'
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -13,11 +13,9 @@
|
||||
</div>
|
||||
|
||||
<h3><%=l(:heading_uploaded_files)%></h3>
|
||||
<%
|
||||
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}) %>
|
||||
|
||||
@ -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
|
||||
|
||||
11
init.rb
11
init.rb
@ -17,9 +17,10 @@
|
||||
# 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
|
||||
@ -29,6 +30,8 @@ Dispatcher.to_prepare :redmine_dmsf do
|
||||
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"
|
||||
}
|
||||
|
||||
@ -1,8 +1,20 @@
|
||||
require_dependency 'project'
|
||||
module RedmineDmsf
|
||||
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 + dmsf_file_revision_custom_fields).uniq.sort
|
||||
@all_dmsf_custom_fields ||= (DmsfFileRevisionCustomField.for_all).uniq.sort # + dmsf_file_revision_custom_fields).uniq.sort
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user