diff --git a/app/models/dmsf_workflow_step.rb b/app/models/dmsf_workflow_step.rb index 647b9136..45a7b43b 100644 --- a/app/models/dmsf_workflow_step.rb +++ b/app/models/dmsf_workflow_step.rb @@ -17,10 +17,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DmsfWorkflowStep < ActiveRecord::Base - belongs_to :workflow - + belongs_to :dmsf_workflow has_many :dmsf_workflow_step_assignments, :dependent => :destroy - validates :dmsf_workflow_id, :presence => true validates :step, :presence => true validates :user_id, :presence => true diff --git a/app/models/dmsf_workflow_step_assignment.rb b/app/models/dmsf_workflow_step_assignment.rb index 39d0f5ce..b1e88a29 100644 --- a/app/models/dmsf_workflow_step_assignment.rb +++ b/app/models/dmsf_workflow_step_assignment.rb @@ -19,9 +19,9 @@ class DmsfWorkflowStepAssignment < ActiveRecord::Base belongs_to :dmsf_workflow_step belongs_to :user + belongs_to :dmsf_file_revision has_many :dmsf_workflow_step_actions, :dependent => :destroy - validates :dmsf_workflow_step_id, :presence => true - validates :dmsf_file_revision_id, :presence => true + validates :dmsf_workflow_step_id, :dmsf_file_revision_id, :presence => true validates_uniqueness_of :dmsf_workflow_step_id, :scope => [:dmsf_file_revision_id] def add?(dmsf_file_revision_id) diff --git a/app/views/my/blocks/_locked_documents.html.erb b/app/views/my/blocks/_locked_documents.html.erb new file mode 100644 index 00000000..d9448220 --- /dev/null +++ b/app/views/my/blocks/_locked_documents.html.erb @@ -0,0 +1,82 @@ +<%# +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2013 Karel Picman +# +# 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. +%> + +<% folders = DmsfFolder.joins( + 'JOIN dmsf_locks ON dmsf_folders.id = dmsf_locks.entity_id').where( + 'dmsf_locks.entity_type' => 1, 'dmsf_locks.user_id' => @user.id).all %> +<% files = DmsfFile.joins( + 'JOIN dmsf_locks ON dmsf_files.id = dmsf_locks.entity_id').where( + 'dmsf_locks.entity_type' => 0, 'dmsf_locks.user_id' => @user.id).all %> +

<%= l(:label_my_locked_documents)%> (<%= folders.count %>/<%= files.count %>)

+<% if folders.any? || files.any?%> + <%= form_tag({}) do %> +
+ + + + + + + + + <% folders.each do |folder| %> + + + + + + <% end %> + <% files.each do |file| %> + + + + + + <% end %> + +
<%=l(:field_project)%><%=l(:label_document)%>/<%=l(:field_folder)%><%=l(:field_folder)%>
+ <%= link_to_project(folder.project) %> + + <%= link_to(h(folder.title), + {:controller => 'dmsf', :action => 'show', :id => folder.project, :folder_id => folder}, + :class => 'icon icon-folder') %> + + <% if folder.folder %> + <%= link_to(h(folder.folder.title), + {:controller => 'dmsf', :action => 'show', :id => folder.project, :folder_id => folder.folder}) %> + <% else %> + <%= link_to(l(:link_documents), {:controller => 'dmsf', :action => 'show', :id=> folder.project }) %> + <% end %> +
+ <%= link_to_project(file.project) %> + + <%= link_to(h(file.last_revision.display_title), + {:controller => 'dmsf_files', :action => :show, :id => file }, + :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}") %> + + <% if file.folder %> + <%= link_to(h(file.folder.title), + {:controller => 'dmsf', :action => 'show', :id => file.project, :folder_id => file.folder}) %> + <% else %> + <%= link_to(l(:link_documents), {:controller => 'dmsf', :action => 'show', :id=> file.project }) %> + <% end %> +
+ <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/my/blocks/_open_approvals.html.erb b/app/views/my/blocks/_open_approvals.html.erb new file mode 100644 index 00000000..69737e83 --- /dev/null +++ b/app/views/my/blocks/_open_approvals.html.erb @@ -0,0 +1,75 @@ +<%# +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2013 Karel Picman +# +# 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. +%> + +<% all_assignments = DmsfWorkflowStepAssignment.joins( + 'LEFT JOIN dmsf_workflow_step_actions ON dmsf_workflow_step_assignments.id = dmsf_workflow_step_actions.dmsf_workflow_step_assignment_id').where( + 'dmsf_workflow_step_assignments.user_id = ? AND dmsf_workflow_step_actions.id IS NULL', @user.id).all %> +<% assignments = Array.new %> +<% all_assignments.each do |assignment| %> + <% if assignment.dmsf_file_revision == assignment.dmsf_file_revision.file.last_revision %> + <% assignments << assignment %> + <% end %> +<% end %> +

<%= l(:label_my_open_approvals)%> (<%= assignments.count %>)

+<% if assignments.any? %> + <%= form_tag({}) do %> +
+ + + + + + + + + + <% assignments.each do |assignment| %> + + + + + + + <% end %> + +
<%=l(:field_project)%><%=l(:field_label_dmsf_workflow)%><%=l(:label_document)%><%=l(:field_folder)%>
+ <%= link_to_project(assignment.dmsf_file_revision.project) %> + + <% if assignment.dmsf_workflow_step && assignment.dmsf_workflow_step.dmsf_workflow %> + <%= link_to(h(assignment.dmsf_workflow_step.dmsf_workflow.name), + edit_dmsf_workflow_path(assignment.dmsf_workflow_step.dmsf_workflow)) %> + <% end %> + + <% if assignment.dmsf_file_revision && assignment.dmsf_file_revision.file %> + <%= link_to(h(assignment.dmsf_file_revision.display_title), + {:controller => 'dmsf_files', :action => :show, :id => assignment.dmsf_file_revision.file }) %> + <% end %> + + <% if assignment.dmsf_file_revision %> + <% if assignment.dmsf_file_revision.folder %> + <%= link_to(h(assignment.dmsf_file_revision.folder.title), + {:controller => 'dmsf', :action => 'show', :id=> assignment.dmsf_file_revision.project, :folder_id => assignment.dmsf_file_revision.folder}) %> + <% else %> + <%= link_to(l(:link_documents), {:controller => 'dmsf', :action => 'show', :id => assignment.dmsf_file_revision.project }) %> + <% end %> + <% end %> +
+ <% end %> +<% end %> \ No newline at end of file diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 2c51a31b..75165372 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -256,4 +256,9 @@ cs: text_email_started: "Schvalovací proces '%{name}' přiřazený k dokumentu '%{filename}' byl zahájen a od Vás se očekává schválení v aktuálním schvalovacím kroku." text_email_to_proceed: Pro schválení klikněte na zaškrtávací ikonku vedle dokumentu v text_email_to_see_history: Pro zobrazení historie schvalovacího procesu klikněte na status dokumentu v - text_email_to_see_status: Pro zobrazení aktuálního stavu schvalovacího procesu klikněte na status dokumentu v \ No newline at end of file + text_email_to_see_status: Pro zobrazení aktuálního stavu schvalovacího procesu klikněte na status dokumentu v + + my: + blocks: + locked_documents: Zamčené dokumenty + open_approvals: Procesy ke schválení \ No newline at end of file diff --git a/config/locales/de.yml b/config/locales/de.yml index 0a57f1a6..532953d3 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -258,4 +258,9 @@ de: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + + my: + blocks: + locked_documents: Locked documents + open_approvals: Open approvals \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index ffbf685c..1508a47f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -256,4 +256,11 @@ en: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + label_my_open_approvals: My open approvals + label_my_locked_documents: My locked documents + + my: + blocks: + locked_documents: Locked documents + openap_provals: Open approvals diff --git a/config/locales/es.yml b/config/locales/es.yml index 1a78070a..c3aec49a 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -258,4 +258,9 @@ es: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + + my: + blocks: + locked_documents: Locked documents + open_approvals: Open approvals \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index cb16576a..b959efdd 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -258,4 +258,9 @@ fr: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + + my: + blocks: + locked_documents: Locked documents + open_approvals: Open approvals \ No newline at end of file diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 4dd18d02..7a01a462 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -258,4 +258,9 @@ ja: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + + my: + blocks: + locked_documents: Locked documents + open_approvals: Open approvals \ No newline at end of file diff --git a/config/locales/ru.yml b/config/locales/ru.yml index d6740dce..d1d7dd7f 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -258,4 +258,9 @@ ru: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + + my: + blocks: + locked_documents: Locked documents + open_approvals: Open approvals \ No newline at end of file diff --git a/config/locales/sl.yml b/config/locales/sl.yml index fe07e027..868f8006 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -258,4 +258,9 @@ sl: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + + my: + blocks: + locked_documents: Locked documents + open_approvals: Open approvals \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 5344b516..df487563 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -259,4 +259,9 @@ zh: text_email_started: "The approval workflow '%{name}' assigned to '%{filename}' document has just been started and you are expected to do an approval in the current approval step." text_email_to_proceed: To proceed click on the check box icon next to the document in text_email_to_see_history: To see the approval history click on the workflow status of the document in - text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in \ No newline at end of file + text_email_to_see_status: To see the current status of the approval workflow click on the workflow status the document in + + my: + blocks: + locked_documents: Locked documents + open_approvals: Open approvals \ No newline at end of file