Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alg
Knowledge Space WP Plugin
Commits
b2968a25
"src/org/jitsi/git@gitlab.ibr.cs.tu-bs.de:zrtp/libjitsi.git" did not exist on "9a506e82fc45cb1940379056317f9fde1c48fa32"
Commit
b2968a25
authored
3 years ago
by
Matthias Konitzny
Browse files
Options
Downloads
Patches
Plain Diff
Added "mode" shortcode attribute to control graph behaviour
parent
d229dbbb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config.js
+1
-0
1 addition, 0 deletions
config.js
display/graph.js
+4
-1
4 additions, 1 deletion
display/graph.js
knowledge-space.php
+19
-2
19 additions, 2 deletions
knowledge-space.php
with
24 additions
and
3 deletions
config.js
+
1
−
0
View file @
b2968a25
...
@@ -13,6 +13,7 @@ export const COLOR_PALETTE = [
...
@@ -13,6 +13,7 @@ export const COLOR_PALETTE = [
// Just renaming a variable which is given by the PHP script. This avoids errors in all other files.
// Just renaming a variable which is given by the PHP script. This avoids errors in all other files.
export
const
PLUGIN_PATH
=
ks_global
.
plugin_path
;
export
const
PLUGIN_PATH
=
ks_global
.
plugin_path
;
export
var
SPACE
=
ks_global
.
space_id
;
export
var
SPACE
=
ks_global
.
space_id
;
export
const
MODE
=
ks_global
.
mode
;
export
function
setSpace
(
space
)
{
export
function
setSpace
(
space
)
{
SPACE
=
space
;
SPACE
=
space
;
...
...
This diff is collapsed.
Click to expand it.
display/graph.js
+
4
−
1
View file @
b2968a25
...
@@ -9,6 +9,7 @@ import {
...
@@ -9,6 +9,7 @@ import {
CSS3DRenderer
,
CSS3DRenderer
,
CSS3DSprite
,
CSS3DSprite
,
}
from
"
three/examples/jsm/renderers/CSS3DRenderer.js
"
;
}
from
"
three/examples/jsm/renderers/CSS3DRenderer.js
"
;
import
{
MODE
}
from
"
../config
"
;
/**
/**
* The main ForceGraph. Displays the graph and handles all connected events.
* The main ForceGraph. Displays the graph and handles all connected events.
...
@@ -60,7 +61,9 @@ export default class Graph {
...
@@ -60,7 +61,9 @@ export default class Graph {
.
linkWidth
((
link
)
=>
this
.
getLinkWidth
(
link
))
.
linkWidth
((
link
)
=>
this
.
getLinkWidth
(
link
))
.
onNodeClick
((
node
)
=>
{
.
onNodeClick
((
node
)
=>
{
this
.
focusOnNode
(
node
);
this
.
focusOnNode
(
node
);
this
.
infoOverlay
.
updateInfoOverlay
(
node
);
if
(
MODE
===
"
default
"
)
{
this
.
infoOverlay
.
updateInfoOverlay
(
node
);
}
})
})
.
onNodeHover
((
node
)
=>
{
.
onNodeHover
((
node
)
=>
{
this
.
onNodeHover
(
node
);
this
.
onNodeHover
(
node
);
...
...
This diff is collapsed.
Click to expand it.
knowledge-space.php
+
19
−
2
View file @
b2968a25
...
@@ -21,6 +21,14 @@ function ks_add_graph($atts = []): string
...
@@ -21,6 +21,14 @@ function ks_add_graph($atts = []): string
return
$div
;
return
$div
;
}
}
function
parse_atts
(
$atts
)
{
return
shortcode_atts
(
array
(
'space'
=>
'space'
,
'mode'
=>
'default'
),
$atts
);
}
function
ks_echo_graph
(
$atts
=
[]):
void
function
ks_echo_graph
(
$atts
=
[]):
void
{
{
echo
ks_add_graph
(
$atts
);
echo
ks_add_graph
(
$atts
);
...
@@ -28,7 +36,15 @@ function ks_echo_graph($atts = []): void
...
@@ -28,7 +36,15 @@ function ks_echo_graph($atts = []): void
function
ks_localize
(
$handle
,
$atts
)
function
ks_localize
(
$handle
,
$atts
)
{
{
$space_id
=
kg_get_space_id_from_atts
(
$atts
);
$params
=
parse_atts
(
$atts
);
if
(
$GLOBALS
[
'build'
]
==
'debug'
){
echo
'<pre>'
;
echo
"Shortcode attributes:<br>"
;
print_r
(
$params
);
echo
'</pre>'
;
}
$space_id
=
kg_get_space_id_from_atts
(
$atts
);
// TODO: Replace with $params
$plugin_dir
=
plugin_dir_url
(
__FILE__
);
$plugin_dir
=
plugin_dir_url
(
__FILE__
);
wp_localize_script
(
wp_localize_script
(
$handle
,
$handle
,
...
@@ -36,7 +52,8 @@ function ks_localize($handle, $atts)
...
@@ -36,7 +52,8 @@ function ks_localize($handle, $atts)
array
(
array
(
'ajax_url'
=>
admin_url
(
'admin-ajax.php'
),
'ajax_url'
=>
admin_url
(
'admin-ajax.php'
),
'space_id'
=>
$space_id
,
'space_id'
=>
$space_id
,
'plugin_path'
=>
$plugin_dir
'plugin_path'
=>
$plugin_dir
,
'mode'
=>
$params
[
'mode'
]
)
)
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment