Picture of Jorge Castrillo
issue adding asset image in contentObject? Authoring tool
by Jorge Castrillo - Thursday, 4 August 2016, 10:18 PM
 

Hi guys

Recently i was create a simple extension to help the configuration of cover-menu, its very simple, this extension only have a propertie.schema, in this file i define the structure that i need in the contentObject.json, its something like this:

"_coverMenu": {
"_backgroundGraphic": {
"alt": "",
"src": "course/assets/647739e1dbf91d411dd850e97dcdd365bafa0481.jpg"
},
"_indicatorGraphic": {
"_isComplete": "course/assets/5fa67cd15fa40e7ea6621e8e1760d4ee60c39bf4.png",
"_isVisited": "course/assets/6aeb99dd8bdcb9f791dffcb9933896d692d9e1a7.png",
"_isLocked": "course/assets/579f410754489b3c8289dd9f8bb7f08d8989b207.png",
"_default": "course/assets/8a216d2b88038fc6278e405623b7d69080ba0a34.png"
}
}

The problem is, when the authoring tool put the path of the asset, this miss the "en" folder. I put the same properties.schema in the block section and work fine, dont miss the "en" folder.

contentObjects.json

[
{
"_id": "57a26852192ad1000972d500",
"_type": "page",
"_parentId": "course",
"_graphic": {
"alt": "",
"src": "course/assets/4a792a70d19ed14054820030b25109a0e244b13e.jpg"
},
"_isAvailable": true,
"_isOptional": false,
"_lockedBy": [],
"duration": "",
"linkText": "Entrar",
"_classes": "",
"body": "",
"displayTitle": "Unidad 1",
"title": "Unidad 1",
"_pageLevelProgress": {
"_isEnabled": true,
"_showPageCompletion": true
},
"_coverMenu": {
"_backgroundGraphic": {
"alt": "",
"src": "course/assets/647739e1dbf91d411dd850e97dcdd365bafa0481.jpg"
},
"_indicatorGraphic": {
"_isComplete": "course/assets/5fa67cd15fa40e7ea6621e8e1760d4ee60c39bf4.png",
"_isVisited": "course/assets/6aeb99dd8bdcb9f791dffcb9933896d692d9e1a7.png",
"_isLocked": "course/assets/579f410754489b3c8289dd9f8bb7f08d8989b207.png",
"_default": "course/assets/8a216d2b88038fc6278e405623b7d69080ba0a34.png"
}
}
}
]

block.json

[
{
"_id": "57a26852192ad1000972d502",
"_type": "block",
"_parentId": "57a26852192ad1000972d501",
"_isAvailable": true,
"_isOptional": false,
"_trackingId": 1,
"_classes": "",
"body": "",
"displayTitle": "",
"title": "Block title",
"_coverMenu": {
"_backgroundGraphic": {
"alt": "",
"src": "course/en/assets/647739e1dbf91d411dd850e97dcdd365bafa0481.jpg"
},
"_indicatorGraphic": {
"_isComplete": "course/en/assets/5fa67cd15fa40e7ea6621e8e1760d4ee60c39bf4.png",
"_isVisited": "course/en/assets/6aeb99dd8bdcb9f791dffcb9933896d692d9e1a7.png",
"_isLocked": "course/en/assets/579f410754489b3c8289dd9f8bb7f08d8989b207.png",
"_default": "course/en/assets/8a216d2b88038fc6278e405623b7d69080ba0a34.png"
}
}
}
]

properties.schema

{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema",
"id": "http://jsonschema.net",
"required":false,
"properties": {
"pluginLocations": {
"type":"object",
"required":true,
"properties":{
"config": {
"type":"object"
},
"course": {
"type":"object"
},
"contentobject": {
"type":"object",
"properties":{
"_coverMenu": {
"type":"object",
"required":false,
"legend": "CoverMenu",
"properties":{
"_backgroundGraphic": {
"type":"object",
"required":false,
"legend": "Background image (Big)",
"properties":{
"alt": {
"type":"string",
"required": false,
"default": "",
"title": "Alternative Text",
"inputType": "Text",
"validators": [],
"help": "Alternative text for this items image",
"translatable": true
},
"src": {
"type":"string",
"required": true,
"default": "",
"title": "Select Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
}
}
},
"_indicatorGraphic": {
"type":"object",
"required":false,
"legend": "IndicatorsGraphics",
"properties":{
"_isComplete": {
"type":"string",
"required": true,
"default": "",
"title": "Select the complete Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
},
"_isVisited": {
"type":"string",
"required": true,
"default": "",
"title": "Select visited Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
},
"_isLocked": {
"type":"string",
"required": true,
"default": "",
"title": "Select locked Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
},
"_default": {
"type":"string",
"required": true,
"default": "",
"title": "Select default Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
}
}
}
}
}
}
},
"article": {
"type":"object"
},
"block": {
"type":"object",
"properties":{
"_coverMenu": {
"type":"object",
"required":false,
"legend": "CoverMenu",
"properties":{
"_backgroundGraphic": {
"type":"object",
"required":false,
"legend": "Background image (Big)",
"properties":{
"alt": {
"type":"string",
"required": false,
"default": "",
"title": "Alternative Text",
"inputType": "Text",
"validators": [],
"help": "Alternative text for this items image",
"translatable": true
},
"src": {
"type":"string",
"required": true,
"default": "",
"title": "Select Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
}
}
},
"_indicatorGraphic": {
"type":"object",
"required":false,
"legend": "IndicatorsGraphics",
"properties":{
"_isComplete": {
"type":"string",
"required": true,
"default": "",
"title": "Select the complete Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
},
"_isVisited": {
"type":"string",
"required": true,
"default": "",
"title": "Select visited Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
},
"_isLocked": {
"type":"string",
"required": true,
"default": "",
"title": "Select locked Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
},
"_default": {
"type":"string",
"required": true,
"default": "",
"title": "Select default Graphic",
"inputType": "Asset:image",
"validators": ["required"],
"help": ""
}
}
}
}
}
}
},
"component": {
"type":"object"
}
}
}
}
}

Some suggestion?