diff --git a/extension.json b/extension.json index 8559803..2497bc2 100644 --- a/extension.json +++ b/extension.json @@ -7,29 +7,32 @@ "license-name": "MIT", "type": "media", "manifest_version": 1, + "requires": { + "MediaWiki": ">= 1.39.0" + }, "namespaces": [ { "id": 2218, "constant": "NS_AV_ANNOT", "name": "Annotation", "protection": "annotations-edit", - "subpages": false + "subpages": false, + "content": false, + "defaultcontentmodel": "annotation" }, { "id": 2219, "constant": "NS_AV_ANNOT_TALK", "name": "Annotation_talk", - "subpages": true + "subpages": true, + "content": false, + "defaultcontentmodel": "wikitext" } ], - "callback": "MediaWiki\\Extension\\AnatImageViewer\\AnnotationHooks::registrationCallback", "AutoloadNamespaces": { "MediaWiki\\Extension\\AnatImageViewer\\": "includes/" }, "ContentHandlers": { - "annotation": "MediaWiki\\Extension\\AnatImageViewer\\AnnotationHandler::class" - }, - "Hooks": { - "ContentHandlerDefaultModelFor": "MediaWiki\\Extension\\AnatImageViewer\\AnnotationHooks::onContentHandlerDefaultModelFor" + "annotation": "MediaWiki\\Extension\\AnatImageViewer\\AnnotationHandler" } } \ No newline at end of file diff --git a/includes/AnnotationContent.php b/includes/AnnotationContent.php index b61c2c2..7a396d5 100644 --- a/includes/AnnotationContent.php +++ b/includes/AnnotationContent.php @@ -1,32 +1,60 @@ getText() ) ); + return $text === ''; } - public function getWikitextForTransclusion() { - } - - public function getTextForSummary( $maxLength = 250 ) { - } - - public function getSize() { - } - - public function copy() { - } - */ - + /** + * Determines whether this content should be counted as a "page" for the wiki's statistics. + * + * @param bool|null $hasLinks + * + * @return bool + */ public function isCountable( $hasLinks = null ) { - return false; + return false; + } + + public function isValid() { + return parent::isValid(); + } + + /** + * Should return text relevant to the wiki's search index. + * + * @return string + */ + public function getTextForSearchIndex() { + return strip_tags( $this->getText() ); + } + + public function convert( $toModel, $lossy = '' ) { + return parent::convert( $toModel, $lossy ); + } + + public function getSection( $sectionId ) { + return parent::getSection( $sectionId ); + } + + public function replaceSection( $sectionId, Content $with, $sectionTitle = '' ) { + return parent::replaceSection( $sectionId, $with, $sectionTitle ); } } \ No newline at end of file diff --git a/includes/AnnotationHandler.php b/includes/AnnotationHandler.php index 3d55a8e..66a3b0a 100644 --- a/includes/AnnotationHandler.php +++ b/includes/AnnotationHandler.php @@ -1,6 +1,8 @@ getNativeData(), true); + self::console_log(var_dump($metadata), true); if (isset($metadata['baseImage'])) { $baseImage = MediaWikiServices::getInstance()->getRepoGroup()->findFile('File:' . $metadata['baseImage']); @@ -77,11 +82,11 @@ class AnnotationHandler extends CodeContentHandler { * and produces the html string for the svg with base image and annotations. * * @param string $metadata The metadata object parsed from the text - * @param string $baseImageUrl The full url pointing to the base image to annotate - * @param array $frameParams The additional user defined parameters for the viewer such as hotspot and view classes - * @return string Html string of the complete model-viewer element inside a div container + * @param string $baseImage The full url pointing to the base image to annotate + * @return string Html string of the complete svg */ private function buildSvg($metadata, $baseImage) { + self::console_log(var_dump($baseImage), true); //Gather basic data $elBaseImg = ''; $vbHeight = 100;