From bd33c988cde4b3254aae31428e6111085591c923 Mon Sep 17 00:00:00 2001 From: patrickmj Date: Wed, 6 Sep 2023 13:06:12 -0400 Subject: [PATCH 1/6] minor fixes post merge-down --- src/fetchers/AbstractFetcher.php | 2 +- src/fetchers/Sparql.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fetchers/AbstractFetcher.php b/src/fetchers/AbstractFetcher.php index bfde615..1a1eb80 100644 --- a/src/fetchers/AbstractFetcher.php +++ b/src/fetchers/AbstractFetcher.php @@ -1,6 +1,6 @@ Date: Sun, 19 Nov 2023 15:01:22 -0500 Subject: [PATCH 2/6] Add the mock data templates for deving BB need to fill some out now that (hopefully) I have the basic pattern understood --- data/rendererTemplates/drstkBrowse.html | 227 ++++++++++++++++++ data/rendererTemplates/drstkBrowseSelect.html | 18 ++ data/rendererTemplates/drstkMap.html | 14 ++ data/rendererTemplates/drstkMedia.html | 11 + data/rendererTemplates/drstkSingle.html | 19 ++ data/rendererTemplates/drstkTile.html | 67 ++++++ data/rendererTemplates/drstkTimeline.html | 11 + data/testStoryMapStructure.js | 16 ++ 8 files changed, 383 insertions(+) create mode 100644 data/rendererTemplates/drstkBrowse.html create mode 100644 data/rendererTemplates/drstkBrowseSelect.html create mode 100644 data/rendererTemplates/drstkMap.html create mode 100644 data/rendererTemplates/drstkMedia.html create mode 100644 data/rendererTemplates/drstkSingle.html create mode 100644 data/rendererTemplates/drstkTile.html create mode 100644 data/rendererTemplates/drstkTimeline.html create mode 100644 data/testStoryMapStructure.js diff --git a/data/rendererTemplates/drstkBrowse.html b/data/rendererTemplates/drstkBrowse.html new file mode 100644 index 0000000..b3cb31d --- /dev/null +++ b/data/rendererTemplates/drstkBrowse.html @@ -0,0 +1,227 @@ + + + + + + +
+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
  11. + +
  12. +
  13. + +
  14. +
  15. + +
  16. +
  17. + +
  18. +
  19. + +
  20. +
  21. + +
  22. +
  23. + +
  24. +
  25. + +
  26. +
  27. + +
  28. +
  29. + +
  30. +
  31. + +
  32. +
  33. + +
  34. +
  35. + +
  36. +
  37. + +
  38. +
  39. + +
  40. +
+
+ + diff --git a/data/rendererTemplates/drstkBrowseSelect.html b/data/rendererTemplates/drstkBrowseSelect.html new file mode 100644 index 0000000..0f80ea7 --- /dev/null +++ b/data/rendererTemplates/drstkBrowseSelect.html @@ -0,0 +1,18 @@ + + + + + + +
+ Oral history interview + transcript with Maicharia Weir Lytle
Weir Lytle, Maicharia
Mecagni, + Giordana
Rose, Danielle
+
+ ".$img_metadata. + +
+
+ + diff --git a/data/rendererTemplates/drstkMap.html b/data/rendererTemplates/drstkMap.html new file mode 100644 index 0000000..81f4f04 --- /dev/null +++ b/data/rendererTemplates/drstkMap.html @@ -0,0 +1,14 @@ + + + + + + +
+ +
+ + + + + \ No newline at end of file diff --git a/data/rendererTemplates/drstkMedia.html b/data/rendererTemplates/drstkMedia.html new file mode 100644 index 0000000..e310aa1 --- /dev/null +++ b/data/rendererTemplates/drstkMedia.html @@ -0,0 +1,11 @@ + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/data/rendererTemplates/drstkSingle.html b/data/rendererTemplates/drstkSingle.html new file mode 100644 index 0000000..fa1d53b --- /dev/null +++ b/data/rendererTemplates/drstkSingle.html @@ -0,0 +1,19 @@ + + + + + + +
+
+ + + +
+
+ + diff --git a/data/rendererTemplates/drstkTile.html b/data/rendererTemplates/drstkTile.html new file mode 100644 index 0000000..cae6885 --- /dev/null +++ b/data/rendererTemplates/drstkTile.html @@ -0,0 +1,67 @@ + + + + + + +
+ +
+ + diff --git a/data/rendererTemplates/drstkTimeline.html b/data/rendererTemplates/drstkTimeline.html new file mode 100644 index 0000000..848f718 --- /dev/null +++ b/data/rendererTemplates/drstkTimeline.html @@ -0,0 +1,11 @@ + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/data/testStoryMapStructure.js b/data/testStoryMapStructure.js new file mode 100644 index 0000000..cffe1e3 --- /dev/null +++ b/data/testStoryMapStructure.js @@ -0,0 +1,16 @@ +const storymaps = { + "id1": { + "label": "The storymap title/label/whatever", + "uris": [ + "http://whatever", + "http://whatever2" + ] + }, + "id2": { + "label": "The storymap title/label/whatever", + "uris": [ + "http://whatever", + "http://whatever2" + ] + } +} \ No newline at end of file From fa255a03efcca91f5cc5bac7bbf9428463882024 Mon Sep 17 00:00:00 2001 From: patrickmj Date: Sun, 19 Nov 2023 15:38:16 -0500 Subject: [PATCH 3/6] stub out renderers for mock shortcode responses Might serve as a starting point for real shortcode renderers that know how to deal with the shortcode options. Or it might just figure out how to pass it along to the old CERES mechanisms to get the HTML then wrap it up for delivery here until we get true BB integration. --- src/renderers/mock/DrstkBrowseSelect.php | 11 +++++++++++ src/renderers/mock/DrstkMap.php | 11 +++++++++++ src/renderers/mock/DrstkMedia.php | 11 +++++++++++ src/renderers/mock/DrstkSingle.php | 11 +++++++++++ src/renderers/mock/DrstkTile.php | 11 +++++++++++ src/renderers/mock/DrstkTimeline.php | 11 +++++++++++ 6 files changed, 66 insertions(+) create mode 100644 src/renderers/mock/DrstkBrowseSelect.php create mode 100644 src/renderers/mock/DrstkMap.php create mode 100644 src/renderers/mock/DrstkMedia.php create mode 100644 src/renderers/mock/DrstkSingle.php create mode 100644 src/renderers/mock/DrstkTile.php create mode 100644 src/renderers/mock/DrstkTimeline.php diff --git a/src/renderers/mock/DrstkBrowseSelect.php b/src/renderers/mock/DrstkBrowseSelect.php new file mode 100644 index 0000000..0e74fad --- /dev/null +++ b/src/renderers/mock/DrstkBrowseSelect.php @@ -0,0 +1,11 @@ + Date: Wed, 22 Nov 2023 12:33:49 -0500 Subject: [PATCH 4/6] cleanup and get mock renderers in place --- src/renderers/Html.php | 2 +- src/renderers/mock/DrstkSingle.php | 4 +- src/renderers/mock/DrstkSlider.php | 11 ++ src/renderers/mock/DrstkTile.php | 2 +- src/renderers/mock/mockShortcodeAdapter.php | 110 ++++++++++++++++++++ 5 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 src/renderers/mock/DrstkSlider.php create mode 100644 src/renderers/mock/mockShortcodeAdapter.php diff --git a/src/renderers/Html.php b/src/renderers/Html.php index dd382da..20c025f 100644 --- a/src/renderers/Html.php +++ b/src/renderers/Html.php @@ -99,7 +99,7 @@ protected function stripCeresIds(): void { } } - protected function setGlobalAttributes(array $globalAtts = [], DOMNode $node) { + protected function setGlobalAttributes( DOMNode $node, array $globalAtts = [],) { foreach($globalAtts as $att => $value) { $attributeNode = $this->htmlDom->createAttribute($att); $attributeNode->value = $value; diff --git a/src/renderers/mock/DrstkSingle.php b/src/renderers/mock/DrstkSingle.php index 5036f46..c8f0053 100644 --- a/src/renderers/mock/DrstkSingle.php +++ b/src/renderers/mock/DrstkSingle.php @@ -3,9 +3,9 @@ use Ceres\Renderer\Html; -class DrsttkSingle extends Html { +class DrstkSingle extends Html { protected string $templateFileName = 'drstkSingle.html'; -} \ No newline at end of file +} diff --git a/src/renderers/mock/DrstkSlider.php b/src/renderers/mock/DrstkSlider.php new file mode 100644 index 0000000..b955091 --- /dev/null +++ b/src/renderers/mock/DrstkSlider.php @@ -0,0 +1,11 @@ +loadHTMLFile(CERES_ROOT_DIR . '/data/rendererTemplates/drstkSingle.html'); + break; + + case 'tile': + $dom->loadHTMLFile(CERES_ROOT_DIR . '/data/rendererTemplates/drstkTile.html'); + break; + + case 'map': + $dom->loadHTMLFile(CERES_ROOT_DIR . '/data/rendererTemplates/drstkMap.html'); + break; + + case 'media': + $dom->loadHTMLFile(CERES_ROOT_DIR . '/data/rendererTemplates/drstkMedia.html'); + break; + + case 'timeline': + $dom->loadHTMLFile(CERES_ROOT_DIR . '/data/rendererTemplates/drstkTimeline.html'); + break; + + case 'slider': + $dom->loadHTMLFile(CERES_ROOT_DIR . '/data/rendererTemplates/drstkSlider.html'); + break; + + default: + throw new \Exception("Unknown shortcode type"); + } + +} else { + throw new \Exception("Required GET param shortcodeType not provided."); +} + +$containerNode = $dom->getElementById('ceres-container'); +echo $dom->saveHTML($containerNode); + +// Wish below worked out of the box, but no such luck +die(); + +if (isset($_GET['shortcodeType'])) { + $shortcodeType = $_GET['shortcodeType']; + switch ($shortcodeType) { + case 'single': + $rendererClass = new DrstkSingle; + break; + + case 'tile': + $rendererClass = new DrstkTile; + break; + + case 'map': + $rendererClass = new DrstkMap; + break; + + case 'media': + $rendererClass = new DrstkMedia; + break; + + case 'timeline': + $rendererClass = new DrstkTimeline; + break; + + case 'slider': + $rendererClass = new DrstkSlider; + break; + + default: + throw new \Exception("Unknown shortcode type"); + } + +} else { + throw new \Exception("Required GET param shortcodeType not provided."); +} + +$rendererClass->render(); \ No newline at end of file From 3cb046f519b62a5dea99ef7a527c5be63ffea952 Mon Sep 17 00:00:00 2001 From: patrickmj Date: Sat, 25 Nov 2023 13:09:28 -0500 Subject: [PATCH 5/6] fill out the PHP to return HTML --- src/renderers/mock/mockShortcodeAdapter.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/renderers/mock/mockShortcodeAdapter.php b/src/renderers/mock/mockShortcodeAdapter.php index 1708203..6fb0aa8 100644 --- a/src/renderers/mock/mockShortcodeAdapter.php +++ b/src/renderers/mock/mockShortcodeAdapter.php @@ -29,8 +29,6 @@ $dom = new DOMDocument(); - - if (isset($_GET['shortcodeType'])) { $shortcodeType = $_GET['shortcodeType']; switch ($shortcodeType) { @@ -59,18 +57,20 @@ break; default: - throw new \Exception("Unknown shortcode type"); + echo "Invalid shortcode type. Valid types are: single, tile, map, media, timeline, slider."; + die(); } } else { - throw new \Exception("Required GET param shortcodeType not provided."); + echo "Required GET param shortcodeType not provided."; + die(); } $containerNode = $dom->getElementById('ceres-container'); echo $dom->saveHTML($containerNode); -// Wish below worked out of the box, but no such luck -die(); +// Wish below worked out of the box, but no such luck. So +die(); //Bart, Die if (isset($_GET['shortcodeType'])) { $shortcodeType = $_GET['shortcodeType']; @@ -100,11 +100,13 @@ break; default: - throw new \Exception("Unknown shortcode type"); + echo "Invalid shortcode type. Valid types are: single, tile, map, media, rimeline, slider."; + die(); } } else { - throw new \Exception("Required GET param shortcodeType not provided."); + echo "Required GET param shortcodeType not provided."; + die(); } $rendererClass->render(); \ No newline at end of file From 0bd583976cc271189afd97455b7f808556d7327a Mon Sep 17 00:00:00 2001 From: patrickmj Date: Sat, 25 Nov 2023 13:10:17 -0500 Subject: [PATCH 6/6] add slider; remove ids --- data/rendererTemplates/drstkMap.html | 2 +- data/rendererTemplates/drstkMedia.html | 2 +- data/rendererTemplates/drstkSingle.html | 2 +- data/rendererTemplates/drstkSlider.html | 81 +++++++++++++++++++++++ data/rendererTemplates/drstkTile.html | 2 +- data/rendererTemplates/drstkTimeline.html | 2 +- 6 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 data/rendererTemplates/drstkSlider.html diff --git a/data/rendererTemplates/drstkMap.html b/data/rendererTemplates/drstkMap.html index 81f4f04..3d5cae5 100644 --- a/data/rendererTemplates/drstkMap.html +++ b/data/rendererTemplates/drstkMap.html @@ -4,7 +4,7 @@ -
+
diff --git a/data/rendererTemplates/drstkMedia.html b/data/rendererTemplates/drstkMedia.html index e310aa1..6aff868 100644 --- a/data/rendererTemplates/drstkMedia.html +++ b/data/rendererTemplates/drstkMedia.html @@ -4,7 +4,7 @@ -
+
diff --git a/data/rendererTemplates/drstkSingle.html b/data/rendererTemplates/drstkSingle.html index fa1d53b..6f7932d 100644 --- a/data/rendererTemplates/drstkSingle.html +++ b/data/rendererTemplates/drstkSingle.html @@ -4,7 +4,7 @@ -
+
+ + + + + + + + diff --git a/data/rendererTemplates/drstkTile.html b/data/rendererTemplates/drstkTile.html index cae6885..ff5b0e6 100644 --- a/data/rendererTemplates/drstkTile.html +++ b/data/rendererTemplates/drstkTile.html @@ -4,7 +4,7 @@ -
+
-
+