TODO: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
* user rights names visualdata and pageencryption | |||
* this does not seem to work | |||
<pre> | |||
if ( $this->schemaId === null ) { | |||
$this->errors[] = 'no schema (' . $this->params['schema'] . ')'; | |||
return; | |||
} | |||
</pre> | |||
and | |||
<pre> | |||
public static function onPageSaveComplete( | |||
WikiPage $wikiPage, | |||
MediaWiki\User\UserIdentity $user, | |||
string $summary, | |||
int $flags, | |||
RevisionRecord $revisionRecord, | |||
MediaWiki\Storage\EditResult $editResult | |||
) { | |||
$title = $wikiPage->getTitle(); | |||
$revertMethod = $editResult->getRevertMethod(); | |||
\VisualData::onArticleSaveOrUndelete( $user, $wikiPage, $revisionRecord, $revertMethod ); | |||
// create schema id and printouts if is a new schema | |||
if ( $title->getNamespace() === NS_VISUALDATASCHEMA ) { | |||
$content = $revisionRecord->getContent( MediaWiki\Revision\SlotRecord::MAIN ); | |||
$contentHandler = $content->getContentHandler(); | |||
$modelId = $contentHandler->getModelID(); | |||
$text = $content->getNativeData(); | |||
$data = json_decode( $text, true ); | |||
if ( $data ) { | |||
$databaseManager = new DatabaseManager(); | |||
$databaseManager->createSchemaIdAndPrintouts( $data ); | |||
} | |||
} | |||
} | |||
</pre> | |||
and | |||
<pre> | |||
/** | |||
* @param array $schema | |||
*/ | |||
public function createSchemaIdAndPrintouts( $schema ) { | |||
$rows = []; | |||
// @FIXME use only if used in all similar cases | |||
// $this->escapeJsonPointerPart( ) | |||
$schemaId = $this->recordSchema( $schema['wiki']['name'] ); | |||
$thisClass = $this; | |||
</pre> | |||
after creating a new schema | |||
== done == | |||
* schema-builder, hidden field should not hide container for multiple items | * schema-builder, hidden field should not hide container for multiple items | ||
* tagmultiselect should work for email as well (not just text format) | * tagmultiselect should work for email as well (not just text format) | ||
Latest revision as of 16:09, 21 January 2025
- user rights names visualdata and pageencryption
- this does not seem to work
if ( $this->schemaId === null ) {
$this->errors[] = 'no schema (' . $this->params['schema'] . ')';
return;
}
and
public static function onPageSaveComplete(
WikiPage $wikiPage,
MediaWiki\User\UserIdentity $user,
string $summary,
int $flags,
RevisionRecord $revisionRecord,
MediaWiki\Storage\EditResult $editResult
) {
$title = $wikiPage->getTitle();
$revertMethod = $editResult->getRevertMethod();
\VisualData::onArticleSaveOrUndelete( $user, $wikiPage, $revisionRecord, $revertMethod );
// create schema id and printouts if is a new schema
if ( $title->getNamespace() === NS_VISUALDATASCHEMA ) {
$content = $revisionRecord->getContent( MediaWiki\Revision\SlotRecord::MAIN );
$contentHandler = $content->getContentHandler();
$modelId = $contentHandler->getModelID();
$text = $content->getNativeData();
$data = json_decode( $text, true );
if ( $data ) {
$databaseManager = new DatabaseManager();
$databaseManager->createSchemaIdAndPrintouts( $data );
}
}
}
and
/**
* @param array $schema
*/
public function createSchemaIdAndPrintouts( $schema ) {
$rows = [];
// @FIXME use only if used in all similar cases
// $this->escapeJsonPointerPart( )
$schemaId = $this->recordSchema( $schema['wiki']['name'] );
$thisClass = $this;
after creating a new schema
done
- schema-builder, hidden field should not hide container for multiple items
- tagmultiselect should work for email as well (not just text format)