Skip to content

Commit c7ce922

Browse files
author
Michele Tessaro
committed
Merge branch 'release-v1.0.0'
2 parents 5bf6982 + d017320 commit c7ce922

File tree

21 files changed

+499
-171
lines changed

21 files changed

+499
-171
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# Changelog
22

33

4+
## development (unreleased)
5+
6+
### New
7+
8+
* Added page and layer selector for XML diagrams (refs #86) [Michele Tessaro]
9+
10+
* Fixed patch for building draw.io server (fixes #81) [Michele Tessaro]
11+
12+
### Changes
13+
14+
* Updated README for the new release. [Michele Tessaro]
15+
16+
* Updated CHANGELOG. [Michele Tessaro]
17+
18+
### Fix
19+
20+
* Fixed save on recents dmsf (refs #87) [Michele Tessaro]
21+
22+
* Fixed wrong url hint in config dialog. [Michele Tessaro]
23+
24+
425
## v0.9.9 (2020-12-19)
526

627
### New

README.md

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,35 @@ In the configuration form you can set the Drawio server url; the default is `//e
3333

3434
In this form you can also enable the mathematical symbol support for SVG diagrams. The default is disabled because enabling this adds about 170k of Javascript to download, so enable only if you really need it.
3535

36+
3637
## Usage
3738

3839
There are three macros that can be used to embed diagrams in wiki pages/issues; use what best fits your needs.
3940

41+
4042
### `drawio` macro
41-
This macro draws diagrams saved in attachments. This is for compatibility with `0.1.x` versions of the plugin and is now a bit obsolete. To use it:
4243

43-
- save your [draw.io] diagram locally and upload it as attachment to a Wiki or issue page.
44-
- in Wiki (or issue) pages use the `drawio` macro to load the widget, specifying the name of the attachment. For example:
44+
This macro is now deprecated and not working anymore. Use the `drawio_attach` macro as a direct replacement.
4545

46-
```
47-
{{drawio(activity.xml, options)}}
48-
```
49-
- the following macro options are available (default values are shown):
50-
- ``lightbox=false`` : enable lightbox usage
51-
- ``resize=false`` : enable zoom control box
52-
- ``zoom=100`` : initial zoom of diagram (percentage of original diagram)
53-
- ``fit=true`` : fit page width (only if ``resize=false``)
54-
- ``hilight=#0000ff`` : color to hilight hyperlinks
55-
56-
With this macro diagrams are drawn using SVG (or maybe Canvas) so they are interactive: they are navigable,
57-
they respond to ``over`` and ``click`` actions. Hyperlinks can be used to navigate to other items.
5846

59-
This macro render diagrams as SVG, so diagrams are interactive and navigable (link can be used to navigate to other pages).
47+
### `drawio_attach` macro
6048

61-
This macro is now obsolete: you can now use SVG diagrams with the other two macros (``drawio_attach`` and ``drawio_dmsf``)
62-
but you must import the the diagram in the *draw.io editor* and then export as SVG with an included copy of the diagram
63-
(see the *Export as SVG* function of the *draw.io editor*).
49+
This macro handles diagrams saved as attachments of issues or wiki pages.
6450

65-
### `drawio_attach` macro
66-
This macro handles diagrams saved as attachments of issues or wiki pages.
51+
The supported diagrams format are:
52+
* `xml`: normal diagram source in XML format
53+
* `png`: PNG image with an embedded XML source of the diagram (PNG+XML)
54+
* `svg`: SVG image with an embedded XML source of the diagram (SVG+XML)
55+
56+
The `xml` format uses a Javascript viewer to render the diagram runtime. It maybe a bit slow, but adds navigation options to the diagram (zoom, page and layer selector).
6757

6858
With this macro the attachments are in PNG+XML, a special format consisting in an PNG image of the diagram plus the XML diagram source embeded as a field of the image.
6959

7060
With an``.svg`` attachment name extension the image format is handled as SVG+XML; like the PNG+XML, this is an SVG image
7161
with an embedded XML source of the diagram (the diagram must be created with the *draw.io editor*, normal SVG are displayed but cannot be edited).
7262

63+
From version `1.0.0` are also supported diagrams in XML format (as used with the old `drawio` macro).
64+
7365
Usage is very simple:
7466

7567
- **make sure ``REST`` API are enabled in Redmine global settings**; this **is needed** to be able to save diagrams as attachments. To enable it, go into `Administration` -> `Settings` -> `API` tab and check the `Enable REST web service` flag.
@@ -81,19 +73,30 @@ Usage is very simple:
8173

8274
![Diagram placeholder][diagramPlaceholder]
8375

84-
Double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved in a new attachment and the reference in the wiki/issue page is updated.
76+
For PNG and SVG diagrams, double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved in a new attachment and the reference in the wiki/issue page is updated.
77+
78+
For XML diagrams, a toolbar will appear when the mouse enters the diagram area; in the toolbar there is a button for start editing the diagram.
8579

8680
The **diagram attachments are versioned** by suffixing the name with a counter. This is necessary because is not possible to update an existing attachment. Moreover, is not possible to delete attachments throught rest API (seems to be possible from Redmine 3.3.0, but I need to experiment), so the old versions of an attachment must be explicitly (manually) deleted from the Redmine web interface.
8781

8882
- the following macro options are available (default values are shown):
8983
- ``size=number`` : force image width, in pixels (default, show in original size)
84+
- only for XML diagrams:
85+
- ``hilight=#0000ff``: color to highlight diagram hyperlinks
86+
- ``tbautohide=true``: if `false` the toolbar is always visibile (if there are buttons), else it will be shown only when the mouse enters the diagram area
87+
- ``lightbox=false``: activates the *LightBox* viewer button in the toolbar
88+
- ``zoom=false``: activates the zoom buttons in the toolbar
89+
- ``page=number``: if not empty a *page selector* will appear in the toolbar (for multi-page diagrams) and the initial page (starting from 0) will be selected
90+
- ``layers``: if set as a list of space separated number of layers, those layer will be activated for default, and a *layer selector* controlo will appear in the toolbar.
9091

9192
In the toolbar editor there is a button with icon ![drawio_attach icon](assets/images/jstb_drawio_attach.png) that opens a dialog that can be used to insert a macro for a new diagram to be saved as attachment (for lazy people).
9293

9394
The dialog can be used also for modifying a macro: simply place the caret (the cursor in the editing area) somewhere in the body of the macro, click the corresponding button in the toolbar, and the dialog will open with fields pre-filled with values from the macro source. When confirming new values, the macro source will be updated.
9495

96+
9597
### `drawio_dmsf` macro
96-
This macro handles diagrams saved in the [DMSF] repository as PNG+XML or SVG+XML images. The DMSF module must be enabled for the project to be able to use this macro.
98+
This macro handles diagrams saved in the [DMSF] repository as PNG+XML or SVG+XML images, or as XML documents (from version `1.0.0`). The DMSF module must be enabled for the project to be able to use this macro.
99+
97100
Usage is very simple:
98101

99102
- **enable the WebDAV functionality of the [DMSF] plugin in ``Read/Write`` mode**; this is necessary to be able to save the diagram from the embedded editor. If you prefer you can disable WebDAV after all editings are done.
@@ -105,21 +108,32 @@ Usage is very simple:
105108

106109
![Diagram placeholder][diagramPlaceholder]
107110

108-
Double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved (versioned) in the specified DMSF documents path for the current project, and the diagram will be automatically updated.
111+
For PNG and SVG diagrams, double click on the diagram to start editing with the embedded editor. When you save the the diagram the editor will close, the diagram will be saved in a new attachment and the reference in the wiki/issue page is updated.
112+
113+
For XML diagrams, a toolbar will appear when the mouse enters the diagram area; in the toolbar there is a button for start editing the diagram.
109114

110115
- the following macro options are available (default values are shown):
111116
- ``size=number`` : force image width, in pixels (default, show in original size)
117+
- only for XML diagrams:
118+
- ``hilight=#0000ff``: color to highlight diagram hyperlinks
119+
- ``tbautohide=true``: if `false` the toolbar is always visibile (if there are buttons), else it will be shown only when the mouse enters the diagram area
120+
- ``lightbox=false``: activates the *LightBox* viewer button in the toolbar
121+
- ``zoom=false``: activates the zoom buttons in the toolbar
122+
- ``page=number``: if not empty a *page selector* will appear in the toolbar (for multi-page diagrams) and the initial page (starting from 0) will be selected
123+
- ``layers``: if set as a list of space separated number of layers, those layer will be activated for default, and a *layer selector* controlo will appear in the toolbar.
112124

113125
Like for the ``drawio_attach`` macro, in the toolbar editor there is a button with icon ![drawio_attach icon](assets/images/jstb_drawio_dmsf.png) that opens a dialog that can be used to insert a macro for a new diagram to be saved as [DMSF] document.
114126

115127
As for the `drawio_attach` macro, the dialog can be used for updating a macro simply by positioning the editing cursor in the right place and clicking the button.
116128

117129

118130
## Some note on the drawio editor
131+
119132
Someone can be concerned about security in sending own diagrams to the [draw.io] site.
120133

121134
The diagrams aren't sent to [draw.io] for editing/rendering, but all the operations are done by the browser using only Javascript and HTML5. The only things loaded externally are the scripts and the editor page, when the diagram editor is opened. The diagram source remains local to browser/redmine site.
122135

136+
123137
## Using a personal installation of draw.io
124138

125139
If you like, you can configure this plugin to use your own installation of the [draw.io] site.
@@ -163,6 +177,7 @@ However it is possible to use a local installation of the library following thes
163177

164178
Once updated the settings, go to a wiki page with a mathematical SVG diagram and you should see the diagram exactly as before. You can check from where the library is downloaded using the browser developer tools.
165179

180+
166181
## Known issues
167182

168183
- Diagrams are rendered on the browser so they aren't visible inside a PDF export. As workaround you can print the web page as PDF document (easy with Linux, a bit more problematic in Windows), or export the diagram in PNG format and include it as image.
@@ -171,6 +186,7 @@ Once updated the settings, go to a wiki page with a mathematical SVG diagram and
171186

172187
- The ``drawio_attach`` macro doesn't completly work with issue notes: Redmine APIs allow to create new issue notes, but not to change them, so the issue note must be changed manually. As alternative use the ``drawio`` and ``drawio_dmsf`` macros, which work fine.
173188

189+
174190
## TODO
175191

176192
- Allow specify diagrams from other other sources:
@@ -186,24 +202,12 @@ Once updated the settings, go to a wiki page with a mathematical SVG diagram and
186202
+ url of image: the url is generated by the macro (from attachment or [DMSF]), using in a widget may require an AJAX call
187203

188204

189-
## Other works
190-
If you are using [draw.io] to create *Entity Relationship* database schemas, you may be interested to the [schema2script].
191-
192-
This is a Ruby command line tool that parses a [draw.io] ER diagram and produces a DDL script to initialize a database schema.
193-
194-
For now only [H2](http://www.h2database.com) and [Oracle](https://www.oracle.com/it/database) SQL dialects are supported, but it will grow in the future.
195-
196-
Related to [schema2script] is the [sboot] project, that helps to create a skeleton Java application based on [Spring boot](https://projects.spring.io/spring-boot). It creates entities, repositories ([Hibernate](http://hibernate.org) based for now), DTOs, services, REST interfaces, up to a simple CRUD web interface based on [Thymeleaf](www.thymeleaf.org) or [Angular2](https://angular.io). It also creates some tests, which can be used as a starting point for other, more specific tests.
197-
198-
It is in early state but it is promising; with the current version you can create a complete skeleton application starting from an ER schema, which may be a good starting point for more complex applications.
199-
200-
201205
## Contributing
202206

203207
Any code contribution is well accepted. There are only a few rules that I would like to be respected to easy merging:
204208

205209
- work on ``develop`` branch and leave the ``master`` branch untouched. This is importat to keep the released versions stable.
206-
- I would prefer comments in the style used by [gitchangelog](https://github.com/vaab/gitchangelog); this will simplify generation of the ``CHANGELOG.md``.
210+
- I would prefer comments in the style used by [gitchangelog](https://github.com/vaab/gitchangelog); this will simplify generation of the ``CHANGELOG.md``.
207211
It isn't fundamental, I can edit comments and insert prefixes, or edit manually the ``CHANGELOG.md``, but it would be nice if you can help me.
208212

209213

app/views/redmine_drawio/_macro_dialog.html.erb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,41 @@
1010
<label for="drawio_diagType"><%= l(:drawio_dlg_diagType) %></label>
1111
<input type="radio" name="drawio_diagType" value="png" checked="checked"/>PNG
1212
<input type="radio" name="drawio_diagType" value="svg" style="margin-left:1em"/>SVG
13+
<input type="radio" name="drawio_diagType" value="xml" style="margin-left:1em" id="drawio_diagTypeXml"/>XML
1314
</p>
1415
<p>
1516
<label for="drawio_size"><%= l(:drawio_dlg_size) %></label>
1617
<input type="text" name="drawio_size" id="drawio_size" class="digits" size="4" maxlength="4"/> pixel
1718
</p>
1819
</div>
1920
</fieldset>
21+
<fieldset id="drawio_xml_params" style="display: none">
22+
<div class="tabular">
23+
<p>
24+
<label for="drawio_tbautohide"><%= l(:drawio_dlg_toolbar_autohide) %></label>
25+
<input type="checkbox" name="drawio_tbautohide" id="drawio_tbautohide" checked="checked"/>
26+
</p>
27+
<p>
28+
<label for="drawio_lightbox"><%= l(:drawio_dlg_lightbox) %></label>
29+
<input type="checkbox" name="drawio_lightbox" id="drawio_lightbox"/>
30+
</p>
31+
<p>
32+
<label for="drawio_zoom"><%= l(:drawio_dlg_zoom) %></label>
33+
<input type="checkbox" name="drawio_zoom" id="drawio_zoom"/>
34+
</p>
35+
<p>
36+
<label for="drawio_page"><%= l(:drawio_dlg_page) %></label>
37+
<input type="text" name="drawio_page" id="drawio_page"/>
38+
</p>
39+
<p>
40+
<label for="drawio_layers"><%= l(:drawio_dlg_layers) %></label>
41+
<input type="text" name="drawio_layers" id="drawio_layers"/>
42+
</p>
43+
<p>
44+
<label for="drawio_hilight"><%= l(:drawio_dlg_hiligh) %></label>
45+
<input type="text" name="drawio_hilight" id="drawio_hilight" value="#0000ff"/>
46+
</p>
47+
</div>
48+
</fieldset>
2049
</form>
2150
</div>

0 commit comments

Comments
 (0)