1 (function (GCN) { 2 3 'use strict'; 4 5 /** 6 * @class 7 * @name TemplateAPI 8 * @extends ContentObjectAPI 9 * @extends TagContainerAPI 10 */ 11 var TemplateAPI = GCN.defineChainback({ 12 /** @lends TemplateAPI */ 13 14 __chainbacktype__: 'TemplateAPI', 15 _extends: [ GCN.ContentObjectAPI, GCN.TagContainerAPI ], 16 _type: 'template', 17 18 //--------------------------------------------------------------------- 19 // Surface tag container methods that are applicable for GCN page 20 // objects. 21 //--------------------------------------------------------------------- 22 23 /** 24 * Creates a tag of a given tagtype in this template. 25 * 26 * Exmaple: 27 * <pre> 28 * createTag('link', 'http://www.gentics.com', onSuccess, onError); 29 * </pre> 30 * or 31 * <pre> 32 * createTag('link', onSuccess, onError); 33 * </pre> 34 * 35 * @public 36 * @function 37 * @name createTag 38 * @memberOf TemplateAPI 39 * @param {string} construct The name of the construct on which the tag 40 * to be created should be derived from. 41 * @param {string=} magicValue Optional property that will override the 42 * default values of this tag type. 43 * @param {function(TagAPI)=} success Optional callback that will 44 * receive the newly created tag as 45 * its only argument. 46 * @param {function(GCNError):boolean=} error Optional custom error 47 * handler. 48 * @return {TagAPI} The newly created tag. 49 * @throws INVALID_ARGUMENTS 50 */ 51 '!createTag': function () { 52 return this._createTag.apply(this, arguments); 53 }, 54 55 /** 56 * Deletes the specified tag from this template. 57 * 58 * @public 59 * @function 60 * @name removeTag 61 * @memberOf TemplateAPI 62 * @param {string} id The id of the tag to be deleted. 63 * @param {function(TemplateAPI)=} success Optional callback that 64 * receive this object as its 65 * only argument. 66 * @param {function(GCNError):boolean=} error Optional custom error 67 * handler. 68 */ 69 removeTag: function () { 70 this._removeTag.apply(this, arguments); 71 }, 72 73 /** 74 * Deletes a set of tags from this template. 75 * 76 * @public 77 * @function 78 * @name removeTags 79 * @memberOf TemplateAPI 80 * @param {Array.<string>} ids The ids of the set of tags to be 81 * deleted. 82 * @param {function(TemplateAPI)=} success Optional callback that 83 * receive this object as its 84 * only argument. 85 * @param {function(GCNError):boolean=} error Optional custom error 86 * handler. 87 */ 88 removeTags: function () { 89 this._removeTags.apply(this, arguments); 90 }, 91 92 /** 93 * @public 94 * @TODO: Not yet implemented. 95 */ 96 remove: function (success, error) { 97 98 }, 99 100 /** 101 * @public 102 * @TODO: Not yet implemented. 103 */ 104 save: function (success, error) { 105 106 }, 107 108 /** 109 * @public 110 * @TODO: Not yet implemented. 111 */ 112 folder: function (success, error) { 113 114 } 115 116 }); 117 118 GCN.template = GCN.exposeAPI(TemplateAPI); 119 GCN.TemplateAPI = TemplateAPI; 120 121 }(GCN)); 122