Table of Contents |
---|
JSON structures used in WIP II development:
Contents:
Content typesDocumentation to do:
Tooltips
HTML
Unique content types
Region: domestic vs international%globals_asset_url:ASSETID^json_encode% and anchor links
Uploading images - allow access unrestricted
...
Quotes and “ ” charactersNewlines
Shared blocks
JSON structures
...
This is a bit confusing, so see Architecture>Interior Architecture for a good example of how it is used. (Asset id 309042)
The content element is used to provide extra information about the related degree where necessary. This is just a plain text field. See Economics and Finance>Actuarial Science for a good example of this (asset number 309568).
...
Please list below any content types that are not covered above, and get Andrew Bredenkamp to write up appropriate documentation on them.
Squiz keywords. When and how to use them:
%globals_asset_url:ASSETID^json_encode%
The %globals_asset_BLAH:0000% keyword is used to get information about a different asset and place it where the keyword is. For example %globals_asset_url:10% will be replaced by the full url for that asset, while %globals_asset_name:10% will be replaced with the name of asset 10.
The ^json_encode that is in each of them ensures that the content that returns is escaped properly for a json object. For example, if for some reason there was a " in the content, it would break the json object it is inserted into. ^json_encode will instead replace it with \".
please ensure ^json_encode is used on every keyword that is used. Not doing so may end up causing very hard to find issues further down the line.
./?a=ASSETID
This is a sort of short hand way of doing %globals_asset_url:10% that only works in href values. (ie <a href='./?a=10'>link text</a>). However, it does not play nicely with the json objects so we don't use it. It is mentioned here solely in case it is encountered in other areas of the site.
%globals_asset_attribute_BLAH:ASSETID^json_encode%
This is used in the slideshow and on images to get specific attributes. These are normally attributes on the assets details page.
%globals_asset_attribute_caption:340296^json_encode% returns the caption of the image
%globals_asset_attribute_alt:340296^json_encode% returns the alt-text of the image.
%globals_asset_metadata_BLAH:ASSETID^json_encode%
This is used to get metadata values of the specified asset. These are edited via the metadata page of that asset.
Anchor links (e.g. #advisers)
You can not link directly to an anchor link with a %globals_asset_url:ASSETID^json_encode% keyword, however there's nothing stopping you from adding text after it to apply an anchor link to it.
For example <a href='%globals_asset_url:54655^json_encode%#advisers'>link text</a> will link to http://www.victoria.ac.nz/vbs/about/staff#advisers.
New lines in text
If you are getting corrupt json values, there is a good chance it is because there is a newline in it somewhere. These are not allowed as they break json objects. When importing content, make sure that all newlines are replaced with:
Code Block |
---|
\n |
So this:
Code Block |
---|
Any building you enter has a complex history—from concept, to design, to construction.
Study a Bachelor of Building Science and gain a solid understanding of what it takes to develop a building that's efficient and sustainable and safe. Learn how to organise teams, plan the construction process and manage contractors and constructions sites.
Get the basics alongside Architecture students in the first year, then specialise in Sustainable Engineering Systems or Project Management.
At the end of your Bachelor’s degree you can stay on and study for a Master of Building Science. You’ll graduate skilled and work ready.
|
Will become this:
Code Block |
---|
{
"contentType" : "content-plain",
"heading" : "",
"content" : "Any building you enter has a complex history—from concept, to design, to construction.\nStudy Building Science and gain a solid understanding of what it takes to develop a building that's efficient and sustainable and safe. Learn how to organise teams, plan the construction process and manage contractors and construction sites.\nGet the basics alongside Architecture students in the first year, then specialise in Sustainable Engineering Systems, Project Management or both.\nAt the end of your Bachelor’s degree you can stay on and study for a Master of Building Science. You’ll graduate skilled and work ready. "
} |
This is then turned into <p> tags via the angular app where necessary, but this should not cause an issue.