Index: /trunk/admin.php
===================================================================
--- /trunk/admin.php	(revision 11038)
+++ /trunk/admin.php	(revision 11039)
@@ -44,17 +44,4 @@
 // | Direct actions                                                        |
 // +-----------------------------------------------------------------------+
-
-// tags
-if (isset($_GET['fckb_tags']))
-{
-  $query = '
-SELECT
-    id AS tag_id,
-    name AS tag_name
-  FROM '.TAGS_TABLE.'
-;';
-  echo json_encode(get_fckb_taglist($query));
-  exit();
-}
 
 // theme changer
Index: /trunk/admin/batch_manager.php
===================================================================
--- /trunk/admin/batch_manager.php	(revision 11038)
+++ /trunk/admin/batch_manager.php	(revision 11039)
@@ -362,4 +362,16 @@
 
 // +-----------------------------------------------------------------------+
+// |                              tags                                     |
+// +-----------------------------------------------------------------------+
+
+$query = '
+SELECT
+    id AS tag_id,
+    name AS tag_name
+  FROM '.TAGS_TABLE.'
+;';
+$template->assign('tags', get_taglist($query));
+
+// +-----------------------------------------------------------------------+
 // |                         open specific mode                            |
 // +-----------------------------------------------------------------------+
Index: /trunk/admin/batch_manager_global.php
===================================================================
--- /trunk/admin/batch_manager_global.php	(revision 11038)
+++ /trunk/admin/batch_manager_global.php	(revision 11039)
@@ -138,5 +138,5 @@
     else
     {
-      $tag_ids = get_fckb_tag_ids($_POST['add_tags']);
+      $tag_ids = get_tag_ids($_POST['add_tags']);
       add_tags($tag_ids, $collection);
 
Index: /trunk/admin/batch_manager_unit.php
===================================================================
--- /trunk/admin/batch_manager_unit.php	(revision 11038)
+++ /trunk/admin/batch_manager_unit.php	(revision 11039)
@@ -109,5 +109,5 @@
     if (isset($_POST[ 'tags-'.$row['id'] ]))
     {
-      $tag_ids = get_fckb_tag_ids($_POST[ 'tags-'.$row['id'] ]);
+      $tag_ids = get_tag_ids($_POST[ 'tags-'.$row['id'] ]);
       set_tags($tag_ids, $row['id']);
     }
@@ -257,5 +257,5 @@
   WHERE image_id = '.$row['id'].'
 ;';
-    $tag_selection = get_fckb_taglist($query);
+    $tag_selection = get_taglist($query);
 
     $template->append(
Index: /trunk/admin/include/functions.php
===================================================================
--- /trunk/admin/include/functions.php	(revision 11038)
+++ /trunk/admin/include/functions.php	(revision 11039)
@@ -2098,5 +2098,5 @@
 }
 
-function get_fckb_taglist($query)
+function get_taglist($query)
 {
   $result = pwg_query($query);
@@ -2120,5 +2120,5 @@
 }
 
-function get_fckb_tag_ids($raw_tags)
+function get_tag_ids($raw_tags)
 {
   // In $raw_tags we receive something like array('~~6~~', '~~59~~', 'New
Index: /trunk/admin/picture_modify.php
===================================================================
--- /trunk/admin/picture_modify.php	(revision 11038)
+++ /trunk/admin/picture_modify.php	(revision 11039)
@@ -167,5 +167,5 @@
   if (isset($_POST['tags']))
   {
-    $tag_ids = get_fckb_tag_ids($_POST['tags']);
+    $tag_ids = get_tag_ids($_POST['tags']);
   }
   set_tags($tag_ids, $_GET['image_id']);
@@ -234,5 +234,13 @@
   WHERE image_id = '.$_GET['image_id'].'
 ;';
-$tags = get_fckb_taglist($query);
+$tag_selection = get_taglist($query);
+
+$query = '
+SELECT
+    id AS tag_id,
+    name AS tag_name
+  FROM '.TAGS_TABLE.'
+;';
+$tags = get_taglist($query);
 
 // retrieving direct information about picture
@@ -268,4 +276,5 @@
 $template->assign(
   array(
+    'tag_selection' => $tag_selection,
     'tags' => $tags,
     'U_SYNC' => $admin_url_start.'&amp;sync_metadata=1',
Index: /trunk/admin/themes/default/template/batch_manager_global.tpl
===================================================================
--- /trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 11038)
+++ /trunk/admin/themes/default/template/batch_manager_global.tpl	(revision 11039)
@@ -10,24 +10,20 @@
 {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
 
-{footer_script require='jquery.tokeninput'}{literal}
-jQuery(document).ready(function() {
-  jQuery.getJSON('admin.php?fckb_tags=1', function(data) {
-    jQuery("#tags").tokenInput(
-      data,
-      {
-    {/literal}
-        hintText: '{'Type in a search term'|@translate}',
-        noResultsText: '{'No results'|@translate}',
-        searchingText: '{'Searching...'|@translate}',
-        newText: ' ({'new'|@translate})',
-        animateDropdown: false,
-        preventDuplicates: true,
-        allowCreation: true
-    {literal}
-      }
-    );
-  });
+{footer_script require='jquery.tokeninput'}
+jQuery(document).ready(function() {ldelim}
+  jQuery("#tags").tokenInput(
+    [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
+    {ldelim}
+      hintText: '{'Type in a search term'|@translate}',
+      noResultsText: '{'No results'|@translate}',
+      searchingText: '{'Searching...'|@translate}',
+      newText: ' ({'new'|@translate})',
+      animateDropdown: false,
+      preventDuplicates: true,
+      allowCreation: true
+    }
+  );
 });
-{/literal}{/footer_script}
+{/footer_script}
 
 {footer_script}
Index: /trunk/admin/themes/default/template/batch_manager_unit.tpl
===================================================================
--- /trunk/admin/themes/default/template/batch_manager_unit.tpl	(revision 11038)
+++ /trunk/admin/themes/default/template/batch_manager_unit.tpl	(revision 11039)
@@ -14,26 +14,22 @@
 	tag_boxes_selector = tag_boxes_selector + prefix + "#tags-" + {$element.ID};
 {/foreach}
-{literal}
-jQuery(document).ready(function() {
-  jQuery.getJSON('admin.php?fckb_tags=1', function(data) {
-    jQuery(tag_boxes_selector).tokenInput(
-      data,
-      {
-    {/literal}
-        hintText: '{'Type in a search term'|@translate}',
-        noResultsText: '{'No results'|@translate}',
-        searchingText: '{'Searching...'|@translate}',
-        newText: ' ({'new'|@translate})',
-        animateDropdown: false,
-        preventDuplicates: true,
-        allowCreation: true
-    {literal}
-      }
-    );
-  });
-  
-  $("a.preview-box").colorbox();
+
+jQuery(document).ready(function() {ldelim}
+  jQuery(tag_boxes_selector).tokenInput(
+    [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
+    {ldelim}
+      hintText: '{'Type in a search term'|@translate}',
+      noResultsText: '{'No results'|@translate}',
+      searchingText: '{'Searching...'|@translate}',
+      newText: ' ({'new'|@translate})',
+      animateDropdown: false,
+      preventDuplicates: true,
+      allowCreation: true
+    }
+  );
+
+  jQuery("a.preview-box").colorbox();
 });
-{/literal}{/footer_script}
+{/footer_script}
 
 <h2>{'Batch Manager'|@translate}</h2>
Index: /trunk/admin/themes/default/template/picture_modify.tpl
===================================================================
--- /trunk/admin/themes/default/template/picture_modify.tpl	(revision 11038)
+++ /trunk/admin/themes/default/template/picture_modify.tpl	(revision 11039)
@@ -4,24 +4,20 @@
 
 {combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
-{footer_script require='jquery.tokeninput'}{literal}
-jQuery(document).ready(function() {
-  jQuery.getJSON('admin.php?fckb_tags=1', function(data) {
-    jQuery("#tags").tokenInput(
-      data,
-      {
-    {/literal}
-        hintText: '{'Type in a search term'|@translate}',
-        noResultsText: '{'No results'|@translate}',
-        searchingText: '{'Searching...'|@translate}',
-        newText: ' ({'new'|@translate})',
-        animateDropdown: false,
-        preventDuplicates: true,
-        allowCreation: true
-    {literal}
-      }
-    );
-  });
+{footer_script require='jquery.tokeninput'}
+jQuery(document).ready(function() {ldelim}
+  jQuery("#tags").tokenInput(
+    [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
+    {ldelim}
+      hintText: '{'Type in a search term'|@translate}',
+      noResultsText: '{'No results'|@translate}',
+      searchingText: '{'Searching...'|@translate}',
+      newText: ' ({'new'|@translate})',
+      animateDropdown: false,
+      preventDuplicates: true,
+      allowCreation: true
+    }
+  );
 });
-{/literal}{/footer_script}
+{/footer_script}
 
 {footer_script}
@@ -143,5 +139,5 @@
         <td>
 <select id="tags" name="tags">
-{foreach from=$tags item=tag}
+{foreach from=$tag_selection item=tag}
   <option value="{$tag.id}" class="selected">{$tag.name}</option>
 {/foreach}
