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
1ed6e43d
Commit
1ed6e43d
authored
3 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Made new storage interface more accessible for graph and editor and simplified imports
parent
fd2881ba
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
config.js
+2
-1
2 additions, 1 deletion
config.js
display/graph.js
+1
-1
1 addition, 1 deletion
display/graph.js
editor/js/editor.js
+2
-1
2 additions, 1 deletion
editor/js/editor.js
knowledge-space.php
+23
-17
23 additions, 17 deletions
knowledge-space.php
with
28 additions
and
20 deletions
config.js
+
2
−
1
View file @
1ed6e43d
...
...
@@ -9,4 +9,5 @@ export const COLOR_PALETTE = [
];
// Just renaming a variable which is given by the PHP script. This avoids errors in all other files.
export
const
PLUGIN_PATH
=
plugin_path
;
export
const
PLUGIN_PATH
=
plugin
.
path
;
export
const
SPACE
=
space
.
id
;
This diff is collapsed.
Click to expand it.
display/graph.js
+
1
−
1
View file @
1ed6e43d
...
...
@@ -520,7 +520,7 @@ let infoOverlay = null;
// Only execute, if corresponding dom is present
if
(
document
.
getElementById
(
"
3d-graph
"
)
!==
null
)
{
G
=
new
Graph
(
space_id
);
// space_id defined globaly through knowledge-space.php
G
=
new
Graph
(
Config
.
SPACE
);
// space_id defined globaly through knowledge-space.php
filterOverlay
=
new
FilterOverlay
(
G
,
"
node
"
);
infoOverlay
=
new
NodeInfoOverlay
(
G
);
G
.
infoOverlay
=
infoOverlay
;
...
...
This diff is collapsed.
Click to expand it.
editor/js/editor.js
+
2
−
1
View file @
1ed6e43d
...
...
@@ -3,6 +3,7 @@ import * as Graph from "./graph";
import
{
loadGraphJson
}
from
"
../../datasets/datasets
"
;
import
ForceGraph
from
"
force-graph
"
;
import
*
as
Interactions
from
"
./interactions
"
;
import
{
SPACE
}
from
"
../../config
"
;
export
var
state
;
...
...
@@ -20,7 +21,7 @@ window.onload = function () {
Interactions
.
initInteractions
();
loadGraphJson
(
space_id
)
// space_id defined globaly through knowledge-space.php
loadGraphJson
(
SPACE
)
// space_id defined globaly through knowledge-space.php
.
then
((
graphConfig
)
=>
{
state
=
new
State
();
graph
=
new
Graph
.
Graph
(
graphConfig
);
...
...
This diff is collapsed.
Click to expand it.
knowledge-space.php
+
23
−
17
View file @
1ed6e43d
...
...
@@ -14,17 +14,21 @@ function ks_add_graph($atts = []): string
$space_id
=
get_space_id_from_atts
(
$atts
);
$div
=
'<div id="3d-graph"></div>'
;
// The id "3d-graph" indicates, that the javascript associated with this should automatically be executed
$plugin_dir
=
plugin_dir_url
(
__FILE__
);
//$dataset = $plugin_dir.'datasets/miserables.json';
$variables
=
"<script>
var plugin_path = '
$plugin_dir
';
var space_id = '
$space_id
';
</script>"
;
$script_path
=
$plugin_dir
.
'build'
.
DIRECTORY_SEPARATOR
.
$GLOBALS
[
'build'
]
.
DIRECTORY_SEPARATOR
.
'graph.js'
;
$script
=
"<script src='
$script_path
'></script>"
;
$script_path
=
'build'
.
DIRECTORY_SEPARATOR
.
$GLOBALS
[
'build'
]
.
DIRECTORY_SEPARATOR
.
'graph.js'
;
// $script = "<script src='$script_path'></script>";
//wp_enqueue_script('kg-script', $script_path);
wp_enqueue_script
(
"ks-display-js"
,
plugins_url
(
$script_path
,
__FILE__
),
array
(
'jquery'
),
false
);
wp_localize_script
(
'ks-display-js'
,
'ajax_object'
,
array
(
'ajax_url'
=>
admin_url
(
'admin-ajax.php'
))
);
wp_localize_script
(
"ks-display-js"
,
"space"
,
array
(
'id'
=>
$space_id
));
wp_localize_script
(
"ks-display-js"
,
"plugin"
,
array
(
'path'
=>
$plugin_dir
));
return
$div
.
$variables
.
$script
;
return
$div
.
$variables
;
// return $div . $variables . $script;
}
function
ks_add_editor
(
$atts
=
[])
...
...
@@ -33,10 +37,8 @@ function ks_add_editor($atts = [])
$space_id
=
get_space_id_from_atts
(
$atts
);
$plugin_dir
=
plugin_dir_url
(
__FILE__
);
echo
"<script>
var plugin_path = '
$plugin_dir
';
var space_id = '
$space_id
';
</script>"
;
wp_localize_script
(
"ks-editor-js"
,
"space"
,
array
(
'id'
=>
$space_id
));
wp_localize_script
(
"ks-editor-js"
,
"plugin"
,
array
(
'path'
=>
$plugin_dir
));
require_once
(
__DIR__
.
'/editor/editor.php'
);
}
...
...
@@ -45,12 +47,15 @@ function ks_add_editor_dependencies()
{
$script_path
=
'build'
.
DIRECTORY_SEPARATOR
.
$GLOBALS
[
'build'
]
.
DIRECTORY_SEPARATOR
.
'graph.js'
;
// wp_enqueue_script('jquery');
// wp_enqueue_script('jquery');
wp_enqueue_script
(
"ks-editor-js"
,
plugins_url
(
$script_path
,
__FILE__
),
array
(
'jquery'
),
false
);
//wp_register_script("ks-editor-js", plugins_url($script_path, __FILE__), array('jquery'), false);
wp_localize_script
(
'ks-editor-js'
,
'ajax_object'
,
array
(
'ajax_url'
=>
admin_url
(
'admin-ajax.php'
)));
wp_localize_script
(
'ks-editor-js'
,
'ajax_object'
,
array
(
'ajax_url'
=>
admin_url
(
'admin-ajax.php'
))
);
//wp_enqueue_script("ks-editor-js");
$style_file_version
=
date
(
"ymd-Gis"
,
filemtime
(
plugin_dir_path
(
__FILE__
)
.
"editor/css/editor.css"
));
...
...
@@ -76,7 +81,8 @@ function escape_space_id($id)
);
}
function
get_space_id_from_atts
(
$atts
)
{
function
get_space_id_from_atts
(
$atts
)
{
if
(
$atts
!=
""
&&
array_key_exists
(
"space"
,
$atts
))
{
return
escape_space_id
(
$atts
[
"space"
]);
}
else
{
...
...
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