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