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 * @private 14 * @const 15 * @type {object.<string, boolean>} Default file settings. 16 */ 17 var DEFAULT_SETTINGS = { 18 // Load file for updating 19 update: true 20 }; 21 22 /** 23 * @class 24 * @name FileAPI 25 * @extends ContentObjectAPI 26 * @extends TagContainerAPI 27 */ 28 var FileAPI = GCN.defineChainback({ 29 /** @lends FileAPI */ 30 31 __chainbacktype__: 'FileAPI', 32 33 _extends: [ GCN.ContentObjectAPI, GCN.TagContainerAPI ], 34 35 _type: 'file', 36 37 /** 38 * @type {Array.string} Writable properties for the page object. 39 */ 40 WRITEABLE_PROPS: [ 'cdate', 41 'description', 42 'folderId', // @TODO Check if moving is implemented 43 // correctly. 44 'name' ], 45 46 /** 47 * Retrieve the URL of this file's binary contents. You can use this to 48 * download the file from the server or to display an image. 49 * <b>WARNING!</b> Never ever store this URL in a page for users to 50 * load an image or to provide a download link. You should always refer 51 * to published files from the backend. Referencing a file directly 52 * using this link will put heavy load on you Gentics Content.Node CMS 53 * Server. 54 * 55 * @function 56 * @name binURL 57 * @memberOf FileAPI 58 * @return {string} Source URL of this file. 59 */ 60 '!binURL': function () { 61 return ( 62 GCN.settings.BACKEND_PATH + '/rest/file/content/load/' 63 + this.id() + '?sid=' + GCN.sid 64 + GCN._getChannelParameter(this, '&') 65 ); 66 }, 67 68 /** 69 * @see ContentObjectAPI.!_loadParams 70 */ 71 '!_loadParams': function () { 72 return jQuery.extend(DEFAULT_SETTINGS, this._settings); 73 } 74 }); 75 76 GCN.file = GCN.exposeAPI(FileAPI); 77 GCN.FileAPI = FileAPI; 78 79 }(GCN)); 80