Finalize treatment of initial criterion
diff --git a/public/js/src/vc.js b/public/js/src/vc.js
index 03911ce..290531a 100644
--- a/public/js/src/vc.js
+++ b/public/js/src/vc.js
@@ -50,6 +50,27 @@
node.removeChild(node.firstChild);
};
+
+ // Add 'or'-criterion
+ KorAP._or = function (e) {
+ var obj = this.parentNode.refTo;
+ };
+
+
+ // Add 'and'-criterion
+ KorAP._and = function (e) {
+ var obj = this.parentNode.refTo;
+ };
+
+ // Remove doc or docGroup
+ KorAP._delete = function (e) {
+ var obj = this.parentNode.refTo;
+ if (obj.parent().ldType() !== null)
+ obj.parent().delOperand(obj).update();
+ else
+ obj.parent().clean();
+ };
+
KorAP.VirtualCollection = {
ldType : function () {
return null;
@@ -57,6 +78,13 @@
create : function () {
return Object.create(KorAP.VirtualCollection);
},
+ clean : function () {
+ if (this._root.ldType() !== "non") {
+ this._root.destroy();
+ this.root(KorAP.UnspecifiedDoc.create(this));
+ };
+ return this;
+ },
render : function (json) {
var obj = Object.create(KorAP.VirtualCollection);
@@ -129,19 +157,6 @@
}
};
- KorAP._or = function (e) {
- var obj = this.parentNode.refTo;
- };
-
- KorAP._and = function (e) {
- var obj = this.parentNode.refTo;
- };
-
- KorAP._delete = function (e) {
- var obj = this.parentNode.refTo;
- obj.parent().delOperand(obj).update();
- };
-
/**
* Operators for criteria
*/
@@ -239,7 +254,7 @@
* Unspecified criterion
*/
KorAP.UnspecifiedDoc = {
- _ldType : "doc",
+ _ldType : "non",
create : function (parent) {
var obj = Object.create(KorAP.JsonLD).
upgradeTo(KorAP.UnspecifiedDoc);
@@ -250,6 +265,7 @@
return obj;
},
update : function () {
+
if (this._element === undefined)
return this.element();
@@ -357,9 +373,7 @@
var op = this.operators(
true,
true,
- // No delete object, if this is the root
- (this._parent !== undefined &&
- this.parent().ldType() !== null) ? true : false
+ true
);
// Append new operators