Redmine 2.0 compatibility (EOD commit) - not fully functional however starting to resemble working plugin

Todo: Mailcontroller
Todo: Rest of routing
This commit is contained in:
Daniel Munn 2012-06-03 15:33:28 +01:00
parent 021440fa78
commit eb457323ef
9 changed files with 58 additions and 20 deletions

View File

@ -144,6 +144,7 @@ class DmsfController < ApplicationController
# Folder manipulation
def new
@folder = DmsfFolder.new #Bugfix form error
@pathfolder = @parent
render :action => "edit"
end

View File

@ -24,7 +24,7 @@ class DmsfFoldersCopyController < ApplicationController
before_filter :find_folder
before_filter :authorize
verify :method => :post, :only => [:copy_to], :render => { :nothing => true, :status => :method_not_allowed }
# verify :method => :post, :only => [:copy_to], :render => { :nothing => true, :status => :method_not_allowed }
def new
@target_project = DmsfFolder.allowed_target_projects_on_copy.detect {|p| p.id.to_s == params[:target_project_id]} if params[:target_project_id]

View File

@ -1,5 +1,5 @@
<div class="box">
<%= form_tag({:controller => "dmsf_upload", :action => "upload_files", :id => @project},
<%= form_tag({:controller => "dmsf_upload", :action => "upload_files", :id => @project, :folder_id => @folder},
:id => "uploadform", :method=>:post, :multipart => true) do %>
<% if Setting.attachment_max_size.to_i >= 102400 %>
<div class="upload_select">

View File

@ -1,18 +1,20 @@
<% html_title(l(:dmsf)) %>
<div class="contextual">
<%= link_to(image_tag("copy.png"), {:controller => :dmsf_folders_copy, :action => "new", :id => @folder }, :title => l(:title_copy)) %>
<%= link_to(image_tag("copy.png"), {:controller => :dmsf_folders_copy, :action => "new", :id => @folder }, :title => l(:title_copy)) unless @folder.id.nil? %>
</div>
<% create = @pathfolder == @parent %>
<%
create = @pathfolder == @parent
%>
<h2>
<%= render(:partial => "path", :locals => {:path => @pathfolder.nil? ? [] : @pathfolder.dmsf_path}) %>
<%= ("/ " + l(:heading_new_folder)) if create %>
</h2>
<% form_for(:dmsf_folder, @folder, :url => {:action => create ? "create" : "save", :id => @project, :folder_id => @folder, :parent_id => @parent},
<%= form_for(@folder, :url => {:action => create ? "create" : "save", :id => @project, :folder_id => @folder, :parent_id => @parent},
:html => {:method=>:post}) do |f| %>
<%= error_messages_for("folder") %>
<%= error_messages_for(@folder) %>
<div class="box dmsf_detail">
<div class="clear">
<div class="splitcontentleft">

View File

@ -5,7 +5,7 @@
<h2><%= render(:partial => "path", :locals => {:path => []}) %></h2>
<% form_for(:project, @project, :url => {:action => "save_root", :id => @project},
<%= form_for(@project, :url => {:action => "save_root", :id => @project},
:html => {:method=>:post}) do |f| %>
<div class="box dmsf_detail">
<p class="no-ident">

View File

@ -3,9 +3,8 @@
<div class="contextual">
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
<% if @folder.nil? %>
<%= link_to("", :method => :edit_root, :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;
<%= link_to("", {:action => "edit_root", :id => @project},
:title => l(:link_edit, :title => l(:link_documents)), :class => "icon icon-edit") %> &nbsp;
<% else @folder.nil? %>
<%= link_to("", {:action => "edit", :id => @project, :folder_id => @folder },
:title => l(:link_edit, :title => h(@folder.title)), :class => "icon icon-edit") %> &nbsp;
@ -26,7 +25,7 @@
</div>
<%= render "custom_fields", :object => @folder %>
</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 %>
<%= hidden_field_tag("action") %>
<div class="controls" style="float: left">
@ -191,7 +190,7 @@
<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(:method => :delete_entries, :id => @project, :folder_id => @folder) %>");
jQuery("#entries_form").attr("action", "<%= url_for(:action => :delete_entries, :id => @project, :folder_id => @folder) %>");
jQuery("#entries_form").submit();
}
})

View File

@ -13,10 +13,10 @@
<tr>
<td><%=h(User.find(access["user_id"]))%></td>
<td><%=access["count"]%></td>
<td><%=Time.parse(access["min"]).to_s(:db)%></td>
<td><%=Time.parse(access["max"]).to_s(:db)%></td>
<td><%=Time.parse(access["min"].to_s).to_s(:db)%></td>
<td><%=Time.parse(access["max"].to_s).to_s(:db)%></td>
</tr>
<% end %>
</tbody>
</table>
</p>
</p>

View File

@ -5,8 +5,8 @@
<h2><%= render(:partial => "/dmsf/path", :locals => {:path => @folder.dmsf_path}) %></h2>
<% unless DmsfFolder.allowed_target_projects_on_copy.blank?
form_tag({:action => "copy_to", :id => @folder}, :id => "copyForm") do |f| %>
<% unless DmsfFolder.allowed_target_projects_on_copy.blank? %>
<%= form_tag({:action => "copy_to", :id => @folder}, :id => "copyForm") do |f| %>
<div class="box dmsf_detail">
<p>
<label for="target_project_id"><%=l(:label_target_project)%>:</label>

View File

@ -17,9 +17,35 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do
resources :dmsf
# resources :dmsf
#/projects/<project>/dmsf/state - dmsf_state controller
#
# dmsf controller
# /projects/<project>/dmsf
##
# verify :method => :post, :only => [:delete_entries, :create, :save, :delete, :save_root, :notify_activate, :notify_deactivate],
# :render => { :nothing => true, :status => :method_not_allowed }
post '/projects/:id/dmsf/create', :controller => 'dmsf', :action => 'create'
post '/projects/:id/dmsf/notify/activate', :controller => 'dmsf', :action => 'notify_activate'
post '/projects/:id/dmsf/notify/deactivate', :controller => 'dmsf', :action => 'notify_deactivate'
post '/projects/:id/dmsf/delete', :controller => 'dmsf', :action => 'delete'
post '/projects/:id/dmsf/save', :controller => 'dmsf', :action => 'save'
post '/projects/:id/dmsf/save/root', :controller => 'dmsf', :action => 'save_root'
post '/projects/:id/dmsf/entries', :controller => 'dmsf', :action => 'entries_operation'
post '/projects/:id/dmsf/entries/delete', :controller => 'dmsf', :action => 'delete_entries'
get '/projects/:id/dmsf/', :controller => 'dmsf', :action => 'show'
get '/projects/:id/dmsf/new', :controller => 'dmsf', :action => 'new'
get '/projects/:id/dmsf/edit', :controller=> 'dmsf', :action => 'edit'
get '/projects/:id/dmsf/edit/root', :controller=> 'dmsf', :action => 'edit_root'
#
# dmsf_state controller
# /projects/<project>/dmsf/state
##
post '/projects/:id/dmsf/state', :controller => 'dmsf_state', :action => 'user_pref_save'
@ -38,7 +64,8 @@ RedmineApp::Application.routes.draw do
post '/dmsf/files/:id/revision/create', :controller => 'dmsf_files', :action => 'create_revision'
post '/dmsf/files/:id/revision/delete', :controller => 'dmsf_files', :action => 'delete_revision'
get '/dmsf/files/:id/download', :controller => 'dmsf_files', :action => 'show'
get '/dmsf/files/:id/download', :controller => 'dmsf_files', :action => 'show', :download => '' #Otherwise will not route nil download param
get '/dmsf/files/:id/download/:download', :controller => 'dmsf_files', :action => 'show'
get '/dmsf/files/:id', :controller => 'dmsf_files', :action => 'show'
@ -49,4 +76,13 @@ RedmineApp::Application.routes.draw do
post '/dmsf/files/:id/copy/move', :controller => 'dmsf_files_copy', :action => 'move'
get '/dmsf/files/:id/copy', :controller => 'dmsf_files_copy', :action => 'new'
#
# folders_copy controller
##
#verify :method => :post, :only => [:copy_to], :render => { :nothing => true, :status => :method_not_allowed }
post '/dmsf/folders/:id/copy/to', :controller => 'dmsf_folders_copy', :action => 'copy_to'
get '/dmsf/folders/:id/copy', :controller => 'dmsf_folders_copy', :action => 'new'
end