Deprecated 'collection' parameter in favor of 'cq' - fixes #92

Change-Id: I51f0197da3a182fc4d4cd35f12ccb88cce3f8833
diff --git a/dev/js/spec/tourSpec.js b/dev/js/spec/tourSpec.js
index 18d3b4e..55307b4 100644
--- a/dev/js/spec/tourSpec.js
+++ b/dev/js/spec/tourSpec.js
@@ -14,11 +14,11 @@
       "<input autocapitalize='off' autocomplete='off' autocorrect='off' autofocus='autofocus' id='q-field' name='q' placeholder='Finde ...' spellcheck='false' type='search'>" +
       "<button type='submit' id='qsubmit' title='Los!'><span>Los!</span></button>" + 
     "</div>" + 
-    "<!-- Search in the following virtual collection -->"+
+    "<!-- Search in the following virtual corpus -->"+
     "<div id='vc-view'></div>" +
     "in" +
     "<span id='vc-choose' class='select'><span>allen Korpora</span></span>" +
-    "<input id='collection' name='collection' type='text' style='display: none;'>" +
+    "<input id='cq' name='cq' type='text' style='display: none;'>" +
       "mit" +
       "<span class='select'>" +
         "<select id='ql-field' name='ql' style='display: none;'>" +
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index 564b8d6..388a26d 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -1561,7 +1561,7 @@
       );
     });
 
-    it('should be deserializable from collection 1', function () {
+    it('should be deserializable from collection/corpus 1', function () {
       var kq = {
         "matches":["..."],
         "collection":{
@@ -1624,6 +1624,13 @@
       
       var vc = vcClass.create().fromJson(kq["collection"]);
       expect(vc.toQuery()).toEqual('(title = "Der Birnbaum" & pubPlace = "Mannheim" & (subTitle = "Aufzucht und Pflege" | subTitle = "Gedichte")) | pubDate since 2015-03-05');
+
+      kq["corpus"] = kq["collection"]
+      delete kq["collection"]
+
+      vc = vcClass.create().fromJson(kq["corpus"]);
+      expect(vc.toQuery()).toEqual('(title = "Der Birnbaum" & pubPlace = "Mannheim" & (subTitle = "Aufzucht und Pflege" | subTitle = "Gedichte")) | pubDate since 2015-03-05');
+      
     });
 
     it('should be deserializable from collection 2', function () {
@@ -1692,6 +1699,7 @@
       expect(vc.toQuery()).toEqual('availability = /CC-BY.*/ & author = "Goethe"');
     });
 
+    
     it('shouldn\'t be deserializable from collection with unknown type', function () {
       var kq = {
         "@type" : "koral:doc",
diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index e536ea2..eae75a8 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -85,7 +85,7 @@
 
 
   /**
-   * Retrieve information about collections
+   * Retrieve information about virtual corpora
    */
   KorAP.API.getCollections = function (cb) {
     KorAP.API.getJSON(KorAP.URL + '/collection', cb, "CorpusInfo");
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index ec11cf5..6de66d8 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -95,10 +95,10 @@
     };
 
     /**
-     * Replace Virtual Collection field
+     * Replace Virtual Corpus field
      */
     var vcname, vcchoose;
-    var input = d.getElementById('collection');
+    var input = d.getElementById('cq');
 
     var vc = KorAP.vc;
     
@@ -110,9 +110,10 @@
       vcname.classList.add('select');
 
       // Load virtual corpus object
-      if (KorAP.koralQuery !== undefined && KorAP.koralQuery["collection"]) {
+      // Supports "collection" for legacy reasons
+      if (KorAP.koralQuery !== undefined && (KorAP.koralQuery["collection"] || KorAP.koralQuery["corpus"])) {
         try {
-          vc.fromJson(KorAP.koralQuery["collection"]);
+          vc.fromJson(KorAP.koralQuery["collection"] || KorAP.koralQuery["corpus"]);
         }
         catch (e) {
           KorAP.log(0,e);
@@ -264,12 +265,12 @@
 
 
     /*
-     * Toggle the Virtual Collection builder
+     * Toggle the Virtual Corpus builder
      */
     if (vcname) {
       vc.onMinimize = function () {
         vcname.classList.remove('active');
-        delete show['collection'];
+        delete show['vc'];
       };
 
       vc.onOpen = function () {
@@ -279,7 +280,7 @@
         if (!view.firstChild)
           view.appendChild(this.element());
         
-        show['collection'] = true;
+        show['vc'] = true;
       };
       
       var vcclick = function () {
@@ -294,7 +295,7 @@
       vcname.onclick = vcclick;
 
       // Click, if the VC should be shown
-      if (show['collection']) {
+      if (show['vc']) {
         vcclick.apply();
       };
     };
diff --git a/dev/js/src/loc/de.js b/dev/js/src/loc/de.js
index de0ab80..99d3fa3 100644
--- a/dev/js/src/loc/de.js
+++ b/dev/js/src/loc/de.js
@@ -4,14 +4,7 @@
   loc.AND = 'und';
   // EMPTY, DELETE
 
-  // Virtual collection:
-  /*
-  loc.VC_subTitle = 'Untertitel';
-  loc.VC_title = 'Titel';
-  loc.VC_pubDate = 'Veröffentlichungsdatum';
-  loc.VC_pubPlace = 'Veröffentlichungsort';
-  */
-
+  // Virtual corpus:
   loc.VC_allCorpora = 'allen Korpora';
   loc.VC_oneCollection = 'einem virtuellen Korpus';
 
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index fd67863..5d1ccf0 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -1,6 +1,6 @@
 /**
- * Create virtual collections with a visual user interface. This resembles the
- * collection type objects of a KoralQuery "collection" object.
+ * Create virtual corpora with a visual user interface. This resembles the
+ * corpus/collection type objects of a KoralQuery "collection"/"corpus" object.
  * 
  * KoralQuery v0.3 is expected.
  * 
@@ -115,18 +115,18 @@
   };
 
   /**
-   * Virtual Collection
+   * Virtual corpus
    */
   return {
 
     /**
-     * The JSON-LD type of the virtual collection
+     * The JSON-LD type of the virtual corpus
      */
     ldType : function() {
       return null;
     },
 
-    // Initialize virtual collection
+    // Initialize virtual corpus
     _init : function(keyList) {
 
       // Inject localized css styles
@@ -164,7 +164,7 @@
     },
 
     /**
-     * Create a new virtual collection.
+     * Create a new virtual corpus
      */
     create : function(keyList) {
       var obj = Object.create(this)._init(keyList);
@@ -174,8 +174,8 @@
 
 
     /**
-     * Create and render a new virtual collection based on a KoralQuery
-     * collection document
+     * Create and render a new virtual corpus based on a KoralQuery
+     * corpus document
      */
     fromJson : function(json) {
       if (json !== undefined) {
@@ -255,7 +255,7 @@
     },
 
     /**
-     * Get or set the root object of the virtual collection.
+     * Get or set the root object of the virtual corpus
      */
     root : function(obj) {
       if (arguments.length === 1) {
diff --git a/dev/js/src/vc/choosemenu.js b/dev/js/src/vc/choosemenu.js
index 84f6ae9..90660b7 100644
--- a/dev/js/src/vc/choosemenu.js
+++ b/dev/js/src/vc/choosemenu.js
@@ -1,5 +1,5 @@
 /**
- * Menu showing all predefined virtual collections.
+ * Menu showing all predefined virtual corpora.
  * THIS IS EXPERIMENTAL AND MAY BE REMOVED!
  */
 define(['vc/menu', 'api'], function (menuClass, itemClass) {
diff --git a/dev/js/src/vc/stringval.js b/dev/js/src/vc/stringval.js
index 77c6d90..8b05787 100644
--- a/dev/js/src/vc/stringval.js
+++ b/dev/js/src/vc/stringval.js
@@ -1,5 +1,5 @@
 /**
- * Add string values to the virtual collection
+ * Add string values to the virtual corpus
  */
 define(['util'], {
 
diff --git a/dev/js/src/vc/unspecified.js b/dev/js/src/vc/unspecified.js
index 416ad85..4ffe507 100644
--- a/dev/js/src/vc/unspecified.js
+++ b/dev/js/src/vc/unspecified.js
@@ -1,5 +1,5 @@
 /**
- * An unspecified criterion in a virtual collection.
+ * An unspecified criterion in a virtual corpus.
  * Inherits everything from jsonld
  */
 define([