aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2011-05-25 13:33:29 +0000
committermistic100 <mistic@piwigo.org>2011-05-25 13:33:29 +0000
commit5257aad873f71bb0125d8b576748c7bf1bf3163d (patch)
tree32c944f23b086d796bf88dd45c4aa6243671b7c4 /admin
parentd17ffa839faf5435751fcef153b445ed25b20d52 (diff)
bug:2278 fixed (merge r10970 r11008 r11039 from trunk) replace FCBKcomplete by TokenInput to avoid 3rd tag issue on autocomplete
git-svn-id: http://piwigo.org/svn/branches/2.2@11056 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin.php13
-rw-r--r--admin/batch_manager.php12
-rw-r--r--admin/batch_manager_global.php2
-rw-r--r--admin/batch_manager_unit.php4
-rw-r--r--admin/include/functions.php15
-rw-r--r--admin/picture_modify.php13
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl32
-rw-r--r--admin/themes/default/template/batch_manager_unit.tpl38
-rw-r--r--admin/themes/default/template/picture_modify.tpl34
-rw-r--r--admin/themes/default/theme.css62
-rw-r--r--admin/themes/roma/theme.css7
11 files changed, 116 insertions, 116 deletions
diff --git a/admin.php b/admin.php
index 9c6a6e5f1..43a0d37e0 100644
--- a/admin.php
+++ b/admin.php
@@ -44,19 +44,6 @@ check_status(ACCESS_ADMINISTRATOR);
// | 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
if (isset($_GET['change_theme']))
{
diff --git a/admin/batch_manager.php b/admin/batch_manager.php
index b333ca9ac..c1d3687d4 100644
--- a/admin/batch_manager.php
+++ b/admin/batch_manager.php
@@ -361,6 +361,18 @@ if (in_array($page['tab'], $tab_codes))
$tabsheet->assign();
// +-----------------------------------------------------------------------+
+// | tags |
+// +-----------------------------------------------------------------------+
+
+$query = '
+SELECT
+ id AS tag_id,
+ name AS tag_name
+ FROM '.TAGS_TABLE.'
+;';
+$template->assign('tags', get_taglist($query));
+
+// +-----------------------------------------------------------------------+
// | open specific mode |
// +-----------------------------------------------------------------------+
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index 11cafe02d..73d11be2d 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -123,7 +123,7 @@ DELETE
}
else
{
- $tag_ids = get_fckb_tag_ids($_POST['add_tags']);
+ $tag_ids = get_tag_ids($_POST['add_tags']);
add_tags($tag_ids, $collection);
if ('with no tag' == $page['prefilter'])
diff --git a/admin/batch_manager_unit.php b/admin/batch_manager_unit.php
index aa28b856e..b7ca074d7 100644
--- a/admin/batch_manager_unit.php
+++ b/admin/batch_manager_unit.php
@@ -108,7 +108,7 @@ SELECT id, date_creation
// tags management
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']);
}
}
@@ -256,7 +256,7 @@ SELECT
JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id
WHERE image_id = '.$row['id'].'
;';
- $tag_selection = get_fckb_taglist($query);
+ $tag_selection = get_taglist($query);
$template->append(
'elements',
diff --git a/admin/include/functions.php b/admin/include/functions.php
index f5afa9633..c929d2c55 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -2100,25 +2100,29 @@ function get_active_menu($menu_page)
return 0;
}
-function get_fckb_taglist($query)
+function get_taglist($query)
{
$result = pwg_query($query);
+
$taglist = array();
while ($row = pwg_db_fetch_assoc($result))
{
array_push(
$taglist,
array(
- 'key' => $row['tag_name'],
- 'value' => '~~'.$row['tag_id'].'~~',
+ 'name' => $row['tag_name'],
+ 'id' => '~~'.$row['tag_id'].'~~',
)
);
}
-
+
+ $cmp = create_function('$a,$b', 'return strcasecmp($a["name"], $b["name"]);');
+ usort($taglist, $cmp);
+
return $taglist;
}
-function get_fckb_tag_ids($raw_tags)
+function get_tag_ids($raw_tags)
{
// In $raw_tags we receive something like array('~~6~~', '~~59~~', 'New
// tag', 'Another new tag') The ~~34~~ means that it is an existing
@@ -2126,6 +2130,7 @@ function get_fckb_tag_ids($raw_tags)
// or "1234" (numeric characters only)
$tag_ids = array();
+ $raw_tags = explode(',',$raw_tags);
foreach ($raw_tags as $raw_tag)
{
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 333bf3e88..97bff6e5e 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -166,7 +166,7 @@ if (isset($_POST['submit']) and count($page['errors']) == 0)
$tag_ids = array();
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']);
@@ -233,7 +233,15 @@ SELECT
JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id
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
$query = '
@@ -267,6 +275,7 @@ $admin_url_start.= isset($_GET['cat_id']) ? '&amp;cat_id='.$_GET['cat_id'] : '';
$template->assign(
array(
+ 'tag_selection' => $tag_selection,
'tags' => $tags,
'U_SYNC' => $admin_url_start.'&amp;sync_metadata=1',
'U_DELETE' => $admin_url_start.'&amp;delete=1&amp;pwg_token='.get_pwg_token(),
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index cadd7ce13..b01a120a1 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -5,22 +5,24 @@
pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
{/literal}{/footer_script}
-{combine_script id='jquery.fcbkcomplete' load='footer' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
-
-{footer_script require='jquery.fcbkcomplete'}{literal}
-jQuery(document).ready(function() {
- jQuery("#tags").fcbkcomplete({
- json_url: "admin.php?fckb_tags=1",
- cache: false,
- filter_case: false,
- filter_hide: true,
- firstselected: true,
- filter_selected: true,
- maxitems: 100,
- newel: true
- });
+{combine_script id='jquery.tokeninput' load='footer' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
+
+{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}
var nb_thumbs_page = {$nb_thumbs_page};
diff --git a/admin/themes/default/template/batch_manager_unit.tpl b/admin/themes/default/template/batch_manager_unit.tpl
index 9a1dde834..66b8b6b17 100644
--- a/admin/themes/default/template/batch_manager_unit.tpl
+++ b/admin/themes/default/template/batch_manager_unit.tpl
@@ -2,8 +2,8 @@
{include file='include/datepicker.inc.tpl'}
{include file='include/colorbox.inc.tpl'}
-{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
-{footer_script require='jquery.fcbkcomplete'}
+{combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
+{footer_script require='jquery.tokeninput'}
var tag_boxes_selector = "";
{foreach from=$elements item=element name=element}
{if $smarty.foreach.element.first}
@@ -13,22 +13,24 @@ prefix = ", ";
{/if}
tag_boxes_selector = tag_boxes_selector + prefix + "#tags-" + {$element.ID};
{/foreach}
-{literal}
-jQuery(document).ready(function() {
- $(tag_boxes_selector).fcbkcomplete({
- json_url: "admin.php?fckb_tags=1",
- cache: false,
- filter_case: false,
- filter_hide: true,
- firstselected: true,
- filter_selected: true,
- maxitems: 100,
- newel: true
- });
-
- $("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>
@@ -112,7 +114,7 @@ jQuery(document).ready(function() {
<select id="tags-{$element.ID}" name="tags-{$element.ID}">
{foreach from=$element.TAGS item=tag}
- <option value="{$tag.value}" class="selected">{$tag.key}</option>
+ <option value="{$tag.id}" class="selected">{$tag.name}</option>
{/foreach}
</select>
diff --git a/admin/themes/default/template/picture_modify.tpl b/admin/themes/default/template/picture_modify.tpl
index a5244f240..8cc01c43a 100644
--- a/admin/themes/default/template/picture_modify.tpl
+++ b/admin/themes/default/template/picture_modify.tpl
@@ -2,21 +2,23 @@
{include file='include/dbselect.inc.tpl'}
{include file='include/datepicker.inc.tpl'}
-{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
-{footer_script require='jquery.fcbkcomplete'}{literal}
-jQuery(document).ready(function() {
- jQuery("#tags").fcbkcomplete({
- json_url: "admin.php?fckb_tags=1",
- cache: false,
- filter_case: false,
- filter_hide: true,
- firstselected: true,
- filter_selected: true,
- maxitems: 100,
- newel: true
- });
+{combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
+{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}
pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
@@ -136,8 +138,8 @@ pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#da
<td><strong>{'Tags'|@translate}</strong></td>
<td>
<select id="tags" name="tags">
-{foreach from=$tags item=tag}
- <option value="{$tag.value}" class="selected">{$tag.key}</option>
+{foreach from=$tag_selection item=tag}
+ <option value="{$tag.id}" class="selected">{$tag.name}</option>
{/foreach}
</select>
</td>
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index e3cab2eff..870844682 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -585,50 +585,6 @@ img.ui-datepicker-trigger {
margin:-3px 5px 2px 5px;
}
-/* jQuery FCBKcomplete */
-/* TextboxList sample CSS */
-ul.holder { margin: 0; border: 1px solid #999; overflow: hidden; height: auto !important; height: 1%; padding: 4px 5px 0; }
-*:first-child+html ul.holder { padding-bottom: 2px; } * html ul.holder { padding-bottom: 2px; } /* ie7 and below */
-ul.holder li { float: left; list-style-type: none; margin: 0 5px 4px 0; white-space:nowrap;}
-ul.holder li.bit-box, ul.holder li.bit-input input { font: 11px "Lucida Grande", "Verdana"; }
-ul.holder li.bit-box { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; border: 1px solid #CAD8F3; background: #DEE7F8; padding: 1px 5px 2px; }
-ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
-ul.holder li.bit-input input { width: auto; overflow:visible; margin: 0; border: 0px; outline: 0; padding: 3px 0px 2px; } /* no left/right padding here please */
-ul.holder li.bit-input input.smallinput { width: 20px; }
-
-/* Facebook demo CSS */
-#add { border: 1px solid #999; width: 550px; margin: 50px; padding: 20px 30px 10px; }
-form ol li { list-style-type: none; }
-form ol { font: 11px "Lucida Grande", "Verdana"; margin: 0; padding: 0; }
-form ol li.input-text { margin-bottom: 10px; list-style-type: none; padding-bottom: 10px; }
-form ol li.input-text label { font-weight: bold; cursor: pointer; display: block; font-size: 13px; margin-bottom: 10px; }
-form ol li.input-text input { width: 500px; padding: 5px 5px 6px; font: 11px "Lucida Grande", "Verdana"; border: 1px solid #999; }
-form ul.holder { width: 500px; }
-form ul { margin: 0 !important }
-ul.holder li.bit-box, #apple-list ul.holder li.bit-box { padding-right: 15px; position: relative; z-index:1000;}
-#apple-list ul.holder li.bit-input { margin: 0; }
-#apple-list ul.holder li.bit-input input.smallinput { width: 5px; }
-ul.holder li.bit-hover { background: #BBCEF1; border: 1px solid #6D95E0; }
-ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
-ul.holder li.bit-box a.closebutton { position: absolute; right: 4px; top: 5px; display: block; width: 7px; height: 7px; font-size: 1px; background: url(icon/fcbkcomplete_close.gif); }
-ul.holder li.bit-box a.closebutton:hover { background-position: 7px; }
-ul.holder li.bit-box-focus a.closebutton, ul.holder li.bit-box-focus a.closebutton:hover { background-position: bottom; }
-
-/* Autocompleter */
-
-.facebook-auto { display: none; position: absolute; width: 512px; background: #eee; }
-.facebook-auto .default { padding: 5px 7px; border: 1px solid #ccc; border-width: 0 1px 1px;font-family:"Lucida Grande","Verdana"; font-size:11px; }
-.facebook-auto ul { display: none; margin: 0; padding: 0; overflow: auto; position:absolute; z-index:9999}
-.facebook-auto ul li { padding: 5px 12px; z-index: 1000; cursor: pointer; margin: 0; list-style-type: none; border: 1px solid #ccc; border-width: 0 1px 1px; font: 11px "Lucida Grande", "Verdana"; background-color: #eee }
-.facebook-auto ul li em { font-weight: bold; font-style: normal; background: #ccc; }
-.facebook-auto ul li.auto-focus { background: #4173CC; color: #fff; }
-.facebook-auto ul li.auto-focus em { background: none; }
-.deleted { background-color:#4173CC !important; color:#ffffff !important;}
-.hidden { display:none;}
-
-#demo ul.holder li.bit-input input { padding: 2px 0 1px; border: 1px solid #999; }
-.ie6fix {height:1px;width:1px; position:absolute;top:0px;left:0px;z-index:1;}
-
/* Add photos, direct mode */
#uploadBoxes P {
margin:0;
@@ -1045,6 +1001,24 @@ LEGEND {
#batchManagerGlobal #applyFilterBlock {margin-top:20px;}
#batchManagerGlobal .useFilterCheckbox {display:none}
+
+/* TokenInput (with Facebook style) */
+ul.token-input-list {overflow: hidden; height: auto !important; height: 1%;width: 400px;border: 1px solid #8496ba;cursor: text;font-size: 12px;font-family: Verdana;min-height: 1px;z-index: 999;margin: 0;padding: 0;background-color: #fff;list-style-type: none;clear: left;}
+ul.token-input-list li input {border: 0;width: 100px;padding: 3px 8px;background-color: white;margin: 2px 0;-webkit-appearance: caret;}
+li.token-input-token {overflow: hidden; height: auto !important; height: 15px;margin: 3px;padding: 1px 3px;background-color: #eff2f7;color: #000;cursor: default;border: 1px solid #ccd5e4;font-size: 11px;border-radius: 5px;-moz-border-radius: 5px;-webkit-border-radius: 5px;float: left;white-space: nowrap;}
+li.token-input-token p {display: inline;padding: 0;margin: 0;}
+li.token-input-token span {color: #a6b3cf;margin-left: 5px;font-weight: bold;cursor: pointer;}
+li.token-input-selected-token {background-color: #5670a6;border: 1px solid #3b5998;color: #fff;}
+li.token-input-input-token {float: left;margin: 0;padding: 0;list-style-type: none;width:10px;}
+div.token-input-dropdown {position: absolute;width: 400px;background-color: #fff;overflow: hidden;border-left: 1px solid #ccc;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;cursor: default;font-size: 11px;font-family: Verdana;z-index: 1;}
+div.token-input-dropdown p {margin: 0;padding: 5px;font-weight: bold;color: #777;}
+div.token-input-dropdown ul {margin: 0;padding: 0;}
+div.token-input-dropdown ul li {background-color: #fff;padding: 3px;margin: 0;list-style-type: none;}
+div.token-input-dropdown ul li.token-input-dropdown-item {background-color: #fff;}
+div.token-input-dropdown ul li.token-input-dropdown-item2 {background-color: #fff;}
+div.token-input-dropdown ul li em {font-weight: bold;font-style: normal;}
+div.token-input-dropdown ul li.token-input-selected-dropdown-item {background-color: #3b5998;color: #fff;}
+
.warning {
background:url(icon/warning.png) no-repeat top left;
width: 130px;
diff --git a/admin/themes/roma/theme.css b/admin/themes/roma/theme.css
index 8830f5a12..3fb62a2df 100644
--- a/admin/themes/roma/theme.css
+++ b/admin/themes/roma/theme.css
@@ -245,3 +245,10 @@ display:block; height:85px; left:225px; position:relative; top:-42px; width:313p
#batchManagerGlobal .thumbSelected {background-color:#555 !important}
#batchManagerGlobal #selectedMessage {background-color:#555; color:#ddd;}
+/* TokenInput (with Facebook style for ROMA) */
+ul.token-input-list {border-color:#666;background-color:#444;}
+ul.token-input-list li input {background-color:#444;}
+li.token-input-token span {color:#878787;}
+div.token-input-dropdown {background-color:#eee;border-color:#666;}
+div.token-input-dropdown ul li {background-color:#eee;}
+div.token-input-dropdown ul li.token-input-selected-dropdown-item {background-color:#FF7800;}