Skip to content

Commit 2755789

Browse files
Merge pull request #28 from SemanticMediaWiki/issue-24-27
fix issues from #24 to #27
2 parents 249ae99 + 72a6d6b commit 2755789

File tree

6 files changed

+276
-71
lines changed

6 files changed

+276
-71
lines changed

includes/KnowledgeGraph.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public static function parserFunctionKnowledgeGraph( Parser $parser, ...$argv )
222222
'show-property-type' => [ 'false', 'boolean' ],
223223
'properties-panel' => [ 'false', 'boolean' ],
224224
'categories-panel' => [ 'false', 'boolean' ],
225+
'palette' => [ 'default', 'string' ],
225226
];
226227

227228
self::initSMW();
@@ -279,9 +280,14 @@ public static function parserFunctionKnowledgeGraph( Parser $parser, ...$argv )
279280

280281
$out->setExtensionData( 'knowledgegraphs', self::$graphs );
281282

283+
$paletteName = $params['palette'] ?? 'default';
284+
$colors = $GLOBALS['wgKnowledgeGraphColorPalettes'][$paletteName]
285+
?? $GLOBALS['wgKnowledgeGraphColorPalettes']['default'];
286+
282287
$out->addJsConfigVars( [
283288
'KnowledgeGraphShowImages' => $GLOBALS['wgKnowledgeGraphShowImages'],
284-
'KnowledgeGraphDisableCredits' => $GLOBALS['wgKnowledgeGraphDisableCredits']
289+
'KnowledgeGraphDisableCredits' => $GLOBALS['wgKnowledgeGraphDisableCredits'],
290+
'wgKnowledgeGraphColorPalette' => $colors
285291
] );
286292

287293
return [

includes/specials/SpecialKnowledgeGraphDesigner.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,15 @@ public function execute( $par ) {
6060

6161
\KnowledgeGraph::$graphs[] = $params;
6262

63+
$paletteName = $params['palette'] ?? 'default';
64+
$colors = $GLOBALS['wgKnowledgeGraphColorPalettes'][$paletteName]
65+
?? $GLOBALS['wgKnowledgeGraphColorPalettes']['default'];
66+
6367
$out->addJsConfigVars( [
6468
'knowledgegraphs' => json_encode( \KnowledgeGraph::$graphs ),
6569
'KnowledgeGraphShowImages' => $GLOBALS['wgKnowledgeGraphShowImages'],
66-
'KnowledgeGraphDisableCredits' => $GLOBALS['wgKnowledgeGraphDisableCredits']
70+
'KnowledgeGraphDisableCredits' => $GLOBALS['wgKnowledgeGraphDisableCredits'],
71+
'wgKnowledgeGraphColorPalette' => $colors
6772
] );
6873

6974
$out->addHTML(

resources/KnowledgeGraph.css

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,29 @@
6363
padding: 4px;
6464
}
6565

66-
.custom-menu li.custom-menu-link-entry:hover,
67-
.custom-menu li.custom-menu-property-entry:hover,
68-
.custom-menu li.custom-menu-edge-entry:hover {
69-
background-color: #e0f0ff;
70-
cursor: pointer;
66+
.kg-node-properties-menu li.kg-node-properties-menu-link-entry:hover,
67+
.kg-node-properties-menu li.kg-node-properties-menu-property-entry:hover,
68+
.kg-node-properties-menu li.kg-node-properties-menu-edge-entry:hover {
69+
background-color: #e0f0ff;
70+
cursor: pointer;
71+
}
72+
73+
.kg-node-properties-menu {
74+
position: absolute;
75+
background: #fff;
76+
border: 1px solid #ccc;
77+
padding: 5px;
78+
list-style: none;
79+
z-index: 10000;
80+
max-height: 300px;
81+
overflow-y: auto;
82+
margin: 0;
83+
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
84+
cursor: pointer;
85+
}
86+
87+
.kg-node-properties-menu-property-entry-selected {
88+
font-style: italic;
89+
font-weight: bold;
90+
color: #2B7CE9;
7191
}

0 commit comments

Comments
 (0)