Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Keep Ruby sources identical on Linux, macOS and Windows checkouts.
*.rb text eol=lf
*.rake text eol=lf
Gemfile text eol=lf
PluginGemfile text eol=lf
Rakefile text eol=lf
35 changes: 24 additions & 11 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@
name: "GitHub CI"
on:
push:
branches: ["master"]
branches: ["master", "onlyoffice", "feature/onlyoffice-dmsf-integration"]
pull_request:
branches: ["master"]
branches: ["master", "onlyoffice"]
workflow_dispatch:
permissions:
contents: read
jobs:
plugin_tests:
strategy:
fail-fast: false
matrix:
redmine: ["7.0.0", "7.0.1"]
engine: [mysql, postgresql, sqlite]
include:
- engine: mysql
Expand Down Expand Up @@ -83,8 +87,8 @@ jobs:
sudo apt-get update
sudo apt-get install -y litmus libreoffice subversion xapian-omega
- name: Clone Redmine
# Get the latest stable Redmine
run: svn export https://svn.redmine.org/redmine/branches/7.0-stable/ /opt/redmine
# Test exact releases instead of a moving stable branch
run: svn export https://svn.redmine.org/redmine/tags/${{matrix.redmine}}/ /opt/redmine
- name: Checkout code
uses: actions/checkout@v3
- name: Link the plugin
Expand All @@ -94,7 +98,6 @@ jobs:
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1 # The latest major version
with:
bundler-cache: true
ruby-version: '3.4'
- name: Setup database
# Create the database
Expand Down Expand Up @@ -130,6 +133,7 @@ jobs:
echo " service: Disk" >> /opt/redmine/config/storage.yml
echo " root: <%= Rails.root.join('dmsf_as_test') %>" >> /opt/redmine/config/storage.yml
- name: Install Redmine
id: install
# Install Redmine
run: |
cd /opt/redmine
Expand All @@ -143,13 +147,21 @@ jobs:
bundle exec rake assets:precompile
env:
REDMINE_LANG: en
- name: Standard tests
# Run the tests
- name: Unit tests
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: |
cd /opt/redmine
bundle exec rake redmine:plugins:test:units
bundle exec rake redmine:plugins:test:functionals
bundle exec rake redmine:plugins:test:integration
bundle exec rake redmine:plugins:test:units NAME=redmine_dmsf RAILS_ENV=test
- name: Functional tests
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: |
cd /opt/redmine
bundle exec rake redmine:plugins:test:functionals NAME=redmine_dmsf RAILS_ENV=test
- name: Integration tests
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: |
cd /opt/redmine
bundle exec rake redmine:plugins:test:integration NAME=redmine_dmsf RAILS_ENV=test
- name: Helpers tests
run: |
cd /opt/redmine
Expand All @@ -158,6 +170,7 @@ jobs:
ruby plugins/redmine_dmsf/test/helpers/dmsf_links_helper_test.rb
ruby plugins/redmine_dmsf/test/helpers/dmsf_queries_helper_test.rb
- name: Rubocop
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
# Run the Rubocop tests
run: |
cd /opt/redmine
Expand Down Expand Up @@ -191,5 +204,5 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: "test_${{matrix.engine}}.log"
name: "test_${{matrix.redmine}}_${{matrix.engine}}.log"
path: /opt/redmine/log/test.log
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ AllCops:
- '**/vendor/**/*'

# Rules for DMSF
Layout/EndOfLine:
EnforcedStyle: lf

Layout/LineLength:
Exclude:
- app/models/dmsf_query.rb
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ Further information about the GPL license can be found at
* Editing of office documents
* [REST API](https://github.com/picman/redmine_dmsf/wiki/REST-API)
* DMS Document revision as a custom field type
* Compatible with Redmine 6.1
* Compatible with Redmine 7.0

## Dependencies

* Redmine 6.1 or higher
* Redmine 7.0 or higher

### Full-text search (optional)

Expand Down Expand Up @@ -143,6 +143,33 @@ The command must be runable by the web app's user. Test it in advance, e.g:
sudo apt install libreoffice liblibreoffice-java
```

## ONLYOFFICE Docs integration (optional)

DMSF can open supported documents in an existing ONLYOFFICE Document Server for viewing and collaborative editing.
Unlike the standard ONLYOFFICE Redmine connector, the callback stores the edited content as a new DMSF revision instead
of overwriting a Redmine `Attachment`.

Configure the integration in **Administration → Plugins → DMSF → Configure**:

* Set the public Document Editing Service address.
* Set the internal Document Server and Redmine addresses when the two services communicate through private DNS names.
* Set the same JWT secret, HMAC algorithm, and authorization header used by ONLYOFFICE Docs.
* If the official `onlyoffice_redmine` plugin is installed, DMSF can reuse its server, JWT, internal URL, and TLS settings.
* Leave `office_bin` empty when LibreOffice PDF previews are no longer required.

After upgrading, run the plugin migration so the callback can record an idempotency key for each saved DMSF revision:

```
RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_dmsf
```

The Document Server must be able to download signed DMSF URLs and POST callbacks to Redmine. Redmine must be able to
download the saved file URL returned by the Document Server.

DMSF persists the final ONLYOFFICE callback (status `2`) as a new revision. Force-save callbacks are deliberately not
stored as revisions, which avoids creating a new DMSF version for every automatic save. If another DMSF revision is
uploaded while the editor is open, the callback is rejected rather than replacing newer work.

## Usage

DMSF is designed to act as project module, so it must be checked as an enabled module within the project settings.
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/dmsf_context_menus_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def dmsf
User.current.allowed_to?(:force_file_unlock, @project))
@email_allowed = User.current.allowed_to?(:email_documents, @project)
@preview = RedmineDmsf.office_bin.present? && RedmineDmsf::Preview.office_available?
@onlyoffice_view = RedmineDmsf::OnlyOffice.viewable?(@dmsf_file.name)
@onlyoffice_edit = @onlyoffice_view && RedmineDmsf::OnlyOffice.editable?(@dmsf_file.name)
elsif @dmsf_folder
@locked = @dmsf_folder.locked?
@project = @dmsf_folder.project
Expand Down
Loading