1 /* repositoryobjects.js is part of Aloha Editor project http://aloha-editor.org 2 * 3 * Aloha Editor is a WYSIWYG HTML5 inline editing library and editor. 4 * Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria. 5 * Contributors http://aloha-editor.org/contribution.php 6 * 7 * Aloha Editor is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or any later version. 11 * 12 * Aloha Editor is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * As an additional permission to the GNU GPL version 2, you may distribute 22 * non-source (e.g., minimized or compacted) forms of the Aloha-Editor 23 * source code without the copy of the GNU GPL normally required, 24 * provided you include this license notice and a URL through which 25 * recipients can access the Corresponding Source. 26 */ 27 define( 28 [ 'aloha/core', 'util/class'], 29 function( Aloha, Class ) { 30 "use strict"; 31 32 var 33 // Aloha = window.Aloha, 34 // Class = window.Class, 35 GENTICS = window.GENTICS; 36 37 Aloha.RepositoryObject = function() {}; 38 39 /** 40 * @namespace Aloha.Repository 41 * @class Document 42 * @constructor 43 * 44 * Abstract Document suitable for most Objects.<br /><br /> 45 * 46 * Example: 47 * 48 <pre><code> 49 var item = new Aloha.Repository.Document({ 50 id: 1, 51 repositoryId: 'myrepository', 52 name: 'Aloha Editor - The HTML5 Editor', 53 type: 'website', 54 url:'http://aloha-editor.com', 55 }); 56 </code></pre> 57 * 58 * @param {Object} properties An object with the data. 59 * <div class="mdetail-params"><ul> 60 61 * <li><code>id</code> : String <div class="sub-desc">Unique identifier</div></li> 62 * <li><code>repositoryId</code> : String <div class="sub-desc">Unique repository identifier</div></li> 63 * <li><code>name</code> : String <div class="sub-desc">Name of the object. This name is used to display</div></li> 64 * <li><code>type</code> : String <div class="sub-desc">The specific object type</div></li> 65 * <li><code>partentId</code> : String (optional) <div class="sub-desc"></div></li> 66 * <li><code>mimetype</code> : String (optional) <div class="sub-desc">MIME type of the Content Stream</div></li> 67 * <li><code>filename</code> : String (optional) <div class="sub-desc">File name of the Content Stream</div></li> 68 * <li><code>length</code> : String (optional) <div class="sub-desc">Length of the content stream (in bytes)</div></li> 69 * <li><code>url</code> : String (optional) <div class="sub-desc">URL of the content stream</div></li> 70 * <li><code>renditions</code> : Array (optional) <div class="sub-desc">Array of different renditions of this object</div></li> 71 * <li><code>localName</code> : String (optional) <div class="sub-desc">Name of the object. This name is used internally</div></li> 72 * <li><code>createdBy</code> : String (optional) <div class="sub-desc">User who created the object</div></li> 73 * <li><code>creationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was created</div></li> 74 * <li><code>lastModifiedBy</code> : String (optional) <div class="sub-desc">User who last modified the object</div></li> 75 * <li><code>lastModificationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was last modified</div></li> 76 * </ul></div> 77 * 78 */ 79 Aloha.RepositoryDocument = Class.extend({ 80 _constructor: function (properties) { 81 82 var p = properties; 83 84 this.type = 'document'; 85 86 // Basic error checking for MUST attributes 87 if (!p.id || 88 !p.name || 89 !p.repositoryId 90 ) { 91 // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property"); 92 return; 93 } 94 95 GENTICS.Utils.applyProperties(this, properties); 96 97 this.baseType = 'document'; 98 } 99 // /** 100 // * Not implemented method to generate this JS API doc correctly. 101 // */ 102 // ,empty = function() } 103 104 }); 105 106 107 108 /** 109 * @namespace Aloha.Repository 110 * @class Folder 111 * @constructor 112 * Abstract Folder suitable for most strucural Objects.<br /><br /> 113 * 114 * Example: 115 * 116 <pre><code> 117 var item = new Aloha.Repository.Folder({ 118 id: 2, 119 repositoryId: 'myrepository', 120 name: 'images', 121 type: 'directory', 122 parentId:'/www' 123 }); 124 </code></pre> 125 * @param {Object} properties An object with the data. 126 * <div class="mdetail-params"><ul> 127 * <li><code>id</code> : String <div class="sub-desc">Unique identifier</div></li> 128 * <li><code>repositoryId</code> : String <div class="sub-desc">Unique repository identifier</div></li> 129 * <li><code>name</code> : String <div class="sub-desc">Name of the object. This name is used to display</div></li> 130 * <li><code>type</code> : String <div class="sub-desc">The specific object type</div></li> 131 * <li><code>partentId</code> : String (optional) <div class="sub-desc"></div></li> 132 * <li><code>localName</code> : String (optional) <div class="sub-desc">Name of the object. This name is used internally</div></li> 133 * <li><code>createdBy</code> : String (optional) <div class="sub-desc">User who created the object</div></li> 134 * <li><code>creationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was created</div></li> 135 * <li><code>lastModifiedBy</code> : String (optional) <div class="sub-desc">User who last modified the object</div></li> 136 * <li><code>lastModificationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was last modified</div></li> 137 * </ul></div> 138 * 139 */ 140 Aloha.RepositoryFolder = Class.extend({ 141 142 _constructor: function(properties) { 143 144 var p = properties; 145 146 this.type = 'folder'; 147 148 // Basic error checking for MUST attributes 149 if (!p.id || 150 !p.name || 151 !p.repositoryId 152 ) { 153 // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property"); 154 return; 155 } 156 157 GENTICS.Utils.applyProperties(this, properties); 158 159 this.baseType = 'folder'; 160 161 } 162 // /** 163 // * Not implemented method to generate this JS API doc correctly. 164 // */ 165 // ,empty = function() {}; 166 167 }); 168 }); 169