1 (function (GCN) { 2 3 'use strict'; 4 5 /** 6 * @private 7 * @const 8 * @type {number} 9 */ 10 var TYPE_ID = 10008; 11 12 /** 13 * @class 14 * @name FileAPI 15 * @extends ContentObjectAPI 16 * @extends TagContainerAPI 17 */ 18 var FileAPI = GCN.defineChainback({ 19 /** @lends FileAPI */ 20 21 __chainbacktype__: 'FileAPI', 22 23 _extends: [ GCN.ContentObjectAPI, GCN.TagContainerAPI ], 24 25 _type: 'file', 26 27 /** 28 * @type {Array.string} Writable properties for the page object. 29 */ 30 WRITEABLE_PROPS: [ 'cdate', 31 'description', 32 'folderId', // @TODO Check if moving is implemented 33 // correctly. 34 'name' ], 35 36 /** 37 * Retrieve the URL of this file's binary contents. You can use this to 38 * download the file from the server or to display an image. 39 * <b>WARNING!</b> Never ever store this URL in a page for users to 40 * load an image or to provide a download link. You should always refer 41 * to published files from the backend. Referencing a file directly 42 * using this link will put heavy load on you Gentics Content.Node CMS 43 * Server. 44 * 45 * @function 46 * @name binURL 47 * @memberOf FileAPI 48 * @return {string} Source URL of this file. 49 */ 50 '!binURL': function () { 51 return GCN.settings.BACKEND_PATH + '/rest/file/content/load/' + 52 this.id() + '?sid=' + GCN.sid; 53 } 54 55 }); 56 57 GCN.file = GCN.exposeAPI(FileAPI); 58 GCN.FileAPI = FileAPI; 59 60 }(GCN)); 61