1 /*! 2 * This file is part of Aloha Editor 3 * Author & Copyright (c) 2010 Gentics Software GmbH, aloha@gentics.com 4 * Licensed unter the terms of http://www.aloha-editor.com/license.html 5 */ 6 define( 7 [ 'aloha/core', 'util/class'], 8 function( Aloha, Class ) { 9 "use strict"; 10 11 var 12 // Aloha = window.Aloha, 13 // Class = window.Class, 14 GENTICS = window.GENTICS; 15 16 Aloha.RepositoryObject = function() {}; 17 18 /** 19 * @namespace Aloha.Repository 20 * @class Document 21 * @constructor 22 * 23 * Abstract Document suitable for most Objects.<br /><br /> 24 * 25 * Example: 26 * 27 <pre><code> 28 var item = new Aloha.Repository.Document({ 29 id: 1, 30 repositoryId: 'myrepository', 31 name: 'Aloha Editor - The HTML5 Editor', 32 type: 'website', 33 url:'http://aloha-editor.com', 34 }); 35 </code></pre> 36 * 37 * @param {Object} properties An object with the data. 38 * <div class="mdetail-params"><ul> 39 * <li><code>id</code> : String <div class="sub-desc">Unique identifier</div></li> 40 * <li><code>repositoryId</code> : String <div class="sub-desc">Unique repository identifier</div></li> 41 * <li><code>name</code> : String <div class="sub-desc">Name of the object. This name is used to display</div></li> 42 * <li><code>type</code> : String <div class="sub-desc">The specific object type</div></li> 43 * <li><code>partentId</code> : String (optional) <div class="sub-desc"></div></li> 44 * <li><code>mimetype</code> : String (optional) <div class="sub-desc">MIME type of the Content Stream</div></li> 45 * <li><code>filename</code> : String (optional) <div class="sub-desc">File name of the Content Stream</div></li> 46 * <li><code>length</code> : String (optional) <div class="sub-desc">Length of the content stream (in bytes)</div></li> 47 * <li><code>url</code> : String (optional) <div class="sub-desc">URL of the content stream</div></li> 48 * <li><code>renditions</code> : Array (optional) <div class="sub-desc">Array of different renditions of this object</div></li> 49 * <li><code>localName</code> : String (optional) <div class="sub-desc">Name of the object. This name is used internally</div></li> 50 * <li><code>createdBy</code> : String (optional) <div class="sub-desc">User who created the object</div></li> 51 * <li><code>creationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was created</div></li> 52 * <li><code>lastModifiedBy</code> : String (optional) <div class="sub-desc">User who last modified the object</div></li> 53 * <li><code>lastModificationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was last modified</div></li> 54 * </ul></div> 55 * 56 */ 57 Aloha.RepositoryDocument = Class.extend({ 58 _constructor: function (properties) { 59 60 var p = properties; 61 62 this.type = 'document'; 63 64 // Basic error checking for MUST attributes 65 if (!p.id || 66 !p.name || 67 !p.repositoryId 68 ) { 69 // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property"); 70 return; 71 } 72 73 GENTICS.Utils.applyProperties(this, properties); 74 75 this.baseType = 'document'; 76 } 77 // /** 78 // * Not implemented method to generate this JS API doc correctly. 79 // */ 80 // ,empty = function() } 81 82 }); 83 84 85 86 /** 87 * @namespace Aloha.Repository 88 * @class Folder 89 * @constructor 90 * Abstract Folder suitable for most strucural Objects.<br /><br /> 91 * 92 * Example: 93 * 94 <pre><code> 95 var item = new Aloha.Repository.Folder({ 96 id: 2, 97 repositoryId: 'myrepository', 98 name: 'images', 99 type: 'directory', 100 parentId:'/www' 101 }); 102 </code></pre> 103 * @param {Object} properties An object with the data. 104 * <div class="mdetail-params"><ul> 105 * <li><code>id</code> : String <div class="sub-desc">Unique identifier</div></li> 106 * <li><code>repositoryId</code> : String <div class="sub-desc">Unique repository identifier</div></li> 107 * <li><code>name</code> : String <div class="sub-desc">Name of the object. This name is used to display</div></li> 108 * <li><code>type</code> : String <div class="sub-desc">The specific object type</div></li> 109 * <li><code>partentId</code> : String (optional) <div class="sub-desc"></div></li> 110 * <li><code>localName</code> : String (optional) <div class="sub-desc">Name of the object. This name is used internally</div></li> 111 * <li><code>createdBy</code> : String (optional) <div class="sub-desc">User who created the object</div></li> 112 * <li><code>creationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was created</div></li> 113 * <li><code>lastModifiedBy</code> : String (optional) <div class="sub-desc">User who last modified the object</div></li> 114 * <li><code>lastModificationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was last modified</div></li> 115 * </ul></div> 116 * 117 */ 118 Aloha.RepositoryFolder = Class.extend({ 119 120 _constructor: function(properties) { 121 122 var p = properties; 123 124 this.type = 'folder'; 125 126 // Basic error checking for MUST attributes 127 if (!p.id || 128 !p.name || 129 !p.repositoryId 130 ) { 131 // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property"); 132 return; 133 } 134 135 GENTICS.Utils.applyProperties(this, properties); 136 137 this.baseType = 'folder'; 138 139 } 140 // /** 141 // * Not implemented method to generate this JS API doc correctly. 142 // */ 143 // ,empty = function() {}; 144 145 }); 146 }); 147