Assigning of approval workflows to revisions
@ -256,7 +256,21 @@ class DmsfController < ApplicationController
|
||||
{: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
|
||||
|
||||
|
||||
@ -20,9 +20,9 @@ class DmsfWorkflowsController < ApplicationController
|
||||
unloadable
|
||||
layout :workflows_layout
|
||||
|
||||
before_filter :find_workflow, :except => [:create, :new, :index]
|
||||
before_filter :find_project
|
||||
before_filter :authorize_global, :except => [:action, :new_action]
|
||||
before_filter :find_workflow, :except => [:create, :new, :index, :assign, :assignment]
|
||||
before_filter :find_project, :except => [:start]
|
||||
before_filter :authorize_global #, :except => [:action, :new_action]
|
||||
|
||||
def index
|
||||
if @project
|
||||
@ -36,15 +36,37 @@ class DmsfWorkflowsController < ApplicationController
|
||||
end
|
||||
|
||||
def new_action
|
||||
if params[:commit] == l(:submit_commit)
|
||||
action = DmsfWorkflowStepAction.new(
|
||||
:dmsf_workflow_step_assignment_id => params[:dmsf_workflow_step_assignment_id],
|
||||
:action => params[:step_action],
|
||||
:note => params[:note])
|
||||
if request.post? && action.save
|
||||
@workflow.try_finish params[:dmsf_file_revision_id]
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
if request.post?
|
||||
if action.save
|
||||
@workflow.try_finish params[:dmsf_file_revision_id], action, params[:user_id]
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
else
|
||||
flash[:error] = l(:error_empty_note)
|
||||
end
|
||||
end
|
||||
end
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
def assign
|
||||
end
|
||||
|
||||
def assignment
|
||||
if params[:commit] == l(:button_assign)
|
||||
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_update)
|
||||
end
|
||||
end
|
||||
end
|
||||
# TODO: Refresh the page!
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
@ -88,6 +110,7 @@ class DmsfWorkflowsController < ApplicationController
|
||||
def destroy
|
||||
begin
|
||||
@workflow.destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
rescue
|
||||
flash[:error] = l(:error_unable_delete_dmsf_workflow)
|
||||
end
|
||||
@ -99,9 +122,7 @@ class DmsfWorkflowsController < ApplicationController
|
||||
end
|
||||
|
||||
def autocomplete_for_user
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def add_step
|
||||
@ -158,6 +179,17 @@ class DmsfWorkflowsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def start
|
||||
revision = DmsfFileRevision.find_by_id(params[:dmsf_file_revision_id])
|
||||
if revision
|
||||
revision.set_workflow(@workflow.id, params[:action])
|
||||
if request.post? && revision.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
end
|
||||
end
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_workflow
|
||||
|
||||
@ -18,19 +18,24 @@
|
||||
|
||||
module DmsfWorkflowsHelper
|
||||
|
||||
def render_principals_for_new_dmsf_workflow_users(workflow)
|
||||
scope = User.active.sorted.like(params[:q])
|
||||
def render_principals_for_new_dmsf_workflow_users(workflow, dmsf_workflow_step_assignment_id, dmsf_file_revision_id)
|
||||
scope = workflow.delegates(params[:q], dmsf_workflow_step_assignment_id, dmsf_file_revision_id, nil)
|
||||
principal_count = scope.count
|
||||
principal_pages = Redmine::Pagination::Paginator.new principal_count, 100, params['page']
|
||||
principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page']
|
||||
principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
|
||||
|
||||
s = content_tag('div', principals_check_box_tags('user_ids[]', principals), :id => 'principals')
|
||||
if dmsf_workflow_step_assignment_id
|
||||
s = content_tag('div', principals_radio_button_tags('step_action', principals), :id => 'users_for_delegate')
|
||||
else
|
||||
s = content_tag('div', principals_check_box_tags('user_ids[]', principals), :id => 'users')
|
||||
end
|
||||
|
||||
links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options|
|
||||
link_to text, autocomplete_for_user_dmsf_workflow_path(workflow, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
|
||||
}
|
||||
|
||||
s + content_tag('p', links, :class => 'pagination')
|
||||
s.html_safe
|
||||
end
|
||||
|
||||
def dmsf_workflow_steps_options_for_select(steps)
|
||||
@ -50,4 +55,12 @@ module DmsfWorkflowsHelper
|
||||
end
|
||||
options_for_select(options, :selected => dmsf_workflow_id)
|
||||
end
|
||||
|
||||
def principals_radio_button_tags(name, principals)
|
||||
s = ''
|
||||
principals.each do |principal|
|
||||
s << "<label>#{ radio_button_tag name, principal.id, false, :id => nil } #{h principal}</label>\n"
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@ -156,19 +156,22 @@ class DmsfFileRevision < ActiveRecord::Base
|
||||
return new_revision
|
||||
end
|
||||
|
||||
def workflow_str
|
||||
str = ''
|
||||
if dmsf_workflow_id
|
||||
def workflow_str(name)
|
||||
if name && dmsf_workflow_id
|
||||
wf = DmsfWorkflow.find_by_id(dmsf_workflow_id)
|
||||
str = "#{wf.name} - " if wf
|
||||
else
|
||||
str = ''
|
||||
end
|
||||
case workflow
|
||||
when 1
|
||||
when DmsfWorkflow::STATE_WAITING_FOR_APPROVAL
|
||||
str + l(:title_waiting_for_approval)
|
||||
when 2
|
||||
when DmsfWorkflow::STATE_APPROVED
|
||||
str + l(:title_approved)
|
||||
when 3
|
||||
when DmsfWorkflow::STATE_DRAFT
|
||||
str + l(:title_draft)
|
||||
when DmsfWorkflow::STATE_REJECTED
|
||||
str + l(:title_rejected)
|
||||
else
|
||||
str
|
||||
end
|
||||
@ -178,10 +181,10 @@ class DmsfFileRevision < ActiveRecord::Base
|
||||
if User.current.allowed_to?(:file_approval, self.file.project)
|
||||
unless dmsf_workflow_id.blank?
|
||||
self.dmsf_workflow_id = dmsf_workflow_id
|
||||
if commit == l(:label_dmsf_wokflow_action_start)
|
||||
self.workflow = 1 # Waiting for approval
|
||||
if commit == 'start'
|
||||
self.workflow = DmsfWorkflow::STATE_WAITING_FOR_APPROVAL # Waiting for approval
|
||||
else
|
||||
self.workflow = 3 # Draft
|
||||
self.workflow = DmsfWorkflow::STATE_DRAFT # Draft
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -189,10 +192,10 @@ class DmsfFileRevision < ActiveRecord::Base
|
||||
|
||||
def assign_workflow(dmsf_workflow_id)
|
||||
if User.current.allowed_to?(:file_approval, self.file.project)
|
||||
if self.workflow == 1 # Waiting for approval
|
||||
#if self.workflow == DmsfWorkflow::STATE_DRAFT # Waiting for approval
|
||||
wf = DmsfWorkflow.find_by_id(dmsf_workflow_id)
|
||||
wf.assign(self.id) if wf && self.id
|
||||
end
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -110,8 +110,23 @@ class DmsfWorkflow < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def delegates
|
||||
User.all
|
||||
def delegates(q, dmsf_workflow_step_assignment_id, dmsf_file_revision_id, project_id)
|
||||
if project_id
|
||||
sql = ['id IN (SELECT user_id FROM members WHERE project_id = ?', project_id]
|
||||
elsif dmsf_workflow_step_assignment_id && dmsf_file_revision_id
|
||||
sql = [
|
||||
'id NOT IN (SELECT a.user_id FROM dmsf_workflow_step_assignments a WHERE id = ?) AND id IN (SELECT m.user_id FROM members m JOIN dmsf_file_revisions r ON m.project_id = r.project_id WHERE r.id = ?)',
|
||||
dmsf_workflow_step_assignment_id,
|
||||
dmsf_file_revision_id]
|
||||
else
|
||||
sql = '1=1'
|
||||
end
|
||||
|
||||
unless q.nil? || q.empty?
|
||||
User.active.sorted.where(sql).like(q)
|
||||
else
|
||||
User.active.sorted.where(sql)
|
||||
end
|
||||
end
|
||||
|
||||
def get_free_assignment(user, dmsf_file_revision_id)
|
||||
@ -130,8 +145,10 @@ class DmsfWorkflow < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def try_finish(dmsf_file_revision_id)
|
||||
def try_finish(dmsf_file_revision_id, action, user_id)
|
||||
res = nil
|
||||
case action.action
|
||||
when DmsfWorkflowStepAction::ACTION_APPROVE
|
||||
steps = DmsfWorkflowStep.where(:dmsf_workflow_id => self.id).all
|
||||
steps.each do |step|
|
||||
res = step.result dmsf_file_revision_id
|
||||
@ -139,8 +156,17 @@ class DmsfWorkflow < ActiveRecord::Base
|
||||
return
|
||||
end
|
||||
end
|
||||
when DmsfWorkflowStepAction::ACTION_REJECT
|
||||
res = DmsfWorkflow::STATE_REJECTED
|
||||
when DmsfWorkflowStepAction::ACTION_DELEGATE
|
||||
assignment = DmsfWorkflowStepAssignment.find_by_id(action.dmsf_workflow_step_assignment_id)
|
||||
assignment.update_attribute(:user_id, user_id) if assignment
|
||||
end
|
||||
|
||||
if res
|
||||
revision = DmsfFileRevision.find_by_id dmsf_file_revision_id
|
||||
revision.update_attribute(:workflow, res) if revision && res
|
||||
revision.update_attribute(:workflow, res) if revision
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@ -77,6 +77,7 @@ class DmsfWorkflowStep < ActiveRecord::Base
|
||||
:dmsf_workflow_step_id => self.id,
|
||||
:dmsf_file_revision_id => dmsf_file_revision_id,
|
||||
:user_id => user.id).first
|
||||
if assignment
|
||||
actions = DmsfWorkflowStepAction.where(
|
||||
:dmsf_workflow_step_assignment_id => assignment.id).all
|
||||
actions.each do |action|
|
||||
@ -86,5 +87,6 @@ class DmsfWorkflowStep < ActiveRecord::Base
|
||||
end
|
||||
return assignment.id
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@ -22,6 +22,7 @@ class DmsfWorkflowStepAction < ActiveRecord::Base
|
||||
|
||||
validates :dmsf_workflow_step_assignment_id, :presence => true
|
||||
validates :action, :presence => true
|
||||
validates :note, :presence => true, :unless => lambda { self.action == DmsfWorkflowStepAction::ACTION_APPROVE }
|
||||
|
||||
ACTION_APPROVE = 1
|
||||
ACTION_REJECT = 2
|
||||
|
||||
@ -97,7 +97,7 @@
|
||||
<td class="author"><%= h(subfolder.user) %></td>
|
||||
<td class="actions">
|
||||
<% if User.current.allowed_to?(:file_approval, @project) %>
|
||||
<div class="right_icon_box">
|
||||
<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)}')",
|
||||
@ -172,38 +172,12 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="version">
|
||||
<%= file.last_revision.version %>
|
||||
<% case file.last_revision.workflow %>
|
||||
<% when DmsfWorkflow::STATE_WAITING_FOR_APPROVAL %>
|
||||
<% wf = DmsfWorkflow.find_by_id(file.last_revision.dmsf_workflow_id) %>
|
||||
<% if wf %>
|
||||
<% dmsf_workflow_step_assignment_id = wf.get_free_assignment(User.current, file.last_revision.id) %>
|
||||
<% if dmsf_workflow_step_assignment_id %>
|
||||
<%= link_to(
|
||||
image_tag('waitingforapproval.png', :plugin => :redmine_dmsf),
|
||||
action_dmsf_workflow_path(
|
||||
:project_id => @project.id,
|
||||
:id => wf.id,
|
||||
:dmsf_workflow_step_assignment_id => dmsf_workflow_step_assignment_id,
|
||||
:dmsf_file_revision_id => file.last_revision.id),
|
||||
:title => l(:title_waiting_for_approval),
|
||||
:remote => true) %>
|
||||
<% else %>
|
||||
<%= image_tag('waitingforapproval.png', :title => l(:title_waiting_for_approval), :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% when DmsfWorkflow::STATE_APPROVED %>
|
||||
<%= image_tag('approved.png', :title => l(:title_approved), :plugin => :redmine_dmsf) %>
|
||||
<% when DmsfWorkflow::STATE_DRAFT %>
|
||||
<%= image_tag('draft.png', :title => l(:title_draft), :plugin => :redmine_dmsf) %>
|
||||
<% when DmsfWorkflow::STATE_REJECTED %>
|
||||
<%= image_tag('delete.png', :title => l(:title_rejected), :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<%= "#{file.last_revision.version} #{file.last_revision.workflow_str(false)}" %>
|
||||
</td>
|
||||
<td class="author"><%= h(file.last_revision.user) %></td>
|
||||
<td class="actions">
|
||||
<% if User.current.allowed_to?(:file_approval, @project) %>
|
||||
<div class="right_icon_box">
|
||||
<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)}')",
|
||||
@ -213,9 +187,48 @@
|
||||
"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 %>
|
||||
<% wf = DmsfWorkflow.find_by_id(file.last_revision.dmsf_workflow_id) %>
|
||||
<% if wf %>
|
||||
<% dmsf_workflow_step_assignment_id = wf.get_free_assignment(User.current, file.last_revision.id) %>
|
||||
<% if dmsf_workflow_step_assignment_id %>
|
||||
<%= link_to(
|
||||
image_tag('waiting_for_approval.png', :plugin => :redmine_dmsf),
|
||||
action_dmsf_workflow_path(
|
||||
:project_id => @project.id,
|
||||
:id => wf.id,
|
||||
:dmsf_workflow_step_assignment_id => dmsf_workflow_step_assignment_id,
|
||||
:dmsf_file_revision_id => file.last_revision.id),
|
||||
:title => l(:title_waiting_for_approval),
|
||||
:remote => true) %>
|
||||
<% else %>
|
||||
<%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% when DmsfWorkflow::STATE_APPROVED %>
|
||||
<%= image_tag('approved.png', :title => l(:title_approved), :plugin => :redmine_dmsf) %>
|
||||
<% when DmsfWorkflow::STATE_DRAFT %>
|
||||
<%= link_to_function(image_tag('draft.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{start_dmsf_workflow_path(
|
||||
:id => file.last_revision.dmsf_workflow_id,
|
||||
:dmsf_file_revision_id => file.last_revision.id)}')",
|
||||
:title => l(:label_dmsf_wokflow_action_start)) %>
|
||||
<% when DmsfWorkflow::STATE_REJECTED %>
|
||||
<%= image_tag('rejected.png', :title => l(:title_rejected), :plugin => :redmine_dmsf) %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
image_tag('none.png', :plugin => :redmine_dmsf),
|
||||
assign_dmsf_workflow_path(
|
||||
:project_id => @project.id,
|
||||
:dmsf_workflow_step_assignment_id => dmsf_workflow_step_assignment_id,
|
||||
:dmsf_file_revision_id => file.last_revision.id),
|
||||
:title => l(:label_dmsf_wokflow_action_assign),
|
||||
:remote => true) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="right_icon_box" style="width: 70px;">
|
||||
<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 },
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<%= @file.last_revision.major_version + 1 %>.0 <%= l(:option_version_major) %><br />
|
||||
</div>
|
||||
<p>
|
||||
<%= label_tag("workflow", l(:label_workflow) + ":") %>
|
||||
<%= label_tag('workflow', l(:label_workflow) + ':') %>
|
||||
<%= select_tag(
|
||||
'dmsf_workflow_id',
|
||||
dmsf_workflows_for_select(@project, @file.last_revision.dmsf_workflow_id))%>
|
||||
|
||||
@ -57,7 +57,8 @@
|
||||
|
||||
<h3><%= l(:heading_revisions) %></h3>
|
||||
<% @file.revisions.visible[@revision_pages.current.offset,@revision_pages.items_per_page].each do |revision| %>
|
||||
<div class="box dmsf_detail">
|
||||
<div class="revision_box dmsf_detail">
|
||||
<div class="ui-widget-header ui-corner-tl ui-corner-tr">
|
||||
<div style="float:right">
|
||||
<%= link_to(image_tag("download.png", :plugin => "redmine_dmsf"),
|
||||
{:action => "show", :id => @file, :download => revision},
|
||||
@ -69,22 +70,20 @@
|
||||
:title => l(:title_delete_revision)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<p class="no-ident">
|
||||
<%=label_tag("", (revision.source_revision.nil? ? l(:label_created) : l(:label_changed)) + ":")%>
|
||||
|
||||
<%= label_tag('', l(:info_revision, :rev => revision.id)) %>
|
||||
<%= (revision.source_revision.nil? ? l(:label_created) : l(:label_changed)).downcase %>
|
||||
<%= l(:info_changed_by_user, :changed => format_time(revision.updated_at), :user => h(revision.user)) %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="clear">
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_title) + ":") %>
|
||||
<%= h(revision.title) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_file) + ":") %>
|
||||
<%= (h(revision.folder.dmsf_path_str) + "/") unless revision.folder.nil? %><%= h(revision.name) %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="no-ident">
|
||||
@ -95,41 +94,29 @@
|
||||
</div>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_version) + ":") %>
|
||||
<%= revision.major_version %>.<%= revision.minor_version %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("", l(:label_workflow) + ":") %>
|
||||
<%= #case revision.workflow
|
||||
# when 1 then l(:option_workflow_waiting_for_approval)
|
||||
# when 2 then l(:option_workflow_approved)
|
||||
# else l(:option_workflow_none)
|
||||
# end
|
||||
revision.workflow_str
|
||||
%>
|
||||
</p>
|
||||
<br/>
|
||||
<%= label_tag('', l(:label_workflow) + ':') %>
|
||||
<%= revision.workflow_str true %>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_mime) + ":") %>
|
||||
<%= h(revision.mime_type) %>
|
||||
</p>
|
||||
<p>
|
||||
<br/>
|
||||
<%= label_tag("", l(:label_size) + ":") %>
|
||||
<%= number_to_human_size(revision.size) %>
|
||||
</p>
|
||||
</div>
|
||||
<br style="clear: both"/>
|
||||
<div class="no-ident clear">
|
||||
<%= render "dmsf/custom_fields", :object => revision %>
|
||||
</div>
|
||||
<p class="no-ident clear">
|
||||
<div class="splitcontentleft clear">
|
||||
<%= label_tag("", l(:label_comment) + ":") %>
|
||||
<%= h(revision.comment) %>
|
||||
</p>
|
||||
</div>
|
||||
<%= render(:partial => "revision_access", :locals => {:revision => revision}) if User.current.allowed_to?(:file_approval, @file.project) %>
|
||||
</div>
|
||||
<br/>
|
||||
<% end %>
|
||||
|
||||
<p class="pagination"><%= pagination_links_full @revision_pages, @file.revisions.visible.count %></p>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
:download => ""}) %> (<%= file.name %>),
|
||||
<%= number_to_human_size(file.last_revision.size) %>,
|
||||
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
|
||||
<%= "#{file.last_revision.workflow_str}," unless file.last_revision.workflow_str.blank? %>
|
||||
<%= "#{file.last_revision.workflow_str(true)}," unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= link_to("Details",
|
||||
{:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
|
||||
<% unless file.last_revision.comment.blank? %>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
User <%= @user %> actualized DMSF files in project <%= @project.name %>:
|
||||
<% @files.each do |file| %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %><%= ", #{file.last_revision.workflow_str}" unless file.last_revision.workflow_str.blank? %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %><%= ", #{file.last_revision.workflow_str(true)}" unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= url_for({:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
|
||||
<% unless file.last_revision.comment.blank? %> comment: <%= file.last_revision.comment %><% end %>
|
||||
<% end %>
|
||||
@ -13,7 +13,7 @@
|
||||
:download => ""}) %> (<%= file.name %>),
|
||||
<%= number_to_human_size(file.last_revision.size) %>,
|
||||
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
|
||||
<%= "#{file.last_revision.workflow_str}," unless file.last_revision.workflow_str.blank? %>
|
||||
<%= "#{file.last_revision.workflow_str(true)}," unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= link_to("Details",
|
||||
{:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
|
||||
<% unless file.last_revision.comment.blank? %>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
User <%= @user %> actualized DMSF files in project <%= @project.name %>:
|
||||
<% @files.each do |file| %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %><%= ", #{file.last_revision.workflow_str}" unless file.last_revision.workflow_str.blank? %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %><%= ", #{file.last_revision.workflow_str(true)}" unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= url_for({:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
|
||||
<% unless file.last_revision.comment.blank? %> comment: <%= file.last_revision.comment %><% end %>
|
||||
<% end %>
|
||||
@ -1,17 +1,4 @@
|
||||
<%
|
||||
#disabled_workflow = []
|
||||
#selected_workflow = nil
|
||||
#unless User.current.allowed_to?(:file_approval, @project)
|
||||
#disabled_workflow << 2
|
||||
#current_workflow = upload.workflow
|
||||
#if current_workflow == 1 || current_workflow == 2
|
||||
#disabled_workflow << nil
|
||||
#selected_workflow = 1
|
||||
#end
|
||||
#else
|
||||
#selected_workflow = upload.workflow
|
||||
#end
|
||||
%>
|
||||
|
||||
<div class="box dmsf_detail">
|
||||
<%= hidden_field_tag("commited_files[#{i}][disk_filename]", upload.disk_filename) %>
|
||||
<div class="clear">
|
||||
|
||||
@ -30,13 +30,7 @@
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("", l(:label_workflow) + ":") %>
|
||||
<%= #case upload.workflow
|
||||
# when 1 then l(:option_workflow_waiting_for_approval)
|
||||
# when 2 then l(:option_workflow_approved)
|
||||
# else l(:option_workflow_none)
|
||||
# end
|
||||
upload.workflow_str
|
||||
%>
|
||||
<%= upload.workflow_str true %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
<h3 class="title"><%= l(:label_dmsf_workflow) %></h3>
|
||||
|
||||
<%= form_tag({:controller => 'dmsf_workflows',
|
||||
:action => 'new_action',
|
||||
:object_type => DmsfWorkflow,
|
||||
:object_id => @workflow.id,
|
||||
:project_id => @project.id},
|
||||
:remote => true,
|
||||
<%= form_tag({:controller => 'dmsf_workflows', :action => 'new_action'},
|
||||
:method => :post,
|
||||
:id => 'new-action-form') do %>
|
||||
|
||||
<%= hidden_field_tag :dmsf_workflow_step_assignment_id, params[:dmsf_workflow_step_assignment_id] %>
|
||||
<%= hidden_field_tag :dmsf_file_revision_id, params[:dmsf_file_revision_id] %>
|
||||
<p><label><%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_APPROVE, true %> <%= l(:label_dmsf_wokflow_action_approve) %></label><br/></p>
|
||||
@ -18,18 +14,14 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label><%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_DELEGATE %> <%= l(:label_dmsf_wokflow_action_delegate) %></label><br/>
|
||||
<%= label_tag 'delegate', l(:label_dmsf_wokflow_action_delegate) %><br/>
|
||||
<%= text_field_tag 'user_search', nil %>
|
||||
<%= javascript_tag "observeSearchfield('user_search', 'users_for_delegate', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@workflow, :dmsf_workflow_step_assignment_id => params[:dmsf_workflow_step_assignment_id], :dmsf_file_revision_id => params[:dmsf_file_revision_id]) }')" %>
|
||||
<%= content_tag('div', principals_radio_button_tags('step_action', @workflow.delegates(nil, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id], nil)), :id => 'users_for_delegate') %>
|
||||
</p>
|
||||
|
||||
<%= javascript_tag "observeSearchfield('user_search', 'users_for_delegate', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@workflow) }')" %>
|
||||
|
||||
<div id="users_for_delegate">
|
||||
<%= principals_check_box_tags 'watcher[user_ids][]', @workflow.delegates %>
|
||||
</div>
|
||||
|
||||
<p class="buttons">
|
||||
<%= submit_tag l(:submit_commit), :name => nil, :onclick => 'hideModal(this);' %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);' %>
|
||||
<%= submit_tag l(:submit_commit), :name => 'commit', :onclick => 'hideModal(this);' %>
|
||||
<%= submit_tag l(:button_cancel), :name => 'commit', :onclick => 'hideModal(this);' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
21
app/views/dmsf_workflows/_assign.html.erb
Normal file
@ -0,0 +1,21 @@
|
||||
<h3 class="title"><%= l(:label_dmsf_workflow) %></h3>
|
||||
|
||||
<%= form_tag({:controller => 'dmsf_workflows', :action => 'assignment'},
|
||||
:method => :post,
|
||||
:id => 'assignment-form') do %>
|
||||
|
||||
<%= hidden_field_tag :dmsf_workflow_step_assignment_id, params[:dmsf_workflow_step_assignment_id] %>
|
||||
<%= hidden_field_tag :dmsf_file_revision_id, params[:dmsf_file_revision_id] %>
|
||||
|
||||
<p>
|
||||
<%= label_tag('workflow', l(:label_workflow) + ':') %>
|
||||
<%= select_tag(
|
||||
'dmsf_workflow_id',
|
||||
dmsf_workflows_for_select(@project, nil))%>
|
||||
</p>
|
||||
|
||||
<p class="buttons">
|
||||
<%= submit_tag l(:button_assign), :name => 'commit', :onclick => 'hideModal(this);' %>
|
||||
<%= submit_tag l(:button_cancel), :name => 'commit', :onclick => 'hideModal(this);' %>
|
||||
</p>
|
||||
<% end %>
|
||||
@ -61,10 +61,10 @@
|
||||
<fieldset><legend><%=l(:label_user_new)%></legend>
|
||||
|
||||
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
|
||||
<%= javascript_tag "observeSearchfield('user_search', null, '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@workflow) }')" %>
|
||||
<%= javascript_tag "observeSearchfield('user_search', 'users', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@workflow, :dmsf_workflow_step_assignment_id => nil, :dmsf_file_revision_id => nil, :project_id => @project ? @project.id : nil) }')" %>
|
||||
|
||||
<div id="users">
|
||||
<%= render_principals_for_new_dmsf_workflow_users(@workflow) %>
|
||||
<%= render_principals_for_new_dmsf_workflow_users(@workflow, nil, nil) %>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
|
||||
@ -1 +0,0 @@
|
||||
<h2>WorkflowController#action</h2>
|
||||
3
app/views/dmsf_workflows/assign.js.erb
Normal file
@ -0,0 +1,3 @@
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'assign', :locals => {:workflow => @workflow}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
$('#ajax-modal').addClass('assignment');
|
||||
1
app/views/dmsf_workflows/autocomplete_for_user.html.erb
Normal file
@ -0,0 +1 @@
|
||||
<%= render_principals_for_new_dmsf_workflow_users(@workflow, params[:dmsf_workflow_step_assignment_id], params[:dmsf_file_revision_id]) %>
|
||||
@ -1 +0,0 @@
|
||||
$('#users').html('<%= escape_javascript(render_principals_for_new_dmsf_workflow_users(@workflow)) %>');
|
||||
|
Before Width: | Height: | Size: 535 B |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 752 B |
|
Before Width: | Height: | Size: 641 B |
|
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 459 B |
BIN
assets/images/none.png
Normal file
|
After Width: | Height: | Size: 776 B |
BIN
assets/images/rejected.png
Normal file
|
After Width: | Height: | Size: 631 B |
BIN
assets/images/waiting_for_approval.png
Normal file
|
After Width: | Height: | Size: 630 B |
|
Before Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 1.4 KiB |
@ -19,8 +19,8 @@ table.entries td.modified {
|
||||
}
|
||||
|
||||
table.entries td.actions {
|
||||
min-width: 108px;
|
||||
width: 108px;
|
||||
min-width: 116px;
|
||||
width: 116px;
|
||||
}
|
||||
|
||||
table.entries td.title {
|
||||
@ -238,3 +238,25 @@ table.access-table tbody td, table.access-table tbody tr:hover td {
|
||||
#admin-menu a.approvalworkflows { background-image: url(../images/ticket_go.png); }
|
||||
#users_for_delegate {height: 200px; overflow:auto;}
|
||||
#users_for_delegate label {display: block;}
|
||||
|
||||
.revision_box{
|
||||
padding: 0px 0px 0px 0px;
|
||||
margin-bottom: 10px;
|
||||
background-color:#f6f6f6;
|
||||
color:#505050;
|
||||
line-height:1.5em;
|
||||
/*border: 1px solid #e4e4e4;*/
|
||||
}
|
||||
|
||||
div.revision_box .ui-widget-header {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
td.workflow {
|
||||
font-size: 0.8em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
td.workflow img {
|
||||
vertical-align:text-top;
|
||||
}
|
||||
@ -45,7 +45,7 @@ en:
|
||||
:link_title: "Title"
|
||||
:link_size: "Size"
|
||||
:link_modified: "Modified"
|
||||
:link_ver: "Ver."
|
||||
:link_ver: "Version"
|
||||
:link_author: "Author"
|
||||
:title_check_for_zip_download_or_email: "Check for Zip download or email"
|
||||
:title_delete: "Delete"
|
||||
@ -222,7 +222,12 @@ en:
|
||||
label_dmsf_wokflow_action_approve: Approve
|
||||
label_dmsf_wokflow_action_reject: Reject
|
||||
label_dmsf_wokflow_action_delegate: 'Delegate to'
|
||||
label_dmsf_wokflow_action_assign: 'Assign an approval workflow'
|
||||
message_dmsf_wokflow_note: Your note...
|
||||
title_draft: Draft
|
||||
title_rejected: Rejected
|
||||
label_dmsf_wokflow_action_start: Start workflow
|
||||
info_revision: "r%{rev}"
|
||||
link_workflow: Workflow
|
||||
button_assign: Assign
|
||||
error_empty_note: "The note can't be empty"
|
||||
@ -106,7 +106,10 @@ RedmineApp::Application.routes.draw do
|
||||
member do
|
||||
get 'autocomplete_for_user'
|
||||
get 'action'
|
||||
get 'assign'
|
||||
post 'new_action'
|
||||
post 'start'
|
||||
post 'assignment'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
4
init.rb
@ -56,9 +56,9 @@ Redmine::Plugin.register :redmine_dmsf do
|
||||
permission :file_manipulation, {:dmsf_files => [:create_revision, :delete, :lock, :unlock],
|
||||
:dmsf_upload => [:upload_files, :upload_file, :commit_files]}
|
||||
permission :file_approval, {:dmsf_files => [:delete_revision, :notify_activate, :notify_deactivate],
|
||||
:dmsf => [:notify_activate, :notify_deactivate]}
|
||||
:dmsf => [:notify_activate, :notify_deactivate],
|
||||
:dmsf_workflows => [:new, :create, :destroy, :edit, :add_step, :remove_step, :reorder_steps, :update, :start, :assign, :assignment, :action, :new_action]}
|
||||
permission :force_file_unlock, {}
|
||||
permission :approval_workflows, {:dmsf_workflows => [:new, :create, :destroy, :edit, :add_step, :remove_step, :reorder_steps, :update]}
|
||||
end
|
||||
|
||||
# Administration menu extension
|
||||
|
||||