tiki-admin_categories.tpl 19.3 KB
Newer Older
1
{* $Id$ *}
2
{title help="Categories" admpage="category"}{tr}Admin Categories{/tr}{/title}
3

4
<div class="t_navbar margin-bottom-md">
5 6
	{button href="tiki-browse_categories.php?parentId=$parentId" _type="link" _icon_name="view" _text="{tr}Browse Categories{/tr}" _title="{tr}Browse the category system{/tr}"}
	{button href="tiki-edit_categories.php" _type="link" _text="{tr}Organize Objects{/tr}" _icon_name="structure" _title="{tr}Organize Objects{/tr}"}
7
</div>
awcolley's avatar
awcolley committed
8

9 10
<div class="tree breadcrumb" id="top">
	<div class="treetitle">
11
		<a href="tiki-admin_categories.php?parentId=0" class="categpath">{tr}Top{/tr}</a>
12 13
		{if $parentId != 0}
		{foreach $path as $id=>$name}
14
			&nbsp;::&nbsp;
15 16
			<a class="categpath" href="tiki-admin_categories.php?parentId={$id}">{$name|escape}</a>
		{/foreach}
17
		({tr}ID:{/tr} {$parentId})
18
		{/if}
19
	</div>
20
</div>
21

22
{$tree}
awcolley's avatar
awcolley committed
23

24 25
{tabset}
	{tab name="{tr}Create/Edit category{/tr}"}
26
		{if $categId > 0}
27
			<h2>{tr}Edit this category:{/tr} <b>{$categoryName|escape}</b> </h2>
28
			{button href="tiki-admin_categories.php?parentId=$parentId#editcreate" _text="{tr}Create New{/tr}" _title="{tr}Create New{/tr}"}
29
		{else}
30
			<h2>{tr}Add new category{/tr}</h2>
31
		{/if}
32
		<form action="tiki-admin_categories.php" method="post" class="form-horizontal" role="form">
33
			<input type="hidden" name="categId" value="{$categId|escape}">
34
			<div class="form-group">
35
				<label class="col-sm-3 control-label" for="parentId">{tr}Parent{/tr}</label>
36 37 38
				<div class="col-sm-9">
					<select name="parentId" id="parentId" class="form-control">
						{if $tiki_p_admin_categories eq 'y'}<option value="0">{tr}Top{/tr}</option>{/if}
39 40 41
						{foreach $categories as $category}
							<option value="{$category.categId}" {if $category.categId eq $parentId}selected="selected"{/if}>{$category.categpath|escape}</option>
						{/foreach}
42
					</select>
43 44 45
				</div>
			</div>
			<div class="form-group">
46
				<label class="col-sm-3 control-label" for="name">{tr}Name{/tr}</label>
47 48 49
				<div class="col-sm-9">
					<input type="text" class="form-control" name="name" id="name" value="{$categoryName|escape}">
				</div>
50
			</div>
51 52 53
			<div class="form-group">
				<label class="col-sm-3 control-label" for="description">{tr}Description{/tr}</label>
				<div class="col-sm-9">
54
					<textarea rows="2" class="form-control" name="description" id="description" maxlength=500>{$description|escape}</textarea>
55 56
				</div>
			</div>
57
			{if $tiki_p_admin_categories == 'y'}
58
				<div class="form-group">
59 60 61 62 63 64 65
					<div class="col-sm-9 col-sm-offset-3">
						<div class="checkbox">
							<label>
								<input type="checkbox" name="parentPerms" {if empty($categId)}checked="checked"{/if}>
								{tr}Apply parent category permissions{/tr}
							</label>
						</div>
66 67
					</div>
				</div>
68
			{/if}
69
			<div class="form-group">
70 71 72
				<div class="col-sm-9 col-sm-offset-3">
					<input type="submit" class="btn btn-primary" name="save" value="{tr}Save{/tr}">
				</div>
73
			</div>
sept_7's avatar
sept_7 committed
74
		</form>
75
	{/tab}
76

77 78
	{if $categId <= 0}
		{tab name="{tr}Batch upload{/tr}"}
79
			<h2>{tr}Batch upload{/tr}</h2>
80
			<form action="tiki-admin_categories.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
81
				<div class="form-group">
82
					<label class="control-label col-sm-3">{tr}CSV File{/tr}</label>
83 84
					<div class="col-sm-9">
						<input type="file" class="form-control" name="csvlist">
85
						<div class="help-block">
86 87
							{tr}Sample file content{/tr}
<pre>{* can't indent <pre> tag contents *}
88 89 90 91 92
category,description,parent
vegetable,vegetable
potato,,vegetable
</pre>
						</div>
93 94 95 96 97 98 99 100
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-3 col-sm-offset-3">
						<input type="submit" class="btn btn-primary" name="import" value="{tr}Upload{/tr}">
					</div>
				</div>
			</form>
101 102
		{/tab}
	{/if}
103
	{if $parentId != 0}
104 105 106 107 108 109 110 111 112 113 114 115
		{tab name="{tr}Objects in category{/tr}"}
			<h2>{tr}Objects in category:{/tr} {$categ_name|escape}</h2>
			{if $objects}
				<form method="get" action="tiki-admin_categories.php">
					<label>{tr}Find:{/tr}<input type="text" name="find"></label>
					<input type="hidden" name="parentId" value="{$parentId|escape}">
					<input type="submit" class="btn btn-default btn-sm" value="{tr}Filter{/tr}" name="search">
					<input type="hidden" name="sort_mode" value="{$sort_mode|escape}">
					<input type="hidden" name="find_objects" value="{$find_objects|escape}">
				</form>
			{/if}
			<div class="table-responsive">
116
				<table class="table">
117 118 119
					<tr>
						<th>&nbsp;</th>
						<th>
120 121 122
							<a href="tiki-admin_categories.php?parentId={$parentId}&amp;offset={$offset}&amp;sort_mode={if $sort_mode eq 'name_desc'}name_asc{else}name_desc{/if}#objects">
								{tr}Name{/tr}
							</a>
123 124
						</th>
						<th>
125 126 127
							<a href="tiki-admin_categories.php?parentId={$parentId}&amp;offset={$offset}&amp;sort_mode={if $sort_mode eq 'type_desc'}type_asc{else}type_desc{/if}#objects">
								{tr}Type{/tr}
							</a>
128 129
						</th>
					</tr>
130

131 132 133
					{section name=ix loop=$objects}
						<tr>
							<td class="icon">
134 135 136
								<a href="tiki-admin_categories.php?parentId={$parentId}&amp;removeObject={$objects[ix].catObjectId}&amp;fromCateg={$parentId}" class="tips" title=":{tr}Remove from this category{/tr}">
									{icon name='remove'}
								</a>
137 138
							</td>
							<td class="text">
139 140 141
								<a href="{$objects[ix].href}" title="{$objects[ix].name}">
									{$objects[ix].name|truncate:80:"(...)":true|escape}
								</a>
142 143 144 145 146 147 148 149 150 151 152
							</td>
							<td class="text">{tr}{$objects[ix].type}{/tr}</td>
						</tr>
					{sectionelse}
						{norecords _colspan=3}
					{/section}
				</table>
			</div>

			{pagination_links cant=$cant_objects step=$prefs.maxRecords offset=$offset}{/pagination_links}
		{/tab}
153

154 155
		{tab name="{tr}Moving objects between categories{/tr}"}
			<h2>{tr}Moving objects between categories{/tr}</h2>
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
			<h4>{tr}Current category:{/tr} {$categ_name|escape}</h4><br>
			<form method="get" action="tiki-admin_categories.php" name="move" class="form-horizontal" role="form">
				<fieldset>
					<legend>{tr}Perform an action on all objects in the current category:{/tr}</legend>
					<input type="hidden" name="parentId" value="{$parentId|escape}">
					<div class="form-group">
						<label class="col-sm-4 control-label" for="unassign">
							{tr}Unassign{/tr}
						</label>
						<div class="col-sm-6 input-group">
							<input type="submit" class="btn btn-default btn-sm" name="unassign" value="{tr}OK{/tr}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label" for="toId">
							{tr}Move to selected category{/tr}
						</label>
						<div class="col-sm-6 input-group">
174
							<select name="toId" id="toId" class="form-control">
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
								{foreach $categories as $category}
									{if $category.name !== $categ_name}
										<option value="{$category.categId}" {if $category.categId eq $parentId}selected="selected"{/if}>
											{$category.categpath|escape}
										</option>
									{/if}
								{/foreach}
							</select>
							<span class="input-group-btn">
								<input type="submit" class="btn btn-default" name="move_to" value="{tr}OK{/tr}">
							</span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label" for="to">
							{tr}Copy to selected category{/tr}
						</label>
						<div class="col-sm-6 input-group">
							<select name="to" class="form-control">
								{foreach $categories as $category}
									{if $category.name !== $categ_name}
										<option value="{$category.categId}" {if $category.categId eq $parentId}selected="selected"{/if}>
											{$category.categpath|escape}
										</option>
									{/if}
								{/foreach}
							</select>
							<span class="input-group-btn">
								<input type="submit" class="btn btn-default" name="copy_from" value="{tr}OK{/tr}">
							</span>
						</div>
					</div>
				</fieldset>
208 209
			</form>
		{/tab}
210

211 212
		{tab name="{tr}Add objects to category{/tr}"}
			<h2>{tr}Add objects to category:{/tr} <b>{$categ_name|escape}</b></h2>
213
			{if $prefs.feature_search eq 'y' and $prefs.unified_add_to_categ_search eq 'y'}
214
				<form id="add_object_form" method="post" action="{service controller=category action=categorize}" class="form-horizontal" role="form">
215 216 217 218
					<label>Types of object
						<select id="add_object_type">
							<option value="">{tr}All{/tr}</option>
							{foreach $types as $type => $title}
219 220 221
								<option value="{$type|escape}">
									{$title|escape}
								</option>
222 223 224 225 226 227 228 229 230 231
							{/foreach}
						</select>
					</label>
					<label>
						{tr}Objects{/tr}
						<input type="text" id="add_object_selector" name="objects">
					</label>
					<div>
						<input type="hidden" name="categId" value="{$parentId|escape}">
						<input type="hidden" name="confirm" value="1">
232
						<input type="submit" class="btn btn-default btn-sm" value="{tr}Add{/tr}">
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
						<span id="add_object_message" style="display: none;"></span>
					</div>
				</form>
				{jq}
$("#add_object_form").unbind("submit").submit(function (e) {
	var form = this;
	$.ajax($(form).attr('action'), {
		type: 'POST',
		dataType: 'json',
		data: $(form).serialize(),
		success: function (data) {
			data = (data ? data : {});
			$("option:selected", "#add_object_selector ~ select").remove();
			var $table = $("input[name=sort_mode]").parents("form").next("table");
			oddeven = $("tr:last", $table).hasClass("odd") ? "even" : "odd";
			var $row = $("<tr />").addClass(oddeven);
			$row.append("<td class=\"icon\">" +
						"<a href=\"tiki-admin_categories.php?parentId=" + data.categId +
251
								"&amp;removeObject=" + data.objects[0].catObjectId + "&amp;fromCateg=" + data.categId + "\">"+
252
							'{{icon name="remove"}}'+
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
						"</a></td>" +
						"<td class=\"text\">"+
							"<a href=\"#\">" + data.objects[0].id + "</a></td>" +
						"<td class=\"text\">" + data.objects[0].type + "</a></td>");
			$table.append($row);
			$("#add_object_message")
				.text(tr("Categorized..."))
				.fadeIn("fast", function () {
					setTimeout(function() {$("#add_object_message").fadeOut("slow");}, 3000);
				});
		},
		error: function (jqxhr) {
			$(form).showError(jqxhr);
		}
	});
	return false;
});
$("#add_object_type").change(function () {
	$("#add_object_selector")
		.object_selector(
			{
				type: $("#add_object_type").val(),
				categories: "not " + $("input[name=categId]", "#add_object_form").val()
			},
			{{$prefs.maxRecords|escape}}
		);
}).change();
				{/jq}
			{else}{* feature_search=n (not unified search) *}

283 284 285 286 287 288 289 290 291 292 293 294
				<form method="get" action="tiki-admin_categories.php" class="form-horizontal" role="form">
					<div class="form-group">
						<label class="col-sm-3 control-label" for="find_objects">
							{tr}Find{/tr}
						</label>
						<div class="col-sm-6 input-group">
							<input type="text" name="find_objects" id="find_objects" class="form-control">
							<span class="input-group-btn">
								<input type="submit" class="btn btn-default" value="{tr}Filter{/tr}" name="search_objects">
							</span>
						</div>
					</div>
295 296 297 298 299 300 301 302
					<input type="hidden" name="parentId" value="{$parentId|escape}">
					<input type="hidden" name="sort_mode" value="{$sort_mode|escape}">
					<input type="hidden" name="offset" value="{$offset|escape}">
					<input type="hidden" name="find" value="{$find|escape}">
				</form>
				{pagination_links cant=$maximum step=$maxRecords offset=$offset}{/pagination_links}
				<form action="tiki-admin_categories.php" method="post" class="form-horizontal" role="form">
					<input type="hidden" name="parentId" value="{$parentId|escape}">
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
					<fieldset>
						{if $prefs.feature_wiki eq 'y' and $pages}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="pageName">
									{tr}Page{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="pageName[]" id="pageName" class="form-control" multiple="multiple" size="5">
										{section name=ix loop=$pages}
											<option value="{$pages[ix].pageName|escape}">
												{$pages[ix].pageName|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<div>
										<input type="submit" class="btn btn-default" name="addpage" value="{tr}Add{/tr}">
									</div>
								</div>
321
							</div>
322
						{/if}
323

324 325 326 327 328 329 330 331 332 333 334 335 336 337
						{if $prefs.feature_articles eq 'y' and $articles}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="articleId">
									{tr}Article{/tr}
								</label>
								<div class="col-lg-6 input-group">
									<select name="articleId" id="articleId" class="form-control">
										{section name=ix loop=$articles}
											<option value="{$articles[ix].articleId|escape}">
												{$articles[ix].title|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
338
										<input type="submit" class="btn btn-default" name="addarticle" value="{tr}Add{/tr}">
339 340
									</span>
								</div>
341
							</div>
342
						{/if}
343

344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
						{if $prefs.feature_blogs eq 'y' and $blogs}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="blogId">
									{tr}Blog{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="blogId" id="blogId" class="form-control">
										{section name=ix loop=$blogs}
											<option value="{$blogs[ix].blogId|escape}">
												{$blogs[ix].title|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="addblog" value="{tr}Add{/tr}">
									</span>
								</div>
361
							</div>
362
						{/if}
363

364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
						{if $prefs.feature_directory eq 'y'and $directories}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="directoryId">
									{tr}Directory{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="directoryId" id="directoryId" class="form-control">
										{section name=ix loop=$directories}
											<option value="{$directories[ix].categId|escape}">
												{$directories[ix].name|truncate:40:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="adddirectory" value="{tr}Add{/tr}">
									</span>
								</div>
381
							</div>
382
						{/if}
383

384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
						{if $prefs.feature_galleries eq 'y' and $galleries}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="galleryId">
									{tr}Image gallery{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="galleryId" id="galleryId" class="form-control">
										{section name=ix loop=$galleries}
											<option value="{$galleries[ix].galleryId|escape}">
												{$galleries[ix].name|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="addgallery" value="{tr}Add{/tr}">
									</span>
								</div>
401
							</div>
402
						{/if}
403

404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
						{if $prefs.feature_file_galleries eq 'y' and $file_galleries}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="file_galleryId">
									{tr}File gallery{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="file_galleryId" id="file_galleryId" class="form-control">
										{section name=ix loop=$file_galleries}
											<option value="{$file_galleries[ix].id|escape}">
												{$file_galleries[ix].name|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="addfilegallery" value="{tr}Add{/tr}">
									</span>
								</div>
421
							</div>
422
						{/if}
423

424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
						{if $prefs.feature_forums eq 'y' and $forums}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="forumId">
									{tr}Forum{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="forumId" id="forumId" class="form-control">
										{section name=ix loop=$forums}
											<option value="{$forums[ix].forumId|escape}">
												{$forums[ix].name|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="addforum" value="{tr}Add{/tr}">
									</span>
								</div>
441
							</div>
442
						{/if}
443

444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
						{if $prefs.feature_polls eq 'y' and $polls}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="pollId">
									{tr}Poll{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="pollId" id="pollId" class="form-control">
										{section name=ix loop=$polls}
											<option value="{$polls[ix].pollId|escape}">
												{$polls[ix].title|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="addpoll" value="{tr}Add{/tr}">
									</span>
								</div>
461
							</div>
462
						{/if}
463

464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
						{if $prefs.feature_faqs eq 'y' and $faqs}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="faqId">
									{tr}FAQ{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="faqId" id="faqId" class="form-control">
										{section name=ix loop=$faqs}
											<option value="{$faqs[ix].faqId|escape}">
												{$faqs[ix].title|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="addfaq" value="{tr}Add{/tr}">
									</span>
								</div>
481
							</div>
482
						{/if}
483

484 485 486 487 488 489 490 491 492 493 494 495 496 497
						{if $prefs.feature_trackers eq 'y' and $trackers}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="trackerId">
									{tr}Tracker{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="trackerId" id="trackerId" class="form-control">
										{section name=ix loop=$trackers}
											<option value="{$trackers[ix].trackerId|escape}">
												{$trackers[ix].name|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
498
										<input type="submit" class="btn btn-default" name="addtracker" value="{tr}Add{/tr}">
499 500
									</span>
								</div>
501
							</div>
502
						{/if}
503

504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
						{if $prefs.feature_quizzes eq 'y' and $quizzes}
							<div class="form-group">
								<label class="col-sm-3 control-label" for="quizId">
									{tr}Quiz{/tr}
								</label>
								<div class="col-sm-6 input-group">
									<select name="quizId" id="quizId" class="form-control">
										{section name=ix loop=$quizzes}
											<option value="{$quizzes[ix].quizId|escape}">
												{$quizzes[ix].name|truncate:80:"(...)":true|escape}
											</option>
										{/section}
									</select>
									<span class="input-group-btn">
										<input type="submit" class="btn btn-default" name="addquiz" value="{tr}Add{/tr}">
									</span>
								</div>
521
							</div>
522 523
						{/if}
					</fieldset>
524 525
				</form>
				{pagination_links cant=$maximum step=$maxRecords offset=$offset}{/pagination_links}
526
			{/if}
527 528 529
		{/tab}
	{/if}
{/tabset}