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
4f057bcd
Commit
4f057bcd
authored
3 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Implemented proper import and started to work on importing file from wordpress
parent
aecdc864
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
dataset.js
+1
-0
1 addition, 0 deletions
dataset.js
editor/css/editor.css
+15
-0
15 additions, 0 deletions
editor/css/editor.css
editor/editor.php
+26
-0
26 additions, 0 deletions
editor/editor.php
knowledge-space.php
+61
-12
61 additions, 12 deletions
knowledge-space.php
with
103 additions
and
12 deletions
dataset.js
0 → 100644
+
1
−
0
View file @
4f057bcd
const
PLUGIN_PATH
=
"
http://localhost/2021/aud_worpress/wp-content/plugins/knowledge-space-wp-plugin/
"
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
editor/css/editor.css
0 → 100644
+
15
−
0
View file @
4f057bcd
div
#ks-editor
section
{
border
:
1px
lightgrey
solid
;
border-radius
:
1px
;
margin
:
5px
;
padding
:
2.5px
;
width
:
auto
;
}
div
#ks-editor
section
>
*
{
margin
:
2.5px
;
}
div
#ks-editor
*
.selected
{
background-color
:
lightblue
;
}
This diff is collapsed.
Click to expand it.
editor/editor.
html
→
editor/editor.
php
+
26
−
0
View file @
4f057bcd
<div
id=
"ks-editor"
>
<div
id=
"ks-editor"
>
<style>
div
#ks-editor
section
{
border
:
1px
lightgrey
solid
;
border-radius
:
1px
;
margin
:
5px
;
padding
:
2.5px
;
width
:
auto
;
}
div
#ks-editor
section
>
*
{
margin
:
2.5px
;
}
div
#ks-editor
*
.selected
{
background-color
:
lightblue
;
}
</style>
<script
src=
"https://unpkg.com/force-graph"
></script>
<script
src=
"https://unpkg.com/force-graph"
></script>
<!--<script src="../../dist/force-graph.js"></script>-->
<!--<script src="../../dist/force-graph.js"></script>-->
<script>
const
PLUGIN_PATH
=
"
%WWW%
"
;
</script>
<script
src=
"%WWW%editor/js/manageddata.js"
></script>
<script
src=
"%WWW%editor/js/graph.js"
></script>
<script
src=
"%WWW%editor/js/tools/tool.js"
></script>
<script
src=
"%WWW%editor/js/tools/undotool.js"
></script>
<script
src=
"%WWW%editor/js/tools/redotool.js"
></script>
<script
src=
"%WWW%editor/js/tools/selecttool.js"
></script>
<script
src=
"%WWW%editor/js/tools/collecttool.js"
></script>
<script
src=
"%WWW%editor/js/tools/deletetool.js"
></script>
<script
src=
"%WWW%editor/js/tools/addnodetool.js"
></script>
<script
src=
"%WWW%editor/js/tools/connecttool.js"
></script>
<script
src=
"%WWW%editor/js/display.js"
></script>
<script
src=
"%WWW%editor/js/state.js"
></script>
<script
src=
"%WWW%editor/js/editor.js"
></script>
<h1>
Interface
</h1>
<h1>
Interface
</h1>
<div
id=
"2d-graph"
></div>
<div
id=
"2d-graph"
></div>
<section
id=
"toolbar"
></section>
<section
id=
"toolbar"
></section>
...
...
This diff is collapsed.
Click to expand it.
knowledge-space.php
+
61
−
12
View file @
4f057bcd
...
@@ -33,28 +33,77 @@ function ks_add_graph(): string
...
@@ -33,28 +33,77 @@ function ks_add_graph(): string
$script2
=
"<script src='
$script_path2
'></script>"
;
$script2
=
"<script src='
$script_path2
'></script>"
;
$script3
=
"<script src='
$script_path3
'></script>"
;
$script3
=
"<script src='
$script_path3
'></script>"
;
$script4
=
"<script src='
$script_path4
'></script>"
;
$script4
=
"<script src='
$script_path4
'></script>"
;
return
$three
.
$renderer
.
$renderer2
.
$graph
.
$div
.
$variables
.
$script0
.
$script1
.
$script2
.
$script3
.
$script4
;
}
function
ks_add_editor
()
return
$three
.
$renderer
.
$renderer2
.
$graph
.
$div
.
$variables
.
$script0
.
$script1
.
$script2
.
$script3
.
$script4
;
{
ks_add_editor_dependencies
();
require_once
(
__DIR__
.
'/editor/editor.php'
);
}
}
function
ks_add_editor
():
string
function
ks_add_editor
_dependencies
()
{
{
// Proper, secure script loading in the future
wp_enqueue_script
(
'jquery'
);
// Should be wp_enqueue_script('jquery'), but doesn't work
// Reference https://stackoverflow.com/a/16823761/7376120
wp_enqueue_script
(
'jquery'
);
$plugin_url
=
plugin_dir_url
(
__FILE__
);
ks_enqueue_script
(
'dataset.js'
);
ks_enqueue_script
(
'editor/js/manageddata.js'
);
ks_enqueue_script
(
'editor/js/graph.js'
,
[
"manageddata"
]);
ks_enqueue_script
(
'editor/js/tools/tool.js'
);
ks_enqueue_script
(
'editor/js/tools/undotool.js'
,
[
"tool"
]);
ks_enqueue_script
(
'editor/js/tools/redotool.js'
,
[
"tool"
]);
ks_enqueue_script
(
'editor/js/tools/selecttool.js'
,
[
"tool"
]);
ks_enqueue_script
(
'editor/js/tools/collecttool.js'
,
[
"tool"
]);
ks_enqueue_script
(
'editor/js/tools/deletetool.js'
,
[
"tool"
]);
ks_enqueue_script
(
'editor/js/tools/addnodetool.js'
,
[
"tool"
]);
ks_enqueue_script
(
'editor/js/tools/connecttool.js'
,
[
"tool"
]);
ks_enqueue_script
(
'editor/js/display.js'
,
[]);
ks_enqueue_script
(
'editor/js/state.js'
,
[
"tool"
,
"display"
]);
ks_enqueue_script
(
'editor/js/editor.js'
,
[
"state"
,
"graph"
,
"dataset"
]);
$raw_html
=
file_get_contents
(
__DIR__
.
DIRECTORY_SEPARATOR
.
"editor"
.
DIRECTORY_SEPARATOR
.
"
editor.
html"
);
ks_enqueue_style
(
'editor/css/
editor.
css'
);
$ready_html
=
str_replace
(
"%WWW%"
,
$plugin_url
,
$raw_html
);
}
return
$ready_html
;
function
ks_enqueue_script
(
$relative_path
,
$dependencies
=
array
())
{
$prefix
=
"ks"
;
$type
=
"script"
;
$script_name
=
end
(
explode
(
"/"
,
$relative_path
));
$script_name
=
explode
(
"."
,
$script_name
)[
0
];
for
(
$i
=
0
;
$i
<
sizeof
(
$dependencies
);
$i
++
)
{
$dependencies
[
$i
]
=
$prefix
.
"-"
.
$dependencies
[
$i
]
.
"-"
.
$type
;
}
// Source: https://developer.wordpress.org/reference/functions/wp_enqueue_script/ a comment from Andrija Naglic
// $file_version = date("ymd-Gis", filemtime(plugin_dir_path(__FILE__) . $relative_path));
wp_enqueue_script
(
$prefix
.
"-"
.
$script_name
.
"-"
.
$type
,
plugins_url
(
$relative_path
,
__FILE__
),
$dependencies
,
false
);
}
}
function
kg_load_css
()
{
function
ks_enqueue_style
(
$relative_path
,
$dependencies
=
array
())
{
$prefix
=
"ks"
;
$type
=
"style"
;
$style_name
=
end
(
explode
(
"/"
,
$relative_path
));
$style_name
=
explode
(
"."
,
$style_name
)[
0
];
for
(
$i
=
0
;
$i
<
sizeof
(
$dependencies
);
$i
++
)
{
$dependencies
[
$i
]
=
$prefix
.
"-"
.
$dependencies
[
$i
]
.
"-"
.
$type
;
}
// Source: https://developer.wordpress.org/reference/functions/wp_enqueue_script/ a comment from Andrija Naglic
$file_version
=
date
(
"ymd-Gis"
,
filemtime
(
plugin_dir_path
(
__FILE__
)
.
$relative_path
));
wp_enqueue_style
(
$prefix
.
"-"
.
$style_name
.
"-"
.
$type
,
plugins_url
(
$relative_path
,
__FILE__
),
$dependencies
,
$file_version
);
}
function
kg_load_css
()
{
$plugin_dir
=
plugin_dir_url
(
__FILE__
);
$plugin_dir
=
plugin_dir_url
(
__FILE__
);
wp_enqueue_style
(
'kg-style'
,
$plugin_dir
.
'kg-style.css'
);
wp_enqueue_style
(
'kg-style'
,
$plugin_dir
.
'kg-style.css'
);
}
}
add_action
(
'wp_enqueue_scripts'
,
'kg_load_css'
);
add_action
(
'wp_enqueue_scripts'
,
'kg_load_css'
);
...
...
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