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