Rjain has uploaded a new change for review.
https://gerrit.wikimedia.org/r/74150
Change subject: Added the destroy class
......................................................................
Added the destroy class
The id parameter is not being passed on using ?action=annotator-destroy&id=:id,
so the annotations cannot be deleted currently.
Change-Id: I13af0a1522e253d5e8e5f99d58aeaea74b2bc7e3
---
M Annotator.php
A api/ApiAnnotatorDestroy.php
M modules/Annotator.js
3 files changed, 33 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Annotator
refs/changes/50/74150/1
diff --git a/Annotator.php b/Annotator.php
index b5ca254..5817750 100755
--- a/Annotator.php
+++ b/Annotator.php
@@ -22,9 +22,11 @@
//Autoloading
$wgAutoloadClasses['AnnotatorHooks'] = $dir . 'Annotator.hooks.php';
$wgAutoloadClasses['ApiAnnotatorCreate'] = $dir . 'api/ApiAnnotatorCreate.php';
+$wgAutoloadClasses['ApiAnnotatorDestroy'] = $dir .
'api/ApiAnnotatorDestroy.php';
//Hooks
$wgHooks['BeforePageDisplay'][] = 'AnnotatorHooks::onBeforePageDisplay';
$wgHooks['LoadExtensionSchemaUpdates'][] =
'AnnotatorHooks::loadExtensionSchemaUpdates';
-$wgAPIModules['annotator-create'] = 'ApiAnnotatorCreate';
\ No newline at end of file
+$wgAPIModules['annotator-create'] = 'ApiAnnotatorCreate';
+$wgAPIModules['annotator-destroy'] = 'ApiAnnotatorDestroy';
\ No newline at end of file
diff --git a/api/ApiAnnotatorDestroy.php b/api/ApiAnnotatorDestroy.php
new file mode 100644
index 0000000..5b04a31
--- /dev/null
+++ b/api/ApiAnnotatorDestroy.php
@@ -0,0 +1,29 @@
+<?php
+class ApiAnnotatorDestroy extends ApiBase {
+ public function execute() {
+ $params = $this->extractRequestParams();
+ $id = $params['id'];
+ var_dump($id);
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->delete(
+ 'annotator',
+ array(
+ 'annotation_id' => $id
+ )
+ );
+ return true;
+ }
+
+ public function getRawPostString() {
+ return file_get_contents('php://input');
+ }
+
+ public function getAllowedParams() {
+ return array(
+ 'id' =>array(
+ ApiBase::PARAM_TYPE => 'integer',
+ ApiBase::PARAM_REQUIRED => true
+ )
+ );
+ }
+}
\ No newline at end of file
diff --git a/modules/Annotator.js b/modules/Annotator.js
index b396b99..3537013 100755
--- a/modules/Annotator.js
+++ b/modules/Annotator.js
@@ -16,7 +16,7 @@
create: '?action=annotator-create&format=json&revid=' + revid,
update: '',
read: '',
- destroy: '',
+ destroy: '?action=annotator-destroy&id=:id',
}
});
} )
--
To view, visit https://gerrit.wikimedia.org/r/74150
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I13af0a1522e253d5e8e5f99d58aeaea74b2bc7e3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Annotator
Gerrit-Branch: master
Gerrit-Owner: Rjain <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits