From b32e7363299ef02a35d885ffdaef2f3feefb0af9 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Tue, 20 Oct 2015 14:28:23 +0200 Subject: [PATCH 01/32] Cannot upload big files #458 --- db/migrate/20151020141801_large_files.rb | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 db/migrate/20151020141801_large_files.rb diff --git a/db/migrate/20151020141801_large_files.rb b/db/migrate/20151020141801_large_files.rb new file mode 100644 index 00000000..b1fe3a1a --- /dev/null +++ b/db/migrate/20151020141801_large_files.rb @@ -0,0 +1,29 @@ +# encoding: utf-8 +# +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2011-15 Karel Pičman +# +# 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 LargeFiles < ActiveRecord::Migration + def up + change_column :dmsf_file_revisions, :size, :bigint, :null => true + end + + def down + change_column :dmsf_file_revisions, :size, :int, :null => true + end +end \ No newline at end of file From cd9118451a770df254ad94d8c111ccb9f37a9e23 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 27 Oct 2015 15:18:25 +0100 Subject: [PATCH 02/32] Wrong delete button be url links --- app/views/dmsf/_url.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/dmsf/_url.html.erb b/app/views/dmsf/_url.html.erb index 85ae664d..9b7848c0 100644 --- a/app/views/dmsf/_url.html.erb +++ b/app/views/dmsf/_url.html.erb @@ -39,7 +39,7 @@ - <%= link_to('delete.png', + <%= link_to(image_tag('delete.png'), dmsf_link_path(link), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, @@ -55,4 +55,4 @@ 1 link.updated_at.to_i - \ No newline at end of file + From 631da1774ed557e4ac4a4858c4b6c9fb6ef18f7a Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Wed, 4 Nov 2015 09:53:48 +0100 Subject: [PATCH 03/32] Install using debian 8 (jessie) #465 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b0231fdb..2a37fc4a 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,16 @@ From Omega documentation: On Debian use: -```apt-get install libxapian-ruby1.9.1 xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip\ +```apt-get install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip\ catdoc libwpd-0.9-9 libwps-0.2-2 gzip unrtf catdvi djview djview3 uuid uuid-dev``` On Ubuntu use: -```sudo apt-get install libxapian-ruby1.9.1 xapian-omega libxapian-dev xpdf antiword\ +```sudo apt-get install xapian-omega libxapian-dev xpdf antiword\ unzip catdoc libwpd-0.9-9 libwps-0.2-2 gzip unrtf catdvi djview djview3 uuid uuid-dev``` On CentOS user: -```sudo yum install libxapian-ruby1.9.1 xapian-omega libxapian-dev xpdf antiword\ unzip catdoc libwpd-0.9-9 libwps-0.2-2 gzip unrtf catdvi djview djview3 uuid uuid-dev``` +```sudo yum install xapian-omega libxapian-dev xpdf antiword\ unzip catdoc libwpd-0.9-9 libwps-0.2-2 gzip unrtf catdvi djview djview3 uuid uuid-dev``` Usage ----- From 94da341f9f6589eab59021f45d003d8d4cc7d29c Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Wed, 4 Nov 2015 10:04:21 +0100 Subject: [PATCH 04/32] :only_path => false is the default option --- app/views/dmsf_files/show.api.rsb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/dmsf_files/show.api.rsb b/app/views/dmsf_files/show.api.rsb index e846a86d..f998adce 100644 --- a/app/views/dmsf_files/show.api.rsb +++ b/app/views/dmsf_files/show.api.rsb @@ -4,5 +4,5 @@ api.dmsf_file do api.project_id @file.project_id api.dmsf_folder_id @file.folder if @file.dmsf_folder_id api.version "#{@file.last_revision.major_version}.#{@file.last_revision.minor_version}" if @file.last_revision - api.content_url url_for(:controller => :dmsf_files, :action => 'show', :download => '', :id => @file, :only_path => false) + api.content_url url_for(:controller => :dmsf_files, :action => 'show', :download => '', :id => @file) end \ No newline at end of file From c272c6d7f41f6a009a70d5b6d22f019cf747b85d Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Wed, 4 Nov 2015 11:12:23 +0100 Subject: [PATCH 05/32] No default approval workflow while assigning --- app/controllers/dmsf_workflows_controller.rb | 36 +++++++++----------- app/helpers/dmsf_workflows_helper.rb | 1 + app/views/dmsf_workflows/_assign.html.erb | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index a7b213b1..126fd262 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -51,8 +51,7 @@ class DmsfWorkflowsController < ApplicationController begin file.unlock! true rescue DmsfLockError => e - flash[:info] = e.message - #logger.warn e.message + flash[:info] = e.message end end if revision.workflow == DmsfWorkflow::STATE_APPROVED @@ -171,28 +170,27 @@ class DmsfWorkflowsController < ApplicationController end def assignment - if params[:commit] == l(:button_submit) + if (params[:commit] == l(:button_submit)) && + params[:dmsf_workflow_id].present? && (params[:dmsf_workflow_id] != '-1') revision = DmsfFileRevision.find_by_id params[:dmsf_file_revision_id] if revision - revision.set_workflow(params[:dmsf_workflow_id], params[:action]) - if params[:dmsf_workflow_id].present? - revision.assign_workflow(params[:dmsf_workflow_id]) - if request.post? - if revision.save - file = DmsfFile.find_by_id revision.dmsf_file_id - if file - begin - file.lock! - rescue DmsfLockError => e - logger.warn e.message - end - flash[:notice] = l(:notice_successful_update) + revision.set_workflow(params[:dmsf_workflow_id], params[:action]) + revision.assign_workflow(params[:dmsf_workflow_id]) + if request.post? + if revision.save + file = DmsfFile.find_by_id revision.dmsf_file_id + if file + begin + file.lock! + rescue DmsfLockError => e + logger.warn e.message end - else - flash[:error] = l(:error_workflow_assign) + flash[:notice] = l(:notice_successful_update) end + else + flash[:error] = l(:error_workflow_assign) end - end + end end end redirect_to :back diff --git a/app/helpers/dmsf_workflows_helper.rb b/app/helpers/dmsf_workflows_helper.rb index 90ca653a..d930bb76 100644 --- a/app/helpers/dmsf_workflows_helper.rb +++ b/app/helpers/dmsf_workflows_helper.rb @@ -55,6 +55,7 @@ module DmsfWorkflowsHelper def dmsf_workflows_for_select(project, dmsf_workflow_id) options = Array.new + options << ['', -1] DmsfWorkflow.sorted.where(['project_id = ? OR project_id IS NULL', project.id]).each do |wf| if wf.project_id options << [wf.name, wf.id] diff --git a/app/views/dmsf_workflows/_assign.html.erb b/app/views/dmsf_workflows/_assign.html.erb index e5a6070f..83be9a13 100644 --- a/app/views/dmsf_workflows/_assign.html.erb +++ b/app/views/dmsf_workflows/_assign.html.erb @@ -1,6 +1,6 @@ <%# Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011/15 Karel Pičman +# Copyright (C) 2011-15 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License From 6d2487ca81a590ca4c0a0bed2d74bf48993a8153 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Fri, 6 Nov 2015 09:28:41 +0100 Subject: [PATCH 06/32] Install using debian 8 (jessie) #465 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index c9cb0bd0..09583ee6 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ group :production do gem 'nokogiri', '>= 1.5.10' end -#Allows --without=xapian group :xapian do + gem "xapian-ruby", :require => false gem 'xapian-full-alaveteli', :require => false end From 6c4bd03cebfc510b3f826bb67ea4156709c31a30 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Fri, 6 Nov 2015 09:36:26 +0100 Subject: [PATCH 07/32] Install using debian 8 (jessie) #465 --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2a37fc4a..063c2a06 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,17 @@ From Omega documentation: On Debian use: -```apt-get install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip\ - catdoc libwpd-0.9-9 libwps-0.2-2 gzip unrtf catdvi djview djview3 uuid uuid-dev``` +```sudo apt-get install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip\ +catdoc libwpd-0.10-10 libwps-0.4-4 gzip unrtf catdvi djview djview3 uuid uuid-dev``` On Ubuntu use: -```sudo apt-get install xapian-omega libxapian-dev xpdf antiword\ -unzip catdoc libwpd-0.9-9 libwps-0.2-2 gzip unrtf catdvi djview djview3 uuid uuid-dev``` +```sudo apt-get install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip \ +catdoc libwpd-0.10-10 libwps-0.4-4 gzip unrtf catdvi djview djview3 uuid uuid-dev``` On CentOS user: -```sudo yum install xapian-omega libxapian-dev xpdf antiword\ unzip catdoc libwpd-0.9-9 libwps-0.2-2 gzip unrtf catdvi djview djview3 uuid uuid-dev``` +```sudo yum install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip \ +catdoc libwpd-0.10-10 libwps-0.4-4 gzip unrtf catdvi djview djview3 uuid uuid-dev``` Usage ----- From cc4cebb42760d78b4440f807b90c63206ea8fc0d Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Fri, 6 Nov 2015 09:42:16 +0100 Subject: [PATCH 08/32] Install using debian 8 (jessie) #465 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 063c2a06..dbf5de89 100644 --- a/README.md +++ b/README.md @@ -78,16 +78,16 @@ From Omega documentation: On Debian use: ```sudo apt-get install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip\ -catdoc libwpd-0.10-10 libwps-0.4-4 gzip unrtf catdvi djview djview3 uuid uuid-dev``` +catdoc libwpd-tools libwps-tools gzip unrtf catdvi djview djview3 uuid uuid-dev``` On Ubuntu use: ```sudo apt-get install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip \ -catdoc libwpd-0.10-10 libwps-0.4-4 gzip unrtf catdvi djview djview3 uuid uuid-dev``` +catdoc libwpd-tools libwps-tools gzip unrtf catdvi djview djview3 uuid uuid-dev``` On CentOS user: ```sudo yum install xapian-omega libxapian-dev xpdf xpdf-utils antiword unzip \ -catdoc libwpd-0.10-10 libwps-0.4-4 gzip unrtf catdvi djview djview3 uuid uuid-dev``` +catdoc libwpd-tools libwps-tools gzip unrtf catdvi djview djview3 uuid uuid-dev``` Usage ----- From d42eb93415623ee2172e5a7582a2833999d3bb14 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Wed, 11 Nov 2015 10:47:05 +0100 Subject: [PATCH 09/32] dmsfd doesn't reuse Wiki syntax in Wiki page #469 --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index b73da6ec..3c86636b 100644 --- a/init.rb +++ b/init.rb @@ -143,7 +143,7 @@ Redmine::Plugin.register :redmine_dmsf do raise ArgumentError if args.length < 1 # Requires file id file = DmsfFile.visible.find args[0].strip if User.current && User.current.allowed_to?(:view_dmsf_files, file.project) - return file.description + return textilizable(file.description) else raise l(:notice_not_authorized) end From 0dbd84114fc5aa989905dd7c2bda6e715aa6cd12 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Wed, 11 Nov 2015 13:52:04 +0100 Subject: [PATCH 10/32] Display contents of text file in Wiki page #468 --- CHANGELOG.md | 11 +++ README.md | 5 +- app/models/dmsf_file.rb | 22 +++++ extra/help_files_dmsf.diff | 194 +++++++++++++++++++++++++++---------- init.rb | 15 ++- 5 files changed, 196 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff4efabb..6cef6460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ Changelog for Redmine DMSF ========================== +1.5.6 *2015-??-??* +------------------ + +* Bug: #469 - dmsfd doesn't reuse Wiki syntax in Wiki page +* New: #468 - Display contents of text file in Wiki page +* Bug: #465 - Install using debian 8 (jessie) +* Bug: #459 - WebDav Windows +* Bug: #458 - Cannot upload big files + + Maintenance release II. + 1.5.5 *2015-10-19* ------------------ diff --git a/README.md b/README.md index dbf5de89..802f088f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Redmine DMSF Plugin =================== -The current version of Redmine DMSF is **1.5.5** [![Build Status](https://api.travis-ci.org/danmunn/redmine_dmsf.png)](https://travis-ci.org/danmunn/redmine_dmsf) +The current version of Redmine DMSF is **1.5.6 devel** [![Build Status](https://api.travis-ci.org/danmunn/redmine_dmsf.png)](https://travis-ci.org/danmunn/redmine_dmsf) Redmine DMSF is Document Management System Features plugin for Redmine issue tracking system; It is aimed to replace current Redmine's Documents module. @@ -107,6 +107,9 @@ Search will now automatically search DMSF content when a Redmine search is perfo ####Link to the description of a file with id 17 `{{dmsfd(17)}}` +####Link to the preview of the first 5 lines from a file with id 17 +`{{dmsft(17, 5)}}` + ####An inline picture of the file with id 8; it must be an image file such as JPEG, PNG,... `{{dmsf_image(8)}}` diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 6c535dae..e35bd8b7 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -406,5 +406,27 @@ class DmsfFile < ActiveRecord::Base def image? self.last_revision && !!(self.last_revision.disk_filename =~ /\.(bmp|gif|jpg|jpe|jpeg|png)$/i) end + + def preview(limit) + result = 'No preview available' + if (self.last_revision.disk_filename =~ /\.(txt|ini|diff|c|cpp|php|csv|rb|h|erb|html|css)$/i) + begin + f = File.new(self.last_revision.disk_file) + f.each_line do |line| + case f.lineno + when 1 + result = line + when limit.to_i + 1 + break + else + result << line + end + end + rescue Exception => e + result = e.message + end + end + result + end end \ No newline at end of file diff --git a/extra/help_files_dmsf.diff b/extra/help_files_dmsf.diff index 525df229..ddbaee5f 100644 --- a/extra/help_files_dmsf.diff +++ b/extra/help_files_dmsf.diff @@ -2,7 +2,7 @@ Index: public/help/ar/wiki_syntax_detailed_markdown.html =================================================================== --- public/help/ar/wiki_syntax_detailed_markdown.html (revision 14471) +++ public/help/ar/wiki_syntax_detailed_markdown.html (working copy) -@@ -70,13 +70,21 @@ +@@ -70,13 +70,22 @@

Links to other resources: