Index: /extensions/user_tags/CHANGELOG
===================================================================
--- /extensions/user_tags/CHANGELOG	(revision 22061)
+++ /extensions/user_tags/CHANGELOG	(revision 22062)
@@ -1,2 +1,6 @@
+User Tags 0.8.0 - 2013-04-07
+================================
+* Admin can allow users to add only existing tags.
+
 User Tags 0.7.5 - 2013-02-23
 ================================
Index: /extensions/user_tags/MANIFEST
===================================================================
--- /extensions/user_tags/MANIFEST	(revision 22061)
+++ /extensions/user_tags/MANIFEST	(revision 22062)
@@ -22,4 +22,7 @@
 user_tags/language/en_UK/help/index.php
 user_tags/language/en_UK/help/readme.html
+user_tags/language/pt_PT/plugin.lang.php
+user_tags/language/pt_PT/description.txt
+user_tags/language/pt_PT/help/readme.html
 user_tags/language/de_DE/plugin.lang.php
 user_tags/language/de_DE/index.php
@@ -32,4 +35,7 @@
 user_tags/language/lv_LV/help/index.php
 user_tags/language/lv_LV/help/readme.html
+user_tags/language/ru_RU/plugin.lang.php
+user_tags/language/ru_RU/description.txt
+user_tags/language/ru_RU/help/readme.html
 user_tags/language/da_DK/plugin.lang.php
 user_tags/language/da_DK/description.txt
Index: /extensions/user_tags/admin.php
===================================================================
--- /extensions/user_tags/admin.php	(revision 22061)
+++ /extensions/user_tags/admin.php	(revision 22062)
@@ -41,4 +41,18 @@
     $save_config = true;
   }
+
+  Log::getInstance()->debug($_POST);
+  Log::getInstance()->debug($me);
+  if (!empty($_POST['existing_tags_only']) 
+      && $_POST['existing_tags_only']!=$me->getPermission('existing_tags_only')) {
+    Log::getInstance()->debug('à mettre à 1');
+    $me->setPermission('existing_tags_only', 1);
+    $save_config = true;
+  } elseif (!isset($_POST['existing_tags_only']) && $me->getPermission('existing_tags_only')!=0) {
+    Log::getInstance()->debug('à mettre à O');
+    $me->setPermission('existing_tags_only', 0);
+    $save_config = true;    
+  }
+  
   if (isset($_POST['permission_delete']) && isset($status_options[$_POST['permission_delete']]) 
       && $_POST['permission_delete']!=$me->getPermission('delete')) {
@@ -58,4 +72,5 @@
 $template->assign('T4U_PERMISSION_ADD', $me->getPermission('add'));
 $template->assign('T4U_PERMISSION_DELETE', $me->getPermission('delete'));
+$template->assign('T4U_EXISTING_TAG_ONLY', $me->getPermission('existing_tags_only'));
 $template->assign('STATUS_OPTIONS', $status_options);
 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
Index: /extensions/user_tags/include/t4u_content.class.php
===================================================================
--- /extensions/user_tags/include/t4u_content.class.php	(revision 22061)
+++ /extensions/user_tags/include/t4u_content.class.php	(revision 22062)
@@ -44,4 +44,9 @@
       $template->assign('T4U_REFERER', urlencode($picture['url']));
       $template->assign('T4U_PERMISSION_DELETE', $this->plugin_config->hasPermission('delete'));
+      if ($this->plugin_config->hasPermission('existing_tags_only')) {
+        $template->assign('T4U_ALLOW_CREATION', 'false');
+      } else {
+        $template->assign('T4U_ALLOW_CREATION', 'true');
+      }
       
       $related_tags = array();
Index: /extensions/user_tags/js/jquery.addtags.js
===================================================================
--- /extensions/user_tags/js/jquery.addtags.js	(revision 22061)
+++ /extensions/user_tags/js/jquery.addtags.js	(revision 22062)
@@ -1,1 +1,1 @@
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 $j=17.1j();(2($,1p){$.m=2(w,4){$(w).B(\'\');$(w).1u().R(4).1h(14).13(12)};$.11.m=2(4){7.E(2(){15 $.m(7,4)})};H 7})($j);$j(2(){3 6=[];$j(\'#I\').G(2(){$j(7).16(\'G\');$j(\'#5-c\').1a(\'19\').E(2(){6.z({t:$j(7).x(),u:$j(7).10()})});$j(7).B($j(\'#5-g-c\').1b());$j(\'#5-c\').S(U,{V:f.Y,W:f.X,Z:f.T,18:f.1x,1r:1q,1c:C,1o:C,k:k,l:l,n:n});$j(\'#5-g-c\').1s(2(e){3 8=\'1t=\'+$j(\'#5-1w-t\').x();8+=\'&D=\'+$j(\'#5-D\').x();8+=\'&c=\';3 o=6.v;A(3 i=0;i<o;i++){8+=6[i].t+\',\'}8=8.1v(0,8.v-1);$j.1n($j(7).J(\'1g\'),8,2(4,p){Q(4,p)},\'1f\');e.1e()})});3 n=2 n(F){H F.b};3 l=2 l(s){6.z(s);h()};3 k=2 k(s){3 o=6.v,r=[];A(3 i=0;i<o;i++){q(6[i].u!=s.u){r.z(6[i])}}6=r;h()};3 h=2 h(){$j(\'#5-g\').1k(\'5-d\').1l(\'d\')};3 Q=2 1i(4,p){3 a=\'\';$j(\'#5-g\').1d(\'5-d\').J(\'d\',\'d\');q(4.b.K){a=\'<9 y="N">\'+4.b.K+\'</9>\'}O q(4.b.M){a=\'<9 y="1m">\'+4.b.M+\'</9>\'}O{a=\'<9 y="N">\'+p+\'</9>\'}q(a!==\'\'){$j(\'#I\').R(\'<9 t="L-P"></9>\');$j(\'#L-P\').m(a)}}});',62,96,'||function|var|data|t4u|existing_tags|this|serialized_form|div|message|result|tags|disabled||vocab|update|onChange|||onDelete|onAdd|flashMessage|onResult|nbItems|textStatus|if||item|id|name|length|source|val|class|push|for|html|true|referer|each|results|click|return|Tags|attr|info|flash|error|infos|else|messages|formSuccess|append|tokenInput|searching_text|t4u_list_script|hintText|noResultsText|no_results|start_to_type|searchingText|text|fn|3000|fadeOut|500|new|unbind|jQuery|newText|option|children|show|preventDuplicates|addClass|preventDefault|json|action|fadeIn|formSucess|noConflict|removeClass|removeAttr|errors|post|allowCreation|undefined|false|animateDropdown|submit|image_id|hide|substring|image|new_text'.split('|'),0,{}))
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 $j=12.16();(2($,1c){$.n=2(y,4){$(y).H(\'\');$(y).17().A(4).W(Z).1d(15)};$.14.n=2(4){8.I(2(){13 $.n(8,4)})};E 8})($j);$j(2(){3 6=[];$j(\'#B\').D(2(){$j(8).18(\'D\');$j(\'#5-d\').1b(\'1a\').I(2(){6.x({l:$j(8).w(),v:$j(8).U()})});$j(8).H($j(\'#5-h-d\').R());$j(\'#5-d\').S(V,{10:m.Y,X:m.11,T:m.19,1h:m.1y,1s:1r,1q:1t,1x:1w,o:o,k:k,t:t});$j(\'#5-h-d\').1v(2(e){3 7=\'1u=\'+$j(\'#5-1p-l\').w();7+=\'&J=\'+$j(\'#5-J\').w();7+=\'&d=\';3 f=6.u;Q(3 i=0;i<f;i++){7+=6[i].l+\',\'}7=7.1i(0,7.u-1);$j.1g($j(8).O(\'1f\'),7,2(4,s){N(4,s)},\'1e\');e.1j()})});3 t=2 t(C){E C.c};3 k=2 k(g){6.x(g);q()};3 o=2 o(g){3 f=6.u,r=[];Q(3 i=0;i<f;i++){p(6[i].v!=g.v){r.x(6[i])}}6=r;q()};3 q=2 q(){$j(\'#5-h\').1l(\'5-b\').1o(\'b\')};3 N=2 1m(4,s){3 a=\'\';$j(\'#5-h\').1n(\'5-b\').O(\'b\',\'b\');p(4.c.P){a=\'<9 z="L">\'+4.c.P+\'</9>\'}K p(4.c.M){a=\'<9 z="1k">\'+4.c.M+\'</9>\'}K{a=\'<9 z="L">\'+s+\'</9>\'}p(a!==\'\'){$j(\'#B\').A(\'<9 l="F-G"></9>\');$j(\'#F-G\').n(a)}}});',62,97,'||function|var|data|t4u|existing_tags|serialized_form|this|div|message|disabled|result|tags||nbItems|item|update|||onAdd|id|vocab|flashMessage|onDelete|if|onChange||textStatus|onResult|length|name|val|push|source|class|append|Tags|results|click|return|flash|messages|html|each|referer|else|infos|error|formSuccess|attr|info|for|show|tokenInput|searchingText|text|t4u_list_script|fadeIn|noResultsText|start_to_type|500|hintText|no_results|jQuery|new|fn|3000|noConflict|hide|unbind|searching_text|option|children|undefined|fadeOut|json|action|post|newText|substring|preventDefault|errors|removeClass|formSucess|addClass|removeAttr|image|preventDuplicates|false|animateDropdown|true|image_id|submit|t4u_allow_creation|allowCreation|new_text'.split('|'),0,{}))
Index: /extensions/user_tags/language/en_UK/help/readme.html
===================================================================
--- /extensions/user_tags/language/en_UK/help/readme.html	(revision 22061)
+++ /extensions/user_tags/language/en_UK/help/readme.html	(revision 22062)
@@ -7,2 +7,3 @@
 <p>Permissions are attached to users status (guest, generic, normal user, administrator, webmaster). Users can do an action (add, delete) if they have status greater than configured one's.</p>
 <p>Users can delete tags they added before submiting form, even if you don't want users delete related tags.</p>
+<p>You can allow user to add only existing tags when you check the checkbox "only existing tags".</p>
Index: /extensions/user_tags/language/fr_FR/help/readme.html
===================================================================
--- /extensions/user_tags/language/fr_FR/help/readme.html	(revision 22061)
+++ /extensions/user_tags/language/fr_FR/help/readme.html	(revision 22062)
@@ -8,2 +8,3 @@
 <p>Par exemple, si on définit que seuls les utilisateurs ayant le statut visiteur pourront ajouter des tags, alors les utilisateurs ayant les statuts invité et générique ne pourront pas ajouter de tags.</p>
 <p>Le fait de restreindre les droits sur qui peut supprimer des tags n'agît que sur la suppression des tags déjà existants. Si l'utilisateur essaie d'ajouter de nouveaux tags, il pourra les supprimer avant de mettre à jour.</p>
+<p>Il est possible de restreindre l'ajout de tags aux tags existants en cochant la case appropriée.</p>
Index: /extensions/user_tags/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/user_tags/language/fr_FR/plugin.lang.php	(revision 22061)
+++ /extensions/user_tags/language/fr_FR/plugin.lang.php	(revision 22062)
@@ -26,4 +26,5 @@
 $lang['That plugin allow visitors to add tags to image.'] = 'Ce plugin permet aux visiteurs de votre galerie d\'ajouter des tags aux images.';
 $lang['Who can add tags?'] = 'Qui peut ajouter des tags ?';
+$lang['Only add existing tags'] = 'Ajouter seulement des tags existants';
 $lang['Who can delete related tags?'] = 'Qui peut supprimer les tags déjà liés à une image ?';
 $lang['You can choose which users (per status) can add and delete tags.'] = 'Vous pouvez définir quel type d\'utilisateur peut ajouter/supprimer des tags.';
Index: /extensions/user_tags/language/nb_NO/plugin.lang.php
===================================================================
--- /extensions/user_tags/language/nb_NO/plugin.lang.php	(revision 22061)
+++ /extensions/user_tags/language/nb_NO/plugin.lang.php	(revision 22062)
@@ -38,3 +38,2 @@
 $lang['You are not allowed to add tags'] = 'Du har ikke tillatelse til å legge til merknader';
 $lang['You are not allowed to delete tags'] = 'Du har ikke tillatelse til å slette merknader';
-?>
Index: /extensions/user_tags/language/pt_PT/plugin.lang.php
===================================================================
--- /extensions/user_tags/language/pt_PT/plugin.lang.php	(revision 22061)
+++ /extensions/user_tags/language/pt_PT/plugin.lang.php	(revision 22062)
@@ -1,13 +1,11 @@
 <?php
 // +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
+// | User Tags  - a plugin for Piwigo                                      |
 // +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2013 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// | Copyright(C) 2010-2013 Nicolas Roudaire        http://www.nikrou.net  |
 // +-----------------------------------------------------------------------+
 // | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
+// | it under the terms of the GNU General Public License version 2 as     |
+// | published by the Free Software Foundation                             |
 // |                                                                       |
 // | This program is distributed in the hope that it will be useful, but   |
@@ -18,7 +16,8 @@
 // | You should have received a copy of the GNU General Public License     |
 // | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
+// | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            |
+// | MA 02110-1301 USA.                                                    |
 // +-----------------------------------------------------------------------+
+
 $lang['Add permission updated'] = 'Adicionar permissão de atualização';
 $lang['Be careful, whatever the configuration value is, new tag can be deleted anyway'] = 'Tenha cuidado, qualquer que seja o valor de configurado,a nova etiqueta pode ser apagada.';
@@ -35,3 +34,2 @@
 $lang['You are not allowed to delete tags'] = 'Não lhe é permitido apagar etiquetas';
 $lang['You can choose which users (per status) can add and delete tags.'] = 'Pode escolher quais os utilizadores( por atatus) que podem adicionar e apagar etiquetas';
-?>
Index: /extensions/user_tags/language/ru_RU/plugin.lang.php
===================================================================
--- /extensions/user_tags/language/ru_RU/plugin.lang.php	(revision 22061)
+++ /extensions/user_tags/language/ru_RU/plugin.lang.php	(revision 22062)
@@ -1,13 +1,11 @@
 <?php
 // +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
+// | User Tags  - a plugin for Piwigo                                      |
 // +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2013 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// | Copyright(C) 2010-2013 Nicolas Roudaire        http://www.nikrou.net  |
 // +-----------------------------------------------------------------------+
 // | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
+// | it under the terms of the GNU General Public License version 2 as     |
+// | published by the Free Software Foundation                             |
 // |                                                                       |
 // | This program is distributed in the hope that it will be useful, but   |
@@ -18,7 +16,8 @@
 // | You should have received a copy of the GNU General Public License     |
 // | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
+// | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            |
+// | MA 02110-1301 USA.                                                    |
 // +-----------------------------------------------------------------------+
+
 $lang['Add permission updated'] = 'Разрешение на добавление обновлено';
 $lang['Be careful, whatever the configuration value is, new tag can be deleted anyway'] = 'Будьте внимательны, независимо от значений конфигурации новый тег может быть удален';
@@ -35,3 +34,2 @@
 $lang['Click to add tags'] = 'Кликните для добавления тега';
 $lang['Start to type'] = 'Начните ввод';
-?>
Index: /extensions/user_tags/language/templates/plugin.lang.php
===================================================================
--- /extensions/user_tags/language/templates/plugin.lang.php	(revision 22061)
+++ /extensions/user_tags/language/templates/plugin.lang.php	(revision 22062)
@@ -26,4 +26,5 @@
 $lang['That plugin allow visitors to add tags to image.'] = '';
 $lang['Who can add tags?'] = '';
+$lang['Only add existing tags'] = '';
 $lang['Who can delete related tags?'] = '';
 $lang['You can choose which users (per status) can add and delete tags.'] = '';
Index: /extensions/user_tags/main.inc.php
===================================================================
--- /extensions/user_tags/main.inc.php	(revision 22061)
+++ /extensions/user_tags/main.inc.php	(revision 22062)
@@ -22,5 +22,5 @@
 /*
 Plugin Name: User Tags
-Version: 0.7.5
+Version: 0.8.0
 Description: Allow visitors to add tag to images
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=441
Index: /extensions/user_tags/template/add_tags.tpl
===================================================================
--- /extensions/user_tags/template/add_tags.tpl	(revision 22061)
+++ /extensions/user_tags/template/add_tags.tpl	(revision 22062)
@@ -11,4 +11,5 @@
 vocab['searching_text'] = "{'Searching...'|@translate}",
 vocab['new_text'] = " ({'new'|@translate})";
+var t4u_allow_creation = {$T4U_ALLOW_CREATION};
 {/footer_script}
 
Index: /extensions/user_tags/template/admin.tpl
===================================================================
--- /extensions/user_tags/template/admin.tpl	(revision 22061)
+++ /extensions/user_tags/template/admin.tpl	(revision 22062)
@@ -20,4 +20,7 @@
     </select>
   </p>
+  <p class="field">  
+    <label><input type="checkbox" value="1" name="existing_tags_only" {if ($T4U_EXISTING_TAG_ONLY)}checked="checked"{/if}>{'Only add existing tags'|@translate}</label>
+  </p>
 </fieldset>
 <fieldset>
