Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pro
sbvrwiki
Commits
fe1ae125
Commit
fe1ae125
authored
3 years ago
by
Krzysztof Kutt
Browse files
Options
Download
Email Patches
Plain Diff
bugfixing; updates for DokuWiki "Hogfather"
parent
70c0d79d
master
sbvr-2022-03-23
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sbvr/action.php
+2
-4
sbvr/action.php
sbvr/syntax.php
+45
-48
sbvr/syntax.php
with
47 additions
and
52 deletions
+47
-52
sbvr/action.php
View file @
fe1ae125
<?php
/**
* Example Action Plugin: Inserts a button into the toolbar
*
* @author Gina Haeussge <osd@foosel.net>
* @author GEIST Research Group <krzysztof.kutt@uj.edu.pl>
*/
...
...
@@ -23,7 +21,7 @@ class action_plugin_sbvr extends DokuWiki_Action_Plugin {
/**
* Register the eventhandlers
*/
public
function
register
(
&
$controller
)
{
public
function
register
(
Doku_Event_Handler
$controller
)
{
$controller
->
register_hook
(
'ACTION_ACT_PREPROCESS'
,
'BEFORE'
,
$this
,
'export'
,
array
());
$controller
->
register_hook
(
'TPL_ACT_UNKNOWN'
,
'AFTER'
,
$this
,
'export'
,
array
());
}
...
...
This diff is collapsed.
Click to expand it.
sbvr/syntax.php
View file @
fe1ae125
<?php
/**
*
* Syntax: <TEST> - will be replaced with "Hello World!"
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author
Christopher Smith <chris@jalakai.co.uk
>
* @author
GEIST Research Group <krzysztof.kutt@uj.edu.pl
>
*/
if
(
!
defined
(
'DOKU_INC'
))
define
(
'DOKU_INC'
,
realpath
(
dirname
(
__FILE__
)
.
'/../../'
)
.
'/'
);
...
...
@@ -122,7 +119,7 @@ class syntax_plugin_sbvr extends DokuWiki_Syntax_Plugin {
* @see render()
* @static
*/
function
handle
(
$match
,
$state
,
$pos
,
&
$handler
){
function
handle
(
$match
,
$state
,
$pos
,
Doku_Handler
$handler
){
switch
(
$state
)
{
case
DOKU_LEXER_ENTER
:
return
null
;
...
...
@@ -161,9 +158,9 @@ class syntax_plugin_sbvr extends DokuWiki_Syntax_Plugin {
* @public
* @see handle()
*/
function
render
(
$mode
,
&
$renderer
,
$data
)
{
function
render
(
$mode
,
Doku_Renderer
$renderer
,
$data
)
{
global
$conf
;
global
$INFO
;
global
$INFO
;
global
$ID
;
global
$REV
;
global
$ACT
;
...
...
@@ -173,7 +170,7 @@ class syntax_plugin_sbvr extends DokuWiki_Syntax_Plugin {
list
(
$state
,
$match
)
=
$data
;
switch
(
$state
)
{
{
/*
case DOKU_LEXER_MATCHED :
$button_val = 'ok';
...
...
@@ -201,11 +198,11 @@ class syntax_plugin_sbvr extends DokuWiki_Syntax_Plugin {
$renderer
->
doc
.
=
$form
;
$page
=
noNS
(
$ID
);
if
(
$page
!==
'terms'
&&
$page
!==
'facts'
&&
$page
!==
'rules'
)
break
;
if
(
$page
!==
'terms'
&&
$page
!==
'facts'
&&
$page
!==
'rules'
)
break
;
// $cmd = "java -jar tmp/plantuml.jar tmp/classDiagram.txt";
//
exec($cmd, $output, $error);
//
exec($cmd, $output, $error);
//PRZYGOTOWANIE LISTY TERMÓW
$namespace
=
getNS
(
getID
());
...
...
@@ -235,13 +232,13 @@ class syntax_plugin_sbvr extends DokuWiki_Syntax_Plugin {
//PRZYCISK EKSPORTU DANYCH DO XML
if
(
$ACT
==
'show'
&&
noNS
(
getID
())
==
'rules'
){
$renderer
->
doc
.
=
'<br><br><form class="button" method="get" action="'
.
exportlink
(
getID
(),
'sbvr'
,
array
(
'type'
=>
'xmi'
))
.
'">
<div align="right">
<input type="submit" value="Export to XML" class="button" />
<input type="hidden" name="do" value="export_sbvr" />
<input type="hidden" name="id" value="'
.
getID
()
.
'" />
<div align="right">
<input type="submit" value="Export to XML" class="button" />
<input type="hidden" name="do" value="export_sbvr" />
<input type="hidden" name="id" value="'
.
getID
()
.
'" />
<input type="hidden" name="type" value="xml" />
</div>
</form>'
;
</div>
</form>'
;
}
//PRZYCISK EKSPORTU DANYCH DO XMI
...
...
@@ -259,13 +256,13 @@ class syntax_plugin_sbvr extends DokuWiki_Syntax_Plugin {
//PRZYCISK EKSPORTU DANYCH DO SKŁADNI PL WIKI
if
(
$ACT
==
'show'
&&
noNS
(
getID
())
==
'facts'
){
$renderer
->
doc
.
=
'<br><br><form class="button" method="get" action="'
.
exportlink
(
getID
(),
'sbvr'
,
array
(
'type'
=>
'pl'
))
.
'">
<div align="right">
<input type="submit" value="Export to PlWiki" class="button" />
<input type="hidden" name="do" value="export_sbvr" />
<input type="hidden" name="id" value="'
.
getID
()
.
'" />
<div align="right">
<input type="submit" value="Export to PlWiki" class="button" />
<input type="hidden" name="do" value="export_sbvr" />
<input type="hidden" name="id" value="'
.
getID
()
.
'" />
<input type="hidden" name="type" value="pl" />
</div>
</form>'
;
</div>
</form>'
;
}
//GENEROWANIE WIZUALIZACJI
...
...
@@ -273,41 +270,41 @@ class syntax_plugin_sbvr extends DokuWiki_Syntax_Plugin {
foreach
(
$res
[
1
]
as
$key
=>
$graph
)
{
$tempfile
=
$this
->
tempdir
.
'/graph_tmp'
;
$file
=
fopen
(
$tempfile
.
'.txt'
,
'w'
);
fwrite
(
$file
,
"@startuml
\n
"
.
$graph
.
"
\n
hide empty members
\n
hide methods
\n
@enduml"
);
fclose
(
$file
);
fwrite
(
$file
,
"@startuml
\n
"
.
$graph
.
"
\n
hide empty members
\n
hide methods
\n
@enduml"
);
fclose
(
$file
);
$md5
=
md5_file
(
$tempfile
.
'.txt'
);
$mediadir
=
$conf
[
"mediadir"
]
.
"/"
.
str_replace
(
":"
,
"/"
,
$INFO
[
'namespace'
]
);
if
(
!
is_dir
(
$mediadir
)
)
mkdir
(
$mediadir
,
0755
,
true
);
if
(
!
is_dir
(
$mediadir
)
)
mkdir
(
$mediadir
,
0755
,
true
);
$imagefile
=
$mediadir
.
'/graph'
.
'_'
.
$md5
.
'.png'
;
if
(
!
file_exists
(
$imagefile
)
)
{
$cmd
=
"java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -jar "
.
$this
->
tempdir
.
"/plantuml.jar -charset UTF-8 "
.
$tempfile
.
'.txt'
;
exec
(
$cmd
,
$output
,
$error
);
if
(
!
file_exists
(
$imagefile
)
)
{
$cmd
=
"java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -jar "
.
$this
->
tempdir
.
"/plantuml.jar -charset UTF-8 "
.
$tempfile
.
'.txt'
;
exec
(
$cmd
,
$output
,
$error
);
if
(
$error
!=
0
)
{
$renderer
->
doc
.
=
'---ERROR CREATING GRAPH---'
;
unlink
(
$tempfile
);
if
(
file_exists
(
$tempfile
.
'.png'
))
unlink
(
$tempfile
.
'.png'
);
return
false
;
}
if
(
$error
!=
0
)
{
$renderer
->
doc
.
=
'---ERROR CREATING GRAPH---'
;
unlink
(
$tempfile
);
if
(
file_exists
(
$tempfile
.
'.png'
))
unlink
(
$tempfile
.
'.png'
);
return
false
;
}
if
(
file_exists
(
$imagefile
))
unlink
(
$imagefile
);
if
(
!
copy
(
$tempfile
.
'.png'
,
$imagefile
)
)
return
false
;
unlink
(
$tempfile
.
'.png'
);
}
if
(
file_exists
(
$imagefile
))
unlink
(
$imagefile
);
if
(
!
copy
(
$tempfile
.
'.png'
,
$imagefile
)
)
return
false
;
unlink
(
$tempfile
.
'.png'
);
}
unlink
(
$tempfile
.
'.txt'
);
unlink
(
$tempfile
.
'.txt'
);
$renderer
->
doc
.
=
"<h2>Graph No: "
.
(
$key
+
1
)
.
"</h2>"
;
$renderer
->
doc
.
=
$renderer
->
internalmedia
(
$INFO
[
'namespace'
]
.
':graph'
.
'_'
.
$md5
.
'.png'
);
$renderer
->
doc
.
=
$renderer
->
internalmedia
(
$INFO
[
'namespace'
]
.
':graph'
.
'_'
.
$md5
.
'.png'
);
}
}
break
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help