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', 29 'util/class' 30 ], function ( 31 Aloha, 32 Class 33 ) { 34 "use strict"; 35 36 var GENTICS = window.GENTICS; 37 38 Aloha.RepositoryObject = function () {}; 39 40 /** 41 * @namespace Aloha.Repository 42 * @class Document 43 * @constructor 44 * 45 * Abstract Document suitable for most Objects.<br /><br /> 46 * 47 * Example: 48 * 49 <pre><code> 50 var item = new Aloha.Repository.Document({ 51 id: 1, 52 repositoryId: 'myrepository', 53 name: 'Aloha Editor - The HTML5 Editor', 54 type: 'website', 55 url:'http://aloha-editor.com', 56 }); 57 </code></pre> 58 * 59 * @param {Object} properties An object with the data. 60 * <div class="mdetail-params"><ul> 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 || !p.name || !p.repositoryId) { 88 // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property"); 89 return; 90 } 91 92 GENTICS.Utils.applyProperties(this, properties); 93 94 this.baseType = 'document'; 95 } 96 // /** 97 // * Not implemented method to generate this JS API doc correctly. 98 // */ 99 // ,empty = function() } 100 101 }); 102 103 104 105 /** 106 * @namespace Aloha.Repository 107 * @class Folder 108 * @constructor 109 * Abstract Folder suitable for most strucural Objects.<br /><br /> 110 * 111 * Example: 112 * 113 <pre><code> 114 var item = new Aloha.Repository.Folder({ 115 id: 2, 116 repositoryId: 'myrepository', 117 name: 'images', 118 type: 'directory', 119 parentId:'/www' 120 }); 121 </code></pre> 122 * @param {Object} properties An object with the data. 123 * <div class="mdetail-params"><ul> 124 * <li><code>id</code> : String <div class="sub-desc">Unique identifier</div></li> 125 * <li><code>repositoryId</code> : String <div class="sub-desc">Unique repository identifier</div></li> 126 * <li><code>name</code> : String <div class="sub-desc">Name of the object. This name is used to display</div></li> 127 * <li><code>type</code> : String <div class="sub-desc">The specific object type</div></li> 128 * <li><code>partentId</code> : String (optional) <div class="sub-desc"></div></li> 129 * <li><code>localName</code> : String (optional) <div class="sub-desc">Name of the object. This name is used internally</div></li> 130 * <li><code>createdBy</code> : String (optional) <div class="sub-desc">User who created the object</div></li> 131 * <li><code>creationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was created</div></li> 132 * <li><code>lastModifiedBy</code> : String (optional) <div class="sub-desc">User who last modified the object</div></li> 133 * <li><code>lastModificationDate</code> : Date (optional) <div class="sub-desc">DateTime when the object was last modified</div></li> 134 * </ul></div> 135 * 136 */ 137 Aloha.RepositoryFolder = Class.extend({ 138 139 _constructor: function (properties) { 140 141 var p = properties; 142 143 this.type = 'folder'; 144 145 // Basic error checking for MUST attributes 146 if (!p.id || !p.name || !p.repositoryId) { 147 // Aloha.Log.error(this, "No valid Aloha Object. Missing MUST property"); 148 return; 149 } 150 151 GENTICS.Utils.applyProperties(this, properties); 152 153 this.baseType = 'folder'; 154 155 } 156 // /** 157 // * Not implemented method to generate this JS API doc correctly. 158 // */ 159 // ,empty = function() {}; 160 161 }); 162 }); 163