0012940: Extend tag description and add fulltext index
authorMichael Spahn <m.spahn@metaways.de>
Mon, 3 Apr 2017 17:03:58 +0000 (19:03 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 19 Apr 2017 12:14:27 +0000 (14:14 +0200)
https://forge.tine20.org/view.php?id=12940

Change-Id: I742c39ddf81e15ba667561f1dea98dfc20af478c
Reviewed-on: http://gerrit.tine20.com/customers/4487
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Admin/js/TagEditDialog.js
tine20/Tinebase/Setup/Update/Release10.php
tine20/Tinebase/Setup/setup.xml

index 70c7446..4a079ca 100644 (file)
@@ -218,22 +218,23 @@ Tine.Admin.Tags.EditDialog = Ext.extend(Tine.widgets.dialog.EditRecord, {
                 border: false,
                 autoHeight: true,
                 items: [[{
-                    columnWidth: 0.3,
+                    columnWidth: 0.8,
                     fieldLabel: this.translation.gettext('Tag Name'), 
                     name: 'name',
                     allowBlank: false,
                     maxLength: 40
                 }, {
-                    columnWidth: 0.6,
-                    name: 'description',
-                    fieldLabel: this.translation.gettext('Description'),
-                    anchor: '100%',
-                    maxLength: 256
-                }, {
                     xtype: 'colorfield',
-                    columnWidth: 0.1,
+                    columnWidth: 0.2,
                     fieldLabel: this.translation.gettext('Color'),
                     name: 'color'
+                }], [{
+                    columnWidth: 1,
+                    name: 'description',
+                    fieldLabel: this.translation.gettext('Description'),
+                    anchor: '100%',
+                    xtype: 'textarea',
+                    height: 150
                 }]]
             }, {
                 region: 'center',
index 7971409..42237e3 100644 (file)
@@ -617,7 +617,6 @@ class Tinebase_Setup_Update_Release10 extends Setup_Update_Abstract
         $this->setApplicationVersion('Tinebase', '10.13');
     }
 
-
     /**
      * update to 10.14
      *
@@ -854,9 +853,6 @@ class Tinebase_Setup_Update_Release10 extends Setup_Update_Abstract
         }
     }
 
-
-
-
     /**
      * update to 10.18
      *
@@ -879,4 +875,56 @@ class Tinebase_Setup_Update_Release10 extends Setup_Update_Abstract
         $this->setTableVersion('tree_fileobjects', '5');
         $this->setApplicationVersion('Tinebase', '10.18');
     }
+
+    /**
+     * update to 10.19
+     *
+     * Add fulltext search index for tags description
+     */
+    public function update_18()
+    {
+        $declaration = new Setup_Backend_Schema_Index_Xml('
+            <index>
+                <name>description</name>
+                <fulltext>true</fulltext>
+                <field>
+                    <name>description</name>
+                </field>
+            </index>
+        ');
+
+        try {
+            $this->_backend->dropIndex('tags', 'description');
+        } catch (Exception $e) {
+            // Ignore, if there is no index, we can just go on and create one.
+        }
+
+        $this->_backend->addIndex('tags', $declaration);
+
+        $this->setTableVersion('tags', 8);
+        $this->setApplicationVersion('Tinebase', '10.19');
+    }
+
+    /**
+     * update to 10.20
+     *
+     * Make tags description a longtext field
+     */
+    public function update_19()
+    {
+        $declaration = new Setup_Backend_Schema_Field_Xml('
+            <field>
+                <name>description</name>
+                <!--Long text!-->
+                <length>2147483647</length>
+                <type>text</type>
+                <default>NULL</default>
+            </field>
+        ');
+
+        $this->_backend->alterCol('tags', $declaration);
+
+        $this->setTableVersion('tags', 9);
+        $this->setApplicationVersion('Tinebase', '10.20');
+    }
 }
index 80f3036..353d7f0 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Tinebase</name>
-    <version>10.18</version>
+    <version>10.20</version>
     <tables>
         <table>
             <name>applications</name>
 
         <table>
             <name>tags</name>
-            <version>7</version>
+            <version>9</version>
             <declaration>
                 <field>
                     <name>id</name>
                 </field>
                 <field>
                     <name>description</name>
+                    <!--Long text!-->
+                    <length>2147483647</length>
                     <type>text</type>
-                    <length>255</length>
                     <default>NULL</default>
                 </field>
                 <field>
                         <name>name</name>
                     </field>
                 </index>
+                <index>
+                    <name>description</name>
+                    <fulltext>true</fulltext>
+                    <field>
+                        <name>description</name>
+                    </field>
+                </index>
             </declaration>
         </table>