A kind of page assembly based on JSON specifications defines methodTechnical field
The present invention relates to a kind of page assemblies to define method, more particularly, to a kind of page assembly based on JSON specificationsChange definition method.
Background technology
In CMS Content Management Systems, in order to meet the needs of enterprise continues to develop variation, Page Template and self-defined skillArt is infrastructure technologies in CMS system.The technology can cause user to change according to demand, come in time adjust page structure andPattern meets Operational requirements.
Currently for Page Template and self-defined technology, there are following several technologies to realize.
1) technology based on HTML is realized.The technology does different degrees of extension for HTML specifications based on HTMLAnd encapsulation, to meet functional requirement.The shortcomings that technology is realized is that the page can run the bad control of granularity, the page data of outputIt is poor to quote row.
2) technology based on mould plate technique is realized.The technology based on the mould plate techniques such as FreeMarker, Velocity,It is encapsulated to carry out the definition of the page.The shortcomings that technology is realized is that the mould plate techniques adaptability such as FreeMarker is limited, the pageModularization function deficiency, it is impossible to meet the complete self-defined requirement of the page, while ease for use is poor.
3) realized based on customized JSON.The data that the technology is defined using the JSON data formats on internet as the pageConstruction standard.The technology realize the shortcomings that be due to each self-defined JSON data formats there is no the specification of standard carry out constraint andVerification, it is impossible to the integrality and uniformity of strict guarantee data.
It is either realized using which kind of technology, is inherently the self-defined of the page to be solved, to meet controlled particle size fortuneBattalion.
The content of the invention
It is an object of the present invention to overcome the above-mentioned drawbacks of the prior art and provide one kind is based on JSON specificationsPage assembly define method.
The purpose of the present invention can be achieved through the following technical solutions:
A kind of page assembly based on JSON specifications defines method, using JSON data structure storages page structure and pageFace data, and page data structure is defined and is verified using JSON Schema, ensure the specification of data definition with it is consistentProperty.
Preferably, the page structure includes Page Name and block, is defined with JSON data formats,
Form defines specific as follows:
Wherein:
Title is Page Name;
The block-identified symbols of pageBlocks, wherein can define one or more block.
Preferably, the block is the component of page structure, is defined with JSON data formats, specific latticeFormula is defined as follows:
Wherein:
Block name is the character by number or monogram, is uniquely named in page;
Title describes title for block, and value is arranged as required to;
Type is block type, wherein being traditionally arranged to be " object ";
options:The optional attribute of block, " collapsed " currently supported;
properties:Block attributes, block attributes use " attribute-name ":{ } defines, can set multiple attributes.
Preferably, the block attributes are the components of block, are defined with JSON data formats, form is fixedJustice is as follows:
Wherein:
Attribute-name is the character by number or monogram, is uniquely named in page;
Title is attribute description title, and value is arranged as required to;
Type is attribute type, and property value value is corresponding component type;
Options is the optional attribute of attribute, " required " currently supported.
Preferably, it the method achieve and arbitrary html tag and tag attribute datas in the page be defined, realize simultaneouslyThe management and operation of most fine granularity object in the page.
Preferably, this method is based on arbitrary fine-grained page elements definition, forms reusable atom level assembly, and energyEnough combinations based on atom level assembly, form new content components, realize the multiplexing of operation ability and experience, promote operation effectRate.
Compared with prior art, the present invention has the following advantages:
1) JSON is internet standard specification, in internet extensive use, technology maturation;
2) JSON has a wide range of application, convenient for the data exchange in system and outside system;
3) page definition is carried out using JSON data formats, the more fine-grained control management of the page can be carried out, metThe Operational requirements of various dimensions;
4) page definition and page data are in itself all using JSON forms, technical standard unification;
5) JSON Schema specifications are followed, JSON data can be constrained and verified, ensure the specification of data definitionProperty and uniformity.
Description of the drawings
Fig. 1 is the page assembly definition data structure relational graph of the present invention;
Fig. 2 is the Page Template definition process flow diagram of the present invention.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, completeSite preparation describes, it is clear that described embodiment is the part of the embodiment rather than whole embodiments of the present invention.Based on this hairEmbodiment in bright, the every other reality that those of ordinary skill in the art are obtained on the premise of creative work is not madeExample is applied, should all belong to the scope of protection of the invention.
A kind of page assembly based on JSON specifications defines method, using JSON data structure storages page structure and pageFace data, and page data structure is defined and is verified using JSON Schema, ensure the specification of data definition with it is consistentProperty.
According to operation level, the page is made of fine-grained units such as block, sub-block, operation positions.Operation position is minimumOperation block, be made of template-setup, template is defined by the component that JSON is expressed.
It is specifically defined and is described as follows:
√ page structures define
The page is Page Name and block, is defined with JSON data formats.
Form is defined as follows:
Wherein:
Title:It is Page Name;
pageBlocks:Block-identified symbol, wherein one or more blocks can be defined;
√ block structures define
Block is the chief component of the page, is defined with JSON data formats.
Form is defined as follows:
Wherein:
Block name:By number or the character of monogram, uniquely named in page, such as A4Gad;
title:Block describes title, and value is arranged as required to;
type:Block type, wherein being traditionally arranged to be " object ";
options:The optional attribute of block, " collapsed " currently supported;
properties:Block attributes, block attributes use " attribute-name ":{ } defines, can set multiple attributes;
√ block attributes structure defines
Block attributes are the components of block, are defined with JSON data formats.
Form is defined as follows:
Wherein:
Attribute-name:By number or the character of monogram, uniquely named in page, such as blockTitle;
title:Attribute description title, value are arranged as required to;
type:Attribute type, property value value are corresponding component type, such as TTextDef;
options:The optional attribute of attribute, " required " currently supported;
A kind of page assembly based on JSON specifications defines method, break through tradition CMS website-column-page it is interiorHold management structure, realize and arbitrary html tag and tag attribute datas in the page are defined, realize most fine granularity pair in the pageThe management and operation of elephant;It is defined based on arbitrary fine-grained page elements, forms reusable atom level assembly, and can be based onThe combination of atom level assembly forms new content components, realizes the multiplexing of operation ability and experience, promotes efficiency of operation.
Fig. 1 show page assembly definition data structure relation of the present invention.
According to operation level, the page is made of fine-grained units such as block, sub-block, operation positions.Operation position is minimumOperation block, be made of template-setup, template is defined by the component that JSON is expressed.
As shown in Fig. 2, the present invention realizes standard set for the page assembly page definition based on JSON specificationsOperation flow.Idiographic flow is described as follows:
1) page planning is carried out;
2) page block divides;
3) page block is set, and carries out block definition, block is set, block puts mark;
4) when block defines, can component be set according to actual Operational requirements;
5) page preview is carried out;
6) page definition is completed.
The above description is merely a specific embodiment, but protection scope of the present invention is not limited thereto, anyThose familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replaceIt changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with rightIt is required that protection domain subject to.