README.md
author cavaliet
Fri, 24 Jan 2014 17:47:58 +0100
changeset 113 83368005f790
parent 112 14653baf4f6b
child 114 ed31d6008d31
permissions -rw-r--r--
comment not needed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     1
# WikiTagBundle
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     2
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     3
WikiTagBundle is a php bundle for [Symfony 2](http://symfony.com/) released by the [Institute for research and innovation](http://www.iri.centrepompidou.fr/) (IRI).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     4
It enables to add semantised tags to any kind of document. 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     5
By semantised, we mean that a tag has its label, but also a wikipedia link related to this label. Right now, for v1.0, it works with the french wikipedia.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     6
For a simple example, the tag "Asie" is related to the link [http://fr.wikipedia.org/wiki/Asie](http://fr.wikipedia.org/wiki/Asie).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     7
The tag can also be categorised, by any value in a list.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     8
The tag can also have an alias, which is any string value.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
     9
When a wikipedia entry is found, the bundle also searches a [dbPedia](http://dbpedia.org/) entry for the english equivalent, for example [http://dbpedia.org/page/Asia](http://dbpedia.org/page/Asia).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    10
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    11
A tag can have 4 kinds of wikipedia links :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    12
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    13
* **match** - Perfect match between the label and the wikipedia entry (i.e. [Asie](http://fr.wikipedia.org/wiki/Asie)).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    14
* **redirection** - The label exists in wikipedia but redirects to an other entry (i.e. Louis XIV to [Louis XIV de France](http://fr.wikipedia.org/wiki/Louis_XIV_de_France)).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    15
* **homonymy** - The label leads to wikipedia homonymy page (i.e. [Abstraction](http://fr.wikipedia.org/wiki/Abstraction)).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    16
* **null result** - The label is not related to any wikipedia entry. So we build a link leading to the search page (i.e. [art multimédia](http://fr.wikipedia.org/w/index.php?search=art+multim%C3%A9dia)).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    17
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    18
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    19
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    20
## Install
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    21
WikiTagBundle is a php bundle for [Symfony 2](http://symfony.com/).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    22
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    23
* Install the dependencies : [PagerFanta](https://github.com/whiteoctober/Pagerfanta) and [Mondator](https://github.com/mandango/mondator).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    24
* Download the zipfile from the [downloads](https://github.com/) page and install it.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    25
* Once unzipped, just copy the IRI folder in your vendor/bundles folder. The folder hierarchy will be vendor/bundles/IRI/Bundle/WikiTagBundle.
90
181bf8dc6f87 correct README to include License
ymh <ymh.work@gmail.com>
parents: 89
diff changeset
    26
181bf8dc6f87 correct README to include License
ymh <ymh.work@gmail.com>
parents: 89
diff changeset
    27
## License
181bf8dc6f87 correct README to include License
ymh <ymh.work@gmail.com>
parents: 89
diff changeset
    28
181bf8dc6f87 correct README to include License
ymh <ymh.work@gmail.com>
parents: 89
diff changeset
    29
This bundle is under the CeCILL-C license. See the complete license in the bundle:
181bf8dc6f87 correct README to include License
ymh <ymh.work@gmail.com>
parents: 89
diff changeset
    30
181bf8dc6f87 correct README to include License
ymh <ymh.work@gmail.com>
parents: 89
diff changeset
    31
    Resources/meta/LICENSE
181bf8dc6f87 correct README to include License
ymh <ymh.work@gmail.com>
parents: 89
diff changeset
    32
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    33
   
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    34
## Getting Started
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    35
* Install WikiTagBundle
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    36
* Register the bundle in AppKernel.php :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    37
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    38
         ... new IRI\Bundle\WikiTagBundle\WikiTagBundle(), ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    39
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    40
* Register the namespace in the autoload.php :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    41
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    42
         ... 'IRI\Bundle\WikiTagBundle'   => \_\_DIR\_\_.'/../vendor/bundles', ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    43
    
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    44
* Register the namespace fallbacks in the autoload.php :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    45
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    46
        $loader->registerNamespaceFallbacks(array(
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    47
            \_\_DIR\_\_.'/../src',
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    48
            \_\_DIR\_\_.'/cache/dev/wikitag',
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    49
            \_\_DIR\_\_.'/cache/prod/wikitag',
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    50
            \_\_DIR\_\_.'/cache/test/wikitag',
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    51
            \_\_DIR\_\_.'/cache/task/wikitag',
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    52
        ));
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    53
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    54
* Since WikiTagBundle builds its own document class from the host app's document class, you need to tell in config.yml what is the host app's document class and what _text_ fields will be used in this class. 
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    55
These fields are used for searching and to calculate the tag's weight. Example :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    56
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    57
        wiki_tag:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    58
            document_class: Company\BaseBundle\Entity\Document
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    59
            document_id_column: id
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    60
            fields:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    61
                title:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    62
                    type: string
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    63
                    length: 1024
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    64
                    accessor: getTitre
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    65
                    weight: 1.0
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    66
                description:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    67
                    type: text
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    68
                    weight: 0.5
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    69
The 'document_id_column' option is used to indicate the primary key column used by the host app's document class. We are currently limited to non composite primary keys.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    70
A field definition has the following format:
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    71
<field name>:
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    72
    type: <string or text> : field type. default : text 
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    73
    length: <int> : the length of the field. ignored if field type is text
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    74
    accessor: <field name or method name> : the field name in the host app's document class, or the name of the method used to access the field value. If not found it will try ta add 'get' in frint of the name. Default : the field name
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
    75
    weight: <float> : the weight used for this field to calculate the score of each tag. default : 1.0 
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    76
112
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    77
* We can configure WikiTagBundle for it to works with any wikipedia and dbpedia. Just set up the language you want with the url templates. 
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    78
There is no default version so this configuration **has** to be set. Here is an example with german (de) endpoints :
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    79
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    80
        wiki_tag:
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    81
            [...]
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    82
            url_templates:
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    83
                wikipedia_api: 'http://de.wikipedia.org/w/api.php'
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    84
                wikipedia_permalink: 'http://de.wikipedia.org/w/index.php?oldid=%s'
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    85
                wikipedia_opensearch: 'http://de.wikipedia.org/w/index.php?search='
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    86
                dbpedia: 'http://de.dbpedia.org/resource/%s'
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    87
            
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    88
The 'document_id_column' option is used to indicate the primary key column used by the host app's document class. We are currently limited to non composite primary keys.
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    89
A field definition has the following format:
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    90
<field name>:
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    91
    type: <string or text> : field type. default : text 
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    92
    length: <int> : the length of the field. ignored if field type is text
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    93
    accessor: <field name or method name> : the field name in the host app's document class, or the name of the method used to access the field value. If not found it will try ta add 'get' in frint of the name. Default : the field name
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    94
    weight: <float> : the weight used for this field to calculate the score of each tag. default : 1.0 
14653baf4f6b first change for wikipedia and dbpedia lang configuration
cavaliet
parents: 110
diff changeset
    95
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    96
* Add the WikiTag routes to your routing.yml :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    97
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    98
        WikiTagBundle:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
    99
            resource: "@WikiTagBundle/Resources/config/routing.yml"
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   100
            prefix:   /tag
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   101
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   102
* Run the commands :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   103
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   104
        php app/console wikitag:generate-document-class (no need to explain)
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   105
        php app/console wikitag:schema:update (also replace and runs php app/console doctrine:schema:update)
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   106
        php app/console wikitag:sync-doc (fills the database with the datas from the host document class to the wikitag document class. this command is needed only if the database was not empty)
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   107
    
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   108
* Your database is ready. You can now include the table of tags in a template. Do not forget css and javascript (and php app/console assets:install). Example :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   109
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   110
        {# example of page extending the base template #}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   111
        {% extends 'CompanyBaseBundle:Default:index.html.twig' %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   112
        
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   113
        {% block css_import %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   114
        {{ parent() }}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   115
        {% render "WikiTagBundle:WikiTag:addCss" %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   116
        {% endblock %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   117
        
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   118
        {% block js_declaration %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   119
        {{ parent() }}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   120
        {% render "WikiTagBundle:WikiTag:addJavascript" %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   121
        {% endblock %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   122
        
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   123
        {% block content %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   124
        <!-- The beginning of your template -->
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   125
                {% render "WikiTagBundle:WikiTag:documentTags" with {'id_doc': doc.id} %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   126
        <!-- The end of your template -->
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   127
        {% endblock %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   128
  
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   129
* Great ! You can now add/remove/change semantised tags to your document ! The WikiTag template includes an autocomplete search field to add simply and fastly any wikipedia semantised tag.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   130
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   131
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   132
## The list of all tags 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   133
If you want to, you can add into a page the list of all tags. WikiTagBundle manages a list of all tags with the paginator PagerFanta. By default, it displays 50 tags per page.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   134
The template includes links to quick search via a list of tags's first letter. A search field is also included. It works with the star character (\*) as a delimiter for searching.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   135
For example "\*Peter" will return tags ending by Peter, "Peter\*" tags beginning by Peter, and "\*Peter\*" all tags including Peter. 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   136
The list can be sorted in ascending or descending label, number of documents or popularity (integer value).
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   137
WikiTagBundle manages pagination, search, and sort with url parameters. 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   138
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   139
Example : http://mysite.com/route\_to\_list?searched=Peter\*&num\_page=1&nb\_by\_page=50&sort=popd
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   140
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   141
Including the tag list template looks like :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   142
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   143
        {# example of template including the all tags list #}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   144
        {% extends 'CompanyBaseBundle:Default:index.html.twig' %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   145
        
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   146
        {% block css_import %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   147
        {{ parent() }}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   148
        {% render "WikiTagBundle:WikiTag:addCss" %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   149
        {% endblock %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   150
        
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   151
        {% block js_declaration %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   152
        {{ parent() }}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   153
        {% render "WikiTagBundle:WikiTag:addJavascript" with {'tags_list': true} %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   154
        {% endblock %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   155
        
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   156
        {% block content %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   157
        <!-- The beginning of your template -->
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   158
            {% render "WikiTagBundle:WikiTag:allTags" %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   159
        <!-- The end of your template -->
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   160
        {% endblock %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   161
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   162
*IMPORTANT* : This template needs a route to be defined in configuration file. Usually, this host site's route leads the a page/document concerned by the clicked tag. 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   163
This route is used by the list to create a link on the "nb of documents" column. config.yml looks like :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   164
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   165
        wiki_tag:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   166
            route_for_documents_by_tag: a_route_from_host_site
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   167
            document_class: Company\BaseBundle\Entity\Document
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   168
            ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   169
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   170
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   171
## More configuration 1 : tag list profile for a document
96
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   172
Via config.yml, you can configure how columns are displayed for a given user. It also concerns the button "sort tags" 
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   173
(this function orders tags depending of their presence in the text fields set in config.yml). 
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   174
Is it is very simple. For each profile, you define the display property and the column name. 
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   175
The 3 properties available are : 0 : never displayed and not available in the list, 1 : displayed by default and available in the list, 2 : hidden by default but available in the list 
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   176
(the user can display the column if he wants, by clicking in the list). If the column is not in the profile or if the visibility parameter is undefined, it is considered as 0.
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   177
The column ids are : sort\_tag, order, move\_up\_down, id, label, wikipedia\_link, wikipedia\_permalink, dbpedia\_link, category, remove\_wikipedia\_link, alias, remove\_tag\_from\_list, alternative\_label, alternative\_wikipedia\_url.
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   178
The following example make it understable :
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   179
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   180
        wiki_tag:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   181
            ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   182
            document_list_profile:
96
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   183
                all:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   184
                    sort_tag:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   185
                        visibility: 0
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   186
                    order:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   187
                        label:      'Pertinence'
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   188
                        visibility: 1
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   189
                    move_up_down:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   190
                        visibility: 1
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   191
                    ...
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   192
                    alternative_label:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   193
                        label:      'Label redirigé'
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   194
                        visibility: 2
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   195
                    alternative_wikipedia_url:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   196
                        label:      'Lien redirigé'
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   197
                        visibility: 1
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   198
                editor:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   199
                    order:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   200
                        label:      '#'
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   201
                        visibility: 1
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   202
                    move_up_down:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   203
                        visibility: 0
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   204
                    ...
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   205
                    alias:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   206
                        label:      'Alias'
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   207
                        visibility: 1
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   208
                    remove_tag_from_list:
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   209
                        label:      'Retirer le tag'
be6e1ae3965c update readme
cavaliet
parents: 93
diff changeset
   210
                        visibility: 2
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   211
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   212
In these values, "sort_tag" means the sort tag button. All the other values are the available columns in the tag table.
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   213
Once this configuration set, call the profile in your template. The profile has to be called in the javascript call AND in the html call. So your template will look like this :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   214
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   215
        ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   216
        {% render "WikiTagBundle:WikiTag:addJavascript" with {'profile_name': 'editor'} %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   217
        ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   218
        {% render "WikiTagBundle:WikiTag:documentTags" with {'id_doc': doc.id, 'profile_name': 'editor'} %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   219
        ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   220
108
a22fb91de231 enhance document_list_profile and update readme
cavaliet
parents: 96
diff changeset
   221
If document\_list\_profile in not defined, all columns and the sort tag button will be displayed.
a22fb91de231 enhance document_list_profile and update readme
cavaliet
parents: 96
diff changeset
   222
If no param is set in the controller call, all columns and the sort tag button will be displayed.
a22fb91de231 enhance document_list_profile and update readme
cavaliet
parents: 96
diff changeset
   223
a22fb91de231 enhance document_list_profile and update readme
cavaliet
parents: 96
diff changeset
   224
        {% render "WikiTagBundle:WikiTag:addJavascript" %}
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   225
110
2f45e6bafb95 update readme
cavaliet
parents: 108
diff changeset
   226
You can make the table read-only if you want. Informations and icons will be displayed but no action will be available (rename, reorder, remove...).
2f45e6bafb95 update readme
cavaliet
parents: 108
diff changeset
   227
2f45e6bafb95 update readme
cavaliet
parents: 108
diff changeset
   228
        {% render "WikiTagBundle:WikiTag:addJavascript" with {'profile_name': 'editor', 'read_only': true} %}
2f45e6bafb95 update readme
cavaliet
parents: 108
diff changeset
   229
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   230
## More configuration 2 : add context seach to any text part of your page
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   231
Via config.yml, you can configure a list of jquery selectors meant to let appear tag context search by selecting text. 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   232
Once some text selected, a little div appears and displays several wikipedia entries with the entry title and a snippet. The results are the same than in an opensearch page 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   233
(example with [découvrir](http://fr.wikipedia.org/w/index.php?search=d%C3%A9couvrir)). If you want this functionality, config.yml will look like this : 
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   234
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   235
        wiki_tag:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   236
            ...
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   237
            reactive_selectors:
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   238
                some_divs:  [ '.left_sheet', '#p_title .sheet_title', '#p_description' ]
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   239
                only_p:     [ '#p_title .sheet_title', '#p_description' ]
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   240
                whole_page: [ 'document' ]
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   241
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   242
If you want every text on your page to be reactive, the list has to be [ 'document' ].
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   243
In the templates, you have to call a specific javascript with the wanted parameter. Your javascript calls may look like this :
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   244
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   245
        {% block js_declaration %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   246
        {{ parent() }}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   247
        {% render "WikiTagBundle:WikiTag:addJavascript" with {'profile_name': 'editor'} %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   248
        {% render "WikiTagBundle:WikiTag:addJavascriptForContextSearch" with {'context_name': 'some_divs'} %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   249
        {% endblock %}
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   250
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   251
## More configuration 3 : ignore wikipedia errors
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   252
This option allows to ignore wikipedia errors instead of raising an exception. The error is logged with an ERROR level and the tag is added/updated but not semantized.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   253
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   254
        wiki_tag:
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   255
            ...    
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   256
            ignore_wikipedia_error: true
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   257
93
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   258
## More configuration 4 : curl parameters
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   259
This option enables to add any parameter to the curl requests, since the wikipedia request are made from the server. For example, it is useful when the server is behind a firewall.
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   260
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   261
        wiki_tag:
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   262
            ...    
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   263
            curl_options:
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   264
            	CURLOPT_HTTPPROXYTUNNEL:  'TRUE'
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   265
            	CURLOPT_PROXYAUTH: 'CURLAUTH_NTLM'
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   266
            	CURLOPT_USERAGENT: 'Mozilla/5.0 Gecko/20100101 Firefox/10.0.1'
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   267
            	CURLOPT_PROXY: 'my.proxy.url:1234'
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   268
            	CURLOPT_PROXYUSERPWD: 'MY-DOMAIN\user:password'
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   269
            	CURLOPT_PROXYTYPE: 'CURLPROXY_HTTP'
dff31c10f751 update readme with curl options
cavaliet
parents: 90
diff changeset
   270
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   271
## Services
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   272
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   273
### Document Service : wiki_tag.document - IRI\Bundle\WikiTagBundle\Services\DocumentService 
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   274
The document service gathers methods to manage tags on a given document. all these methods must be called after the host app's document(s) object has been created and flushed.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   275
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   276
* addTags : add a tag or a list pf tags to a document. For each new tag, wikipedia will be queried.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   277
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   278
* copyTags : copy the tags list from one document to the other.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   279
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   280
* reorderTags : reorder a document tags. 
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   281
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   282
* getTagsLabels : get the list of tag labels from one document.
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   283
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   284
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   285
### Search service : wiki_tag.search - IRI\Bundle\WikiTagBundle\Services\SearchService
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   286
The search service allows searching documents
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   287
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   288
* getTagCloud : returns a weighted list of tag labels. The weight of the label is the number of documents tagged with this label. The list is sorted by descending weights.  
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   289
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   290
* search : search documents.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   291
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   292
## Commands
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   293
This bundle provides a number of commans that helps in the tags management.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   294
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   295
### wikitag:schema:create
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   296
Command to create the database schema. Equivalent to the doctrine:schema:create command.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   297
It fully replaces the doctrine:schema:create and *must* be run instead of the doctrine:schema:create command. 
55
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   298
80a400379dd3 First version of README.md
cavaliet
parents:
diff changeset
   299
68
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   300
### wikitag:schema:update
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   301
Command to update the database schema. Equivalent to the doctrine:schema:update command.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   302
It fully replaces the doctrine:schema:update and *must* be run instead of the doctrine:schema:update command.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   303
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   304
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   305
### wikitag:create-fulltext-indexes
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   306
Generate the sql to create the full text index on the database. This command is not destined to be directly called.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   307
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   308
### wikitag:generate-document-class
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   309
Generate the WikiTagBundle document class. This command should not be directly called.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   310
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   311
### wikitag:purge-tags
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   312
Removes tags associated to no documents.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   313
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   314
### wikitag:query-wikipedia
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   315
Query wikipedia for informations on tags.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   316
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   317
### wikitag:reorder-tags
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   318
Automatically reorder documents tags. For each documents treated, each tag of the document is scored according to the fields definition in the bundle configuration. The sorting of the tags is done document by document according to these scores. 
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   319
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   320
### wikitag:sync-doc
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   321
Synchronize the wikiTag Bundle documents with the host bundle. This synchronization is made according to the fields defined in the bundle configuration.
e7384fb35f7a improve search test and documentation
ymh <ymh.work@gmail.com>
parents: 55
diff changeset
   322
87
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   323
### wikitag:load-fixtures
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   324
Allow loading of fixtures to populate the database.
89
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   325
87
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   326
The wikitag document table must exist and be synchronized. There fore the following commands must have been executed:
89
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   327
  
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   328
  +  php app/console wikitag:generate-document-class
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   329
  +  php app/console wikitag:sync-doc
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   330
87
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   331
The wikitag\_document.external\_id field must match the datasheet field fo the taggedsheet table.
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   332
This command import in order categories, tags and documents\_tags.
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   333
you may have memory problem. In this case you can import data by slices. Here is an example:
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   334
89
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   335
  +  all categories : php app/console wikitag:load-fixtures -C /path/to/data.json
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   336
  +  all tags : php app/console wikitag:load-fixtures -T /path/to/data.json
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   337
  +  20000 first doctags: php app/console wikitag:load-fixtures -D -E 20000 /path/to/data.json
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   338
  +  20000 other doctags: php app/console wikitag:load-fixtures -D -B 20001 -E 40000 /path/to/data.json
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   339
  +  last doctags: php app/console wikitag:load-fixtures -B 40001 /path/to/data.json
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   340
738cc74f9f7f improve documentation
ymh <ymh.work@gmail.com>
parents: 87
diff changeset
   341
The -B (index Begin) and -E (index End) works alson on the tags. Therefore you cans import tags also in slices.
87
499d7998d6ad update readme
ymh <ymh.work@gmail.com>
parents: 68
diff changeset
   342