aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default/template/tags.tpl
blob: a6aa736c1468d5f03da63cabbf64ac50e9900f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
{include file='include/tag_selection.inc.tpl'}

{footer_script}{literal}
jQuery(document).ready(function(){
  function displayDeletionWarnings() {
    jQuery(".warningDeletion").show();
    jQuery("input[name=destination_tag]:checked").parent("label").children(".warningDeletion").hide();
  }

  displayDeletionWarnings();

  jQuery("#mergeTags label").click(function() {
    displayDeletionWarnings();
  });

  jQuery("input[name=merge]").click(function() {
    if (jQuery("ul.tagSelection input[type=checkbox]:checked").length < 2) {
      alert("{/literal}{'Select at least two tags for merging'|@translate}{literal}");
      return false;
    }
  });
});
{/literal}{/footer_script}


<div class="titrePage">
  <h2>{'Manage tags'|@translate}</h2>
</div>

<form action="{$F_ACTION}" method="post">
  {if isset($EDIT_TAGS_LIST)}
  <fieldset>
    <legend>{'Edit tags'|@translate}</legend>
    <input type="hidden" name="edit_list" value="{$EDIT_TAGS_LIST}">
    <table class="table2">
      <tr class="throw">
        <th>{'Current name'|@translate}</th>
        <th>{'New name'|@translate}</th>
      </tr>
      {foreach from=$tags item=tag}
      <tr>
        <td>{$tag.NAME}</td>
        <td><input type="text" name="tag_name-{$tag.ID}" value="{$tag.NAME}" size="50"></td>
      </tr>
      {/foreach}
    </table>

    <p>
      <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
      <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}">
      <input class="submit" type="reset" value="{'Reset'|@translate}">
    </p>
  </fieldset>
  {/if}
  {if isset($DUPLIC_TAGS_LIST)}
  <fieldset>
    <legend>{'Edit tags'|@translate}</legend>
    <input type="hidden" name="edit_list" value="{$DUPLIC_TAGS_LIST}">
    <table class="table2">
      <tr class="throw">
        <th>{'Source tag'|@translate}</th>
        <th>{'Name of the duplicate'|@translate}</th>
      </tr>
      {foreach from=$tags item=tag}
      <tr>
        <td>{$tag.NAME}</td>
        <td><input type="text" name="tag_name-{$tag.ID}" value="{$tag.NAME}" size="50"></td>
      </tr>
      {/foreach}
    </table>

    <p>
      <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
      <input class="submit" type="submit" name="duplic_submit" value="{'Submit'|@translate}">
      <input class="submit" type="reset" value="{'Reset'|@translate}">
    </p>
  </fieldset>
  {/if}

  {if isset($MERGE_TAGS_LIST)}
  <input type="hidden" name="merge_list" value="{$MERGE_TAGS_LIST}">

  <fieldset id="mergeTags">
    <legend>{'Merge tags'|@translate}</legend>
    {'Select the destination tag'|@translate}<br><br>
    {foreach from=$tags item=tag name=tagloop}
    <label><input type="radio" name="destination_tag" value="{$tag.ID}"{if $smarty.foreach.tagloop.index == 0} checked="checked"{/if}> {$tag.NAME}<span class="warningDeletion"> {'(this tag will be deleted)'|@translate}</span></label><br>
    {/foreach}
    <br><input type="submit" name="confirm_merge" value="{'Confirm merge'|@translate}">
  </fieldset>
  {/if}

  <fieldset>
    <legend>{'Add a tag'|@translate}</legend>

    <label>
      {'New tag'|@translate}
      <input type="text" name="add_tag" size="50">
    </label>

    <p><input class="submit" type="submit" name="add" value="{'Submit'|@translate}"></p>
  </fieldset>

  <fieldset>
    <legend>{'Tag selection'|@translate}</legend>
{html_style}
.showInfo{ldelim}position:static; display:inline-block; text-indent:6px}
{/html_style}
{footer_script}{literal}
jQuery('.showInfo').tipTip({
    'delay' : 0,
    'fadeIn' : 200,
    'fadeOut' : 200,
    'maxWidth':'300px',
    'keepAlive':true,
    'activation':'click'
  });
{/literal}{/footer_script}
{if count($all_tags)}
<div><label><span class="icon-filter" style="visibility:hidden" id="filterIcon"></span>{'Search'|@translate}: <input id="searchInput" type="text" size="12"></label></div>
{footer_script}{literal}
$("#searchInput").on( "keydown", function() {
	var $this = $(this),
		timer = $this.data("timer");
	if (timer)
		clearTimeout(timer);

	$this.data("timer", setTimeout( function() {
		var val = $this.val();
		if (!val) {
			$(".tagSelection>li").show();
			$("#filterIcon").css("visibility","hidden");
		}
		else {
			$("#filterIcon").css("visibility","visible");
			var regex = new RegExp( val.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i" );
			$(".tagSelection>li").each( function(i, li) {
				var $li = $(li),
					text = $.trim( $("label", $li).text() );
				if (regex.test( text ))
					$li.show();
				else
					$li.hide();
			});
		}

	}, 300) );
});
{/literal}{/footer_script}
{/if}
<ul class="tagSelection">
{foreach from=$all_tags item=tag}
	<li>{capture name='showInfo'}<b>{$tag.name}</b> ({$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}) <br> <a href="{$tag.U_VIEW}">{'View in gallery'|@translate}</a> | <a href="{$tag.U_EDIT}">{'Manage photos'|@translate}</a>{if !empty($tag.alt_names)}<br>{$tag.alt_names}{/if}{/capture}
		<a class="showInfo" title="{$smarty.capture.showInfo|@htmlspecialchars}">i</a>
		<label>
			<input type="checkbox" name="tags[]" value="{$tag.id}"> {$tag.name}
		</label>
	</li>
{/foreach}
</ul>

		<p>
			<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
			<input type="submit" name="edit" value="{'Edit selected tags'|@translate}">
			<input type="submit" name="duplicate" value="{'Duplicate selected tags'|@translate}">
			<input type="submit" name="merge" value="{'Merge selected tags'|@translate}">
			<input type="submit" name="delete" value="{'Delete selected tags'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
		</p>
  </fieldset>

</form>