Assigning workflows to revisions
This commit is contained in:
parent
90eedcc2dd
commit
cce36da72e
@ -26,6 +26,7 @@ class DmsfFilesController < ApplicationController
|
||||
before_filter :authorize
|
||||
|
||||
helper :all
|
||||
helper :dmsf_workflows
|
||||
|
||||
def show
|
||||
# download is put here to provide more clear and usable links
|
||||
@ -82,7 +83,7 @@ class DmsfFilesController < ApplicationController
|
||||
|
||||
@revision.major_version = last_revision.major_version
|
||||
@revision.minor_version = last_revision.minor_version
|
||||
@revision.workflow = last_revision.workflow
|
||||
#@revision.workflow = last_revision.workflow
|
||||
version = params[:version].to_i
|
||||
file_upload = params[:file_upload]
|
||||
if file_upload.nil?
|
||||
@ -96,13 +97,14 @@ class DmsfFilesController < ApplicationController
|
||||
@revision.disk_filename = @revision.new_storage_filename
|
||||
@revision.mime_type = Redmine::MimeType.of(file_upload.original_filename)
|
||||
end
|
||||
@revision.set_workflow(params[:workflow])
|
||||
@revision.set_workflow(params[:dmsf_workflow_id], params[:commit])
|
||||
|
||||
@file.name = @revision.name
|
||||
@file.folder = @revision.folder
|
||||
|
||||
if @revision.valid? && @file.valid?
|
||||
@revision.save!
|
||||
@revision.assign_workflow(params[:dmsf_workflow_id])
|
||||
unless file_upload.nil?
|
||||
@revision.copy_file_content(file_upload)
|
||||
end
|
||||
|
||||
@ -26,6 +26,7 @@ class DmsfUploadController < ApplicationController
|
||||
before_filter :find_folder, :except => [:upload_file]
|
||||
|
||||
helper :all
|
||||
helper :dmsf_workflows
|
||||
|
||||
def upload_files
|
||||
uploaded_files = params[:uploaded_files]
|
||||
@ -107,7 +108,7 @@ class DmsfUploadController < ApplicationController
|
||||
new_revision.source_revision = last_revision
|
||||
new_revision.major_version = last_revision.major_version
|
||||
new_revision.minor_version = last_revision.minor_version
|
||||
new_revision.workflow = last_revision.workflow
|
||||
#new_revision.workflow = last_revision.workflow
|
||||
end
|
||||
|
||||
commited_disk_filepath = "#{DmsfHelper.temp_dir}/#{commited_file["disk_filename"].gsub(/[\/\\]/,'')}"
|
||||
@ -120,8 +121,8 @@ class DmsfUploadController < ApplicationController
|
||||
new_revision.title = commited_file["title"]
|
||||
new_revision.description = commited_file["description"]
|
||||
new_revision.comment = commited_file["comment"]
|
||||
new_revision.increase_version(commited_file["version"].to_i, true)
|
||||
new_revision.set_workflow(commited_file["workflow"])
|
||||
new_revision.increase_version(commited_file["version"].to_i, true)
|
||||
new_revision.set_workflow(commited_file[:dmsf_workflow_id], nil)
|
||||
new_revision.mime_type = Redmine::MimeType.of(new_revision.name)
|
||||
new_revision.size = File.size(commited_disk_filepath)
|
||||
|
||||
@ -147,6 +148,7 @@ class DmsfUploadController < ApplicationController
|
||||
end
|
||||
|
||||
if new_revision.save
|
||||
new_revision.assign_workflow(commited_file[:dmsf_workflow_id])
|
||||
file.reload
|
||||
|
||||
new_revision.copy_file_content(file_upload)
|
||||
|
||||
@ -32,11 +32,20 @@ class DmsfWorkflowsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def action
|
||||
def action
|
||||
end
|
||||
|
||||
def new_action
|
||||
logger.info '>>>>>>>>>>>>>>>>>>>>>>> YES!'
|
||||
def new_action
|
||||
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)
|
||||
end
|
||||
# TODO: Refresh the page!
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
def log
|
||||
@ -156,7 +165,7 @@ class DmsfWorkflowsController < ApplicationController
|
||||
end
|
||||
|
||||
def find_project
|
||||
if @workflow
|
||||
if @workflow && @workflow.project
|
||||
@project = @workflow.project
|
||||
elsif params[:project_id].present?
|
||||
@project = Project.find_by_id params[:project_id]
|
||||
|
||||
@ -42,4 +42,12 @@ module DmsfWorkflowsHelper
|
||||
options_for_select(options, 0)
|
||||
end
|
||||
|
||||
def dmsf_workflows_for_select(project, dmsf_workflow_id)
|
||||
options = Array.new
|
||||
options << [l(:option_workflow_none), nil]
|
||||
DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', project.id]).each do |wf|
|
||||
options << [wf.name, wf.id]
|
||||
end
|
||||
options_for_select(options, :selected => dmsf_workflow_id)
|
||||
end
|
||||
end
|
||||
|
||||
@ -25,6 +25,7 @@ class DmsfFileRevision < ActiveRecord::Base
|
||||
belongs_to :deleted_by_user, :class_name => "User", :foreign_key => "deleted_by_user_id"
|
||||
belongs_to :project
|
||||
has_many :access, :class_name => "DmsfFileRevisionAccess", :foreign_key => "dmsf_file_revision_id", :dependent => :destroy
|
||||
has_many :dmsf_workflow_step_assignment, :dependent => :destroy
|
||||
|
||||
#Returns a list of revisions that are not deleted here, or deleted at parent level either
|
||||
scope :visible, lambda {|*args| joins(:file).where(DmsfFile.visible_condition(args.shift || User.current, *args)).where("#{self.table_name}.deleted = :false", :false => false ).readonly(false) }
|
||||
@ -154,32 +155,47 @@ class DmsfFileRevision < ActiveRecord::Base
|
||||
|
||||
return new_revision
|
||||
end
|
||||
|
||||
#TODO: validate if it isn't doubled or move it to view
|
||||
|
||||
def workflow_str
|
||||
str = ''
|
||||
if dmsf_workflow_id
|
||||
wf = DmsfWorkflow.find_by_id(dmsf_workflow_id)
|
||||
str = "#{wf.name} - " if wf
|
||||
end
|
||||
case workflow
|
||||
when 1 then l(:title_waiting_for_approval)
|
||||
when 2 then l(:title_approved)
|
||||
else nil
|
||||
when 1
|
||||
str + l(:title_waiting_for_approval)
|
||||
when 2
|
||||
str + l(:title_approved)
|
||||
when 3
|
||||
str + l(:title_draft)
|
||||
else
|
||||
str
|
||||
end
|
||||
end
|
||||
|
||||
def set_workflow(workflow)
|
||||
def set_workflow(dmsf_workflow_id, commit)
|
||||
if User.current.allowed_to?(:file_approval, self.file.project)
|
||||
self.workflow = workflow
|
||||
else
|
||||
if self.source_revision.nil?
|
||||
self.workflow = workflow == 2 ? 1 : workflow
|
||||
else
|
||||
if workflow == 2 || self.source_revision.workflow == 1 || self.source_revision.workflow == 2
|
||||
self.workflow = 1
|
||||
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
|
||||
else
|
||||
self.workflow = workflow
|
||||
self.workflow = 3 # Draft
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def assign_workflow(dmsf_workflow_id)
|
||||
if User.current.allowed_to?(:file_approval, self.file.project)
|
||||
if self.workflow == 1 # Waiting for approval
|
||||
wf = DmsfWorkflow.find_by_id(dmsf_workflow_id)
|
||||
wf.assign(self.id) if wf && self.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def increase_version(version_to_increase, new_content)
|
||||
if new_content
|
||||
self.minor_version = case version_to_increase
|
||||
|
||||
@ -24,6 +24,12 @@ class DmsfWorkflow < ActiveRecord::Base
|
||||
validates_uniqueness_of :name
|
||||
validates :name, :presence => true
|
||||
validates_length_of :name, :maximum => 255
|
||||
|
||||
STATE_NONE = nil
|
||||
STATE_DRAFT = 3
|
||||
STATE_WAITING_FOR_APPROVAL = 1
|
||||
STATE_APPROVED = 2
|
||||
STATE_REJECTED = 4
|
||||
|
||||
def self.workflows(project)
|
||||
project ? where(:project_id => project) : where('project_id IS NULL')
|
||||
@ -107,4 +113,34 @@ class DmsfWorkflow < ActiveRecord::Base
|
||||
def delegates
|
||||
User.all
|
||||
end
|
||||
|
||||
def get_free_assignment(user, dmsf_file_revision_id)
|
||||
steps = DmsfWorkflowStep.where(:dmsf_workflow_id => self.id).all(:order => 'step ASC')
|
||||
steps.each do |step|
|
||||
unless step.finished?(dmsf_file_revision_id)
|
||||
return step.get_free_assignment(dmsf_file_revision_id, user)
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def assign(dmsf_file_revision_id)
|
||||
dmsf_workflow_steps.each do |ws|
|
||||
ws.assign(dmsf_file_revision_id)
|
||||
end
|
||||
end
|
||||
|
||||
def try_finish(dmsf_file_revision_id)
|
||||
res = nil
|
||||
steps = DmsfWorkflowStep.where(:dmsf_workflow_id => self.id).all
|
||||
steps.each do |step|
|
||||
res = step.result dmsf_file_revision_id
|
||||
unless step.finished? dmsf_file_revision_id
|
||||
return
|
||||
end
|
||||
end
|
||||
revision = DmsfFileRevision.find_by_id dmsf_file_revision_id
|
||||
revision.update_attribute(:workflow, res) if revision && res
|
||||
end
|
||||
|
||||
end
|
||||
@ -34,4 +34,57 @@ class DmsfWorkflowStep < ActiveRecord::Base
|
||||
def user
|
||||
User.find(user_id)
|
||||
end
|
||||
|
||||
def assign(dmsf_file_revision_id)
|
||||
step_assignment = DmsfWorkflowStepAssignment.new(
|
||||
:dmsf_workflow_step_id => id,
|
||||
:user_id => user_id,
|
||||
:dmsf_file_revision_id => dmsf_file_revision_id)
|
||||
step_assignment.save
|
||||
end
|
||||
|
||||
def finished?(dmsf_file_revision_id)
|
||||
res = result(dmsf_file_revision_id)
|
||||
res == DmsfWorkflow::STATE_APPROVED || res == DmsfWorkflow::STATE_REJECTED
|
||||
end
|
||||
|
||||
def result(dmsf_file_revision_id)
|
||||
assignments = DmsfWorkflowStepAssignment.where(
|
||||
:dmsf_workflow_step_id => self.id, :dmsf_file_revision_id => dmsf_file_revision_id).all
|
||||
assignments.each do |assignment|
|
||||
actions = DmsfWorkflowStepAction.where(
|
||||
:dmsf_workflow_step_assignment_id => assignment.id).all
|
||||
if actions.empty?
|
||||
return
|
||||
end
|
||||
actions.each do |action|
|
||||
if DmsfWorkflowStepAction.is_finished?(action.action)
|
||||
case action.action
|
||||
when DmsfWorkflowStepAction::ACTION_APPROVE
|
||||
return DmsfWorkflow::STATE_APPROVED
|
||||
when DmsfWorkflowStepAction::ACTION_REJECT
|
||||
return DmsfWorkflow::STATE_REJECTED
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_free_assignment(dmsf_file_revision_id, user)
|
||||
assignment = DmsfWorkflowStepAssignment.where(
|
||||
:dmsf_workflow_step_id => self.id,
|
||||
:dmsf_file_revision_id => dmsf_file_revision_id,
|
||||
:user_id => user.id).first
|
||||
actions = DmsfWorkflowStepAction.where(
|
||||
:dmsf_workflow_step_assignment_id => assignment.id).all
|
||||
actions.each do |action|
|
||||
if action && action.is_finished?
|
||||
return
|
||||
end
|
||||
end
|
||||
return assignment.id
|
||||
end
|
||||
|
||||
end
|
||||
@ -17,8 +17,23 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class DmsfWorkflowStepAction < ActiveRecord::Base
|
||||
|
||||
belongs_to :dmsf_workflow_step_assignment
|
||||
|
||||
validates :dmsf_workflow_step_assignment_id, :presence => true
|
||||
validates :action, :presence => true
|
||||
|
||||
ACTION_APPROVE = 1
|
||||
ACTION_REJECT = 2
|
||||
ACTION_DELEGATE = 3
|
||||
|
||||
def self.is_finished?(action)
|
||||
action == DmsfWorkflowStepAction::ACTION_APPROVE ||
|
||||
action == DmsfWorkflowStepAction::ACTION_REJECT
|
||||
end
|
||||
|
||||
def is_finished?
|
||||
DmsfWorkflowStepAction.is_finished? self.action
|
||||
end
|
||||
|
||||
end
|
||||
@ -43,6 +43,9 @@
|
||||
</div>
|
||||
<%= render "custom_fields", :object => @folder %>
|
||||
</div>
|
||||
|
||||
<%= error_messages_for('dmsf_workflow') %>
|
||||
|
||||
<%= form_tag({:action => :entries_operation, :id => @project, :folder_id => @folder}, :method => :post,
|
||||
:class => "dmfs_entries", :id => "entries_form") do %>
|
||||
<%= hidden_field_tag("action") %>
|
||||
@ -170,11 +173,31 @@
|
||||
</td>
|
||||
<td class="version">
|
||||
<%= 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) %>
|
||||
<% when 2 then %><%= image_tag("approved.png", :title => l(:title_approved),
|
||||
:plugin => :redmine_dmsf) %>
|
||||
<% 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 %>
|
||||
</td>
|
||||
<td class="author"><%= h(file.last_revision.user) %></td>
|
||||
|
||||
@ -4,21 +4,6 @@
|
||||
<% if @file.locked_for_user? %>
|
||||
<p class="warning"><%= l(:info_file_locked) %></p>
|
||||
<% else %>
|
||||
<%
|
||||
disabled_workflow = []
|
||||
selected_workflow = nil
|
||||
if !User.current.allowed_to?(:file_approval, @project)
|
||||
disabled_workflow << 2
|
||||
current_workflow = @file.last_revision.workflow
|
||||
if current_workflow == 1 || current_workflow == 2
|
||||
disabled_workflow << nil
|
||||
selected_workflow = 1
|
||||
end
|
||||
else
|
||||
selected_workflow = @file.last_revision.workflow
|
||||
end
|
||||
%>
|
||||
|
||||
<%= form_for(@revision, :url => {:action => "create_revision", :id => @file},
|
||||
:html => {:method=>:post, :multipart => true, :id => "new_revision_form"}) do |f| %>
|
||||
<div class="clear">
|
||||
@ -60,12 +45,13 @@ end
|
||||
</div>
|
||||
<p>
|
||||
<%= label_tag("workflow", l(:label_workflow) + ":") %>
|
||||
<%= select_tag("workflow",
|
||||
options_for_select([
|
||||
[l(:option_workflow_none), nil],
|
||||
[l(:option_workflow_waiting_for_approval), 1],
|
||||
[l(:option_workflow_approved), 2]],
|
||||
:selected => selected_workflow, :disabled => disabled_workflow)) %>
|
||||
<%= select_tag(
|
||||
'dmsf_workflow_id',
|
||||
dmsf_workflows_for_select(@project, @file.last_revision.dmsf_workflow_id))%>
|
||||
<% if @file.last_revision.dmsf_workflow_id && @file.last_revision.workflow == 3%>
|
||||
<%= submit_tag(l(:label_dmsf_wokflow_action_start)) %>
|
||||
<% end %>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
@ -78,7 +64,7 @@ end
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</small>
|
||||
</div>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
<br style="clear: both"/>
|
||||
<div class="custom_fields">
|
||||
@ -96,6 +82,7 @@ end
|
||||
</div>
|
||||
<br />
|
||||
<%= submit_tag(l(:submit_create)) %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -101,11 +101,13 @@
|
||||
</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 %>
|
||||
<%= #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>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<%
|
||||
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
|
||||
#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) %>
|
||||
@ -47,12 +47,10 @@ end
|
||||
</div>
|
||||
<p>
|
||||
<%= label_tag("commited_files[#{i}][workflow]", l(:label_workflow) + ":") %>
|
||||
<%= select_tag("commited_files[#{i}][workflow]",
|
||||
options_for_select([
|
||||
[l(:option_workflow_none), nil],
|
||||
[l(:option_workflow_waiting_for_approval), 1],
|
||||
[l(:option_workflow_approved), 2]],
|
||||
:selected => selected_workflow, :disabled => disabled_workflow)) %>
|
||||
<%= select_tag(
|
||||
"commited_files[#{i}][dmsf_workflow_id]",
|
||||
dmsf_workflows_for_select(@project, nil))%>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
|
||||
@ -30,11 +30,13 @@
|
||||
</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 %>
|
||||
<%= #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
|
||||
%>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
|
||||
@ -3,20 +3,22 @@
|
||||
<%= form_tag({:controller => 'dmsf_workflows',
|
||||
:action => 'new_action',
|
||||
:object_type => DmsfWorkflow,
|
||||
:object_id => @workflow,
|
||||
:project_id => @project},
|
||||
:object_id => @workflow.id,
|
||||
:project_id => @project.id},
|
||||
:remote => true,
|
||||
:method => :post,
|
||||
:id => 'new-action-form') do %>
|
||||
<p><label><%= radio_button_tag 'action', 'approve', true %> <%= l(:label_dmsf_wokflow_action_approve) %></label><br/></p>
|
||||
: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>
|
||||
|
||||
<p>
|
||||
<label><%= radio_button_tag 'action', 'reject' %> <%= l(:label_dmsf_wokflow_action_reject) %></label><br/>
|
||||
<label><%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_REJECT %> <%= l(:label_dmsf_wokflow_action_reject) %></label><br/>
|
||||
<%= text_area_tag :note, '', :placeholder => l(:message_dmsf_wokflow_note), :size => '38x2' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label><%= radio_button_tag 'action', 'delegate' %> <%= l(:label_dmsf_wokflow_action_delegate) %></label><br/>
|
||||
<label><%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_DELEGATE %> <%= l(:label_dmsf_wokflow_action_delegate) %></label><br/>
|
||||
<%= text_field_tag 'user_search', nil %>
|
||||
</p>
|
||||
|
||||
@ -27,7 +29,7 @@
|
||||
</div>
|
||||
|
||||
<p class="buttons">
|
||||
<%= submit_tag l(:button_add), :name => nil, :onclick => "hideModal(this);" %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
|
||||
<%= submit_tag l(:submit_commit), :name => nil, :onclick => 'hideModal(this);' %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'action', :locals => {:workflow => @workflow}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
$('#ajax-modal').addClass('new-action');
|
||||
$('#ajax-modal').addClass('new-action');
|
||||
2
app/views/dmsf_workflows/new_action.js.erb
Normal file
2
app/views/dmsf_workflows/new_action.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#ajax-modal').modal('hide').empty();
|
||||
window.location.reload();
|
||||
BIN
assets/images/draft.png
Normal file
BIN
assets/images/draft.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 461 B |
@ -1,50 +0,0 @@
|
||||
/* An image next to the approval workflow item in the administration menu */
|
||||
#admin-menu a.workflow { background-image: url(../images/ticket_go.png); }
|
||||
|
||||
.dmsf-entity-container {
|
||||
padding: 0% 2%;
|
||||
}
|
||||
|
||||
.dmsf-entity-container .dmsf-entity {
|
||||
padding: 5px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
li.dmsf-entity-file,
|
||||
li.dmsf-entity-folder {
|
||||
border: 1px solid #628DB6;
|
||||
border-width: 1px 0;
|
||||
list-style: none;
|
||||
zoom: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dmsf-entity-container .dmsf-entity .dmsf-col {
|
||||
float: left;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.dmsf-entity-container .dmsf-entity .dmsf-col.dmsf-entity-name {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.dmsf-entity-container .dmsf-entity .dmsf-col.dmsf-entity-cat {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.dmsf-entity-container .dmsf-entity .dmsf-col.dmsf-entity-lock {
|
||||
width: 5%;
|
||||
}
|
||||
|
||||
.dmsf-entity-container .dmsf-entity .dmsf-col.dmsf-entity-size {
|
||||
width: 10%;
|
||||
}
|
||||
.dmsf-entity-container .dmsf-entity .dmsf-col.dmsf-entity-modified {
|
||||
width: 10%;
|
||||
}
|
||||
.dmsf-entity-container .dmsf-entity .dmsf-col.dmsf-entity-action {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
#users_for_delegate {height: 200px; overflow:auto;}
|
||||
#users_for_delegate label {display: block;}
|
||||
@ -55,7 +55,7 @@ en:
|
||||
:title_locked_by_user: "Locked by %{user}"
|
||||
:title_locked_by_you: "Locked by you"
|
||||
:title_waiting_for_approval: "Waiting for Approval"
|
||||
:title_approved: "Approved"
|
||||
:title_approved: "Approved"
|
||||
:title_unlock_file: "Unlock to allow changes for other members"
|
||||
:title_lock_file: "Lock to prevent changes for other members"
|
||||
:submit_download: "Download"
|
||||
@ -95,9 +95,7 @@ en:
|
||||
:info_changed_by_user: "%{changed} by %{user}"
|
||||
:label_filename: "Filename"
|
||||
:label_version: "Version"
|
||||
:label_workflow: "Workflow"
|
||||
:option_workflow_waiting_for_approval: "Waiting for approval"
|
||||
:option_workflow_approved: "Approved"
|
||||
:label_workflow: "Workflow"
|
||||
:option_workflow_none: "None"
|
||||
:label_mime: "Mime"
|
||||
:label_size: "Size"
|
||||
@ -223,5 +221,8 @@ en:
|
||||
label_dmsf: DMSF
|
||||
label_dmsf_wokflow_action_approve: Approve
|
||||
label_dmsf_wokflow_action_reject: Reject
|
||||
label_dmsf_wokflow_action_delegate: 'Delegate to:'
|
||||
label_dmsf_wokflow_action_delegate: 'Delegate to'
|
||||
message_dmsf_wokflow_note: Your note...
|
||||
title_draft: Draft
|
||||
title_rejected: Rejected
|
||||
label_dmsf_wokflow_action_start: Start workflow
|
||||
@ -1,3 +1,21 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2013 Karel Picman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CreateDmsfWorkflows < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :dmsf_workflows do |t|
|
||||
@ -5,9 +23,14 @@ class CreateDmsfWorkflows < ActiveRecord::Migration
|
||||
t.references :project
|
||||
end
|
||||
add_index :dmsf_workflows, [:name], :unique => true
|
||||
|
||||
change_table :dmsf_file_revisions do |t|
|
||||
t.references :dmsf_workflow
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :dmsf_file_revisions, :dmsf_workflow_id
|
||||
drop_table :dmsf_workflows
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2013 Karel Picman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CreateDmsfWorkflowSteps < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :dmsf_workflow_steps do |t|
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2013 Karel Picman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CreateDmsfWorkflowStepAssignments < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :dmsf_workflow_step_assignments do |t|
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2013 Karel Picman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CreateDmsfWorkflowStepActions < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :dmsf_workflow_step_actions do |t|
|
||||
|
||||
4
init.rb
4
init.rb
@ -66,9 +66,9 @@ Redmine::Plugin.register :redmine_dmsf do
|
||||
menu.push :approvalworkflows, {:controller => 'dmsf_workflows', :action => 'index'}, :caption => :label_dmsf_workflow_plural
|
||||
end
|
||||
|
||||
# Adds javascript and stylesheet tags for project tree view
|
||||
# Adds stylesheet tag
|
||||
class DmsfViewListener < Redmine::Hook::ViewListener
|
||||
def view_layouts_base_html_head(context)
|
||||
def view_layouts_base_html_head(context)
|
||||
stylesheet_link_tag('dmsf', :plugin => :redmine_dmsf)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user