A lightweight OJS plugin extracted from the Texture plugin, focused on XML file editing with image/media management capabilities.
This plugin provides:
-
XML File Editing
- Open and edit XML files directly in the OJS workflow
- Save changes back to the submission file
- Preserves XML structure and metadata
-
Media/Image Management APIs
- Upload images and media files via API
- Retrieve embedded images from XML documents
- Delete media files
- Automatic association of media with XML documents as dependent files
-
Workflow Integration
- Adds "Edit XML" action to file grids
- Works across multiple workflow stages:
- Editor submission details
- Review files
- Copyedit files
- Production ready files
xmlEditor/
├── classes/
│ └── DAR.inc.php # JSON document structure builder
├── controllers/
│ └── XmlEditorHandler.inc.php # Main request handler (editor, JSON API, media API)
├── locale/
│ └── en_US/
│ └── locale.po # English translations
├── templates/
│ └── editor.tpl # Editor interface template
├── index.php # Plugin entry point
├── version.xml # Plugin metadata
└── XmlEditorPlugin.inc.php # Main plugin class
- Route:
xmlEditor/editor - Method: GET
- Parameters:
submissionId: Submission IDsubmissionFileId: File ID to editstageId: Workflow stage ID
- Description: Opens the XML editor interface
- Route:
xmlEditor/json - Methods:
- GET: Load XML document as JSON for editing
- PUT: Save edited XML document or upload media
- DELETE: Remove media file
- Parameters:
submissionId: Submission IDsubmissionFileId: File IDstageId: Workflow stage ID
- Route:
xmlEditor/media - Method: GET
- Parameters:
assocId: Associated XML file IDfileId: Media file ID
- Description: Serves media files (images, etc.) associated with XML documents
editor()(lines 73-113): Displays the XML editor interfacejson()(lines 121-266): Handles document loading and saving- GET: Loads document as JSON
- PUT: Saves document or uploads media
- DELETE: Removes media files
updateManuscriptFile()(lines 274-318): Updates XML file contentmedia()(lines 326-369): Serves media files with proper headers_getGenreId()(lines 377-395): Determines genre for uploaded media
construct(): Creates JSON structure for editorcreateManuscript(): Prepares XML for editingcreateManifest(): Generates manifest with asset referencescreateMediaInfo(): Builds media URL mappingsgetDependentFilePaths(): Retrieves associated media files
The following Texture-specific features were NOT included:
- JATS metadata manipulation (JATS.inc.php)
- DAR/ZIP archive export functionality
- DAR/ZIP archive extraction functionality
- Galley creation features
- Service file handlers (ORKG, OAI-PMH integration)
- Publication workflow forms
- Place the
xmlEditordirectory in/plugins/generic/ - Navigate to Settings > Website > Plugins in OJS
- Find "XML Editor Plugin" and click Enable
- The plugin will add "Edit XML" links to XML files in the workflow
- Upload an XML file to any workflow stage
- Click the "Edit XML" link that appears next to the XML file
- Edit the document in the editor interface
- Upload images via the editor interface
- Save changes back to OJS
- OJS 3.3.x
- PHP 7.3 or higher
- XML and DOM extensions enabled
Copyright (c) 2003-2022 Simon Fraser University Copyright (c) 2003-2022 John Willinsky Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
Extracted and simplified from the OJS Texture Plugin.