Added a raw getter to be able to extract images correctly

This commit is contained in:
Dan Larsen 2012-12-07 23:07:53 +01:00
parent 51e6abf477
commit 2435d1cf93
1 changed files with 24 additions and 0 deletions

View File

@ -59,6 +59,30 @@ function SearchEntry(options) {
});
return obj;
});
this.__defineGetter__('raw', function () {
var obj = {
dn: self.dn.toString(),
controls: []
};
self.attributes.forEach(function (a) {
if (a.buffers && a.buffers.length) {
if (a.buffers.length > 1) {
obj[a.type] = a.buffers.slice();
} else {
obj[a.type] = a.buffers[0];
}
} else {
obj[a.type] = [];
}
});
self.controls.forEach(function (element, index, array) {
obj.controls.push(element.json);
});
return obj;
});
this.__defineGetter__('_dn', function () {
return self.objectName;
});