-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
admin.categories.html.php
552 lines (516 loc) · 15.8 KB
/
admin.categories.html.php
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
172
173
174
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
<?php
/**
* @version $Id$
* @package Joomla
* @subpackage Categories
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* @package Joomla
* @subpackage Categories
*/
class categories_html
{
/**
* Writes a list of the categories for a section
* @param array An array of category objects
* @param string The name of the category section
*/
function show( &$rows, $section, $section_name, &$page, &$lists, $type )
{
$limitstart = JRequest::getVar('limitstart', '0', '', 'int');
$user =& JFactory::getUser();
//Ordering allowed ?
$ordering = ($lists['order'] == 'c.ordering');
JCommonHTML::loadOverlib();
?>
<form action="index.php?option=com_categories&section=<?php echo $section; ?>" method="post" name="adminForm">
<table>
<tr>
<td align="left" width="100%">
<?php echo JText::_( 'Filter' ); ?>:
<input type="text" name="search" id="search" value="<?php echo $lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
<button onclick="getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
</td>
<td nowrap="nowrap">
<?php
if ( $section == 'com_content') {
echo $lists['sectionid'];
}
?>
<?php
echo $lists['state'];
?>
</td>
</tr>
</table>
<table class="adminlist">
<thead>
<tr>
<th width="10" align="left">
<?php echo JText::_( 'Num' ); ?>
</th>
<th width="20">
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows );?>);" />
</th>
<th class="title">
<?php JCommonHTML::tableOrdering( 'Category Name', 'c.name', $lists ); ?>
</th>
<th width="10%">
<?php JCommonHTML::tableOrdering( 'Published', 'c.published', $lists ); ?>
</th>
<th width="80" nowrap="nowrap">
<a href="javascript:tableOrdering('c.ordering','ASC');" title="<?php echo JText::_( 'Order by' ); ?> <?php echo JText::_( 'Order' ); ?>">
<?php echo JText::_( 'Order' );?>
</a>
</th>
<th width="1%">
<?php JCommonHTML::saveorderButton( $rows ); ?>
</th>
<th width="7%">
<?php JCommonHTML::tableOrdering( 'Access', 'groupname', $lists ); ?>
</th>
<th width="2%" nowrap="nowrap">
<?php JCommonHTML::tableOrdering( 'ID', 'c.id', $lists ); ?>
</th>
<?php
if ( $section == 'com_content') {
?>
<th width="20%" class="title">
<?php JCommonHTML::tableOrdering( 'Section', 'section_name', $lists ); ?>
</th>
<?php
}
?>
<?php
if ( $type == 'content') {
?>
<th width="5%">
<?php echo JText::_( 'Num Active' ); ?>
</th>
<th width="5%">
<?php echo JText::_( 'Num Trash' ); ?>
</th>
<?php
}
?>
</tr>
</thead>
<tfoot>
<td colspan="13">
<?php echo $page->getListFooter(); ?>
</td>
</tfoot>
<tbody>
<?php
$k = 0;
if( count( $rows ) ) {
for ($i=0, $n=count( $rows ); $i < $n; $i++) {
$row = &$rows[$i];
$row->sect_link = ampReplace( 'index.php?option=com_sections&task=edit&hidemainmenu=1&id='. $row->section );
$link = 'index.php?option=com_categories§ion='. $section .'&task=edit&hidemainmenu=1&cid[]='. $row->id;
$access = JCommonHTML::AccessProcessing( $row, $i );
$checked = JCommonHTML::CheckedOutProcessing( $row, $i );
$published = JCommonHTML::PublishedProcessing( $row, $i );
?>
<tr class="<?php echo "row$k"; ?>">
<td>
<?php echo $page->getRowOffset( $i ); ?>
</td>
<td>
<?php echo $checked; ?>
</td>
<td onmouseover="return overlib('<?php echo $row->title; ?>', CAPTION, '<?php echo JText::_( 'Title' ); ?>', BELOW, RIGHT);" onmouseout="return nd();">
<?php
if ( $row->checked_out_contact_category && ( $row->checked_out_contact_category != $user->get('id') ) ) {
echo $row->name;
} else {
?>
<a href="<?php echo ampReplace( $link ); ?>">
<?php echo $row->name; ?></a>
<?php
}
?>
</td>
<td align="center">
<?php echo $published;?>
</td>
<td class="order" colspan="2">
<span><?php echo $page->orderUpIcon( $i, ($row->section == @$rows[$i-1]->section), 'orderup', 'Move Up', $ordering ); ?></span>
<span><?php echo $page->orderDownIcon( $i, $n, ($row->section == @$rows[$i+1]->section), 'orderdown', 'Move Down', $ordering ); ?></span>
<?php $disabled = $ordering ? '' : '"disabled=disabled"'; ?>
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
</td>
<td align="center">
<?php echo $access;?>
</td>
<td align="center">
<?php echo $row->id; ?>
</td>
<?php
if ( $section == 'com_content' ) {
?>
<td>
<a href="<?php echo $row->sect_link; ?>" title="<?php echo JText::_( 'Edit Section' ); ?>">
<?php echo $row->section_name; ?>
</a>
</td>
<?php
}
?>
<?php
if ( $type == 'content') {
?>
<td align="center">
<?php echo $row->active; ?>
</td>
<td align="center">
<?php echo $row->trash; ?>
</td>
<?php
}
$k = 1 - $k;
?>
</tr>
<?php
}
} else {
if( $type == 'content') {
?>
<tr><td colspan="10"><?php echo JText::_('There are no Categories'); ?></td></tr>
<?php
} else {
?>
<tr><td colspan="8"><?php echo JText::_('There are no Categories'); ?></td></tr>
<?php
}
}
?>
</tbody>
</table>
<input type="hidden" name="option" value="com_categories" />
<input type="hidden" name="section" value="<?php echo $section;?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="chosen" value="" />
<input type="hidden" name="act" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="type" value="<?php echo $type; ?>" />
<input type="hidden" name="hidemainmenu" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />
</form>
<?php
}
/**
* Writes the edit form for new and existing categories
* @param JTableCategory The category object
* @param string
* @param array
*/
function edit( &$row, &$lists, $redirect )
{
$editor =& JFactory::getEditor();
if ($row->image == '') {
$row->image = 'blank.png';
}
if ( $redirect == 'content' ) {
$component = 'Content';
} else {
$component = ucfirst( substr( $redirect, 4 ) );
if ( $redirect == 'com_contact_details' ) {
$component = 'Contact';
}
}
jimport('joomla.filter.output');
JOutputFilter::objectHTMLSafe( $row, ENT_QUOTES, 'description' );
?>
<script language="javascript" type="text/javascript">
function submitbutton(pressbutton, section) {
var form = document.adminForm;
if (pressbutton == 'cancel') {
submitform( pressbutton );
return;
}
if ( pressbutton == 'menulink' ) {
if ( form.menuselect.value == "" ) {
alert( "<?php echo JText::_( 'Please select a Menu', true ); ?>" );
return;
} else if ( form.link_type.value == "" ) {
alert( "<?php echo JText::_( 'Please select a menu type', true ); ?>" );
return;
} else if ( form.link_name.value == "" ) {
alert( "<?php echo JText::_( 'Please enter a Name for this menu item', true ); ?>" );
return;
}
}
if ( form.name.value == "" ) {
alert("<?php echo JText::_( 'Category must have a name', true ); ?>");
} else {
<?php
echo $editor->save( 'description' ) ; ?>
submitform(pressbutton);
}
}
</script>
<form action="index.php" method="post" name="adminForm">
<div class="col60">
<fieldset class="adminform">
<legend><?php echo JText::_( 'Details' ); ?></legend>
<table class="admintable">
<tr>
<td class="key">
<label for="title" width="100">
<?php echo JText::_( 'Category Title' ); ?>:
</label>
</td>
<td colspan="2">
<input class="text_area" type="text" name="title" id="title" value="<?php echo $row->title; ?>" size="50" maxlength="50" title="<?php echo JText::_( 'A short name to appear in menus' ); ?>" />
</td>
</tr>
<tr>
<td class="key">
<label for="name">
<?php echo JText::_( 'Category Name' ); ?>:
</label>
</td>
<td colspan="2">
<input class="text_area" type="text" name="name" id="name" value="<?php echo $row->name; ?>" size="50" maxlength="255" title="<?php echo JText::_( 'A long name to be displayed in headings' ); ?>" />
</td>
</tr>
<tr>
<td width="120" class="key">
<?php echo JText::_( 'Published' ); ?>:
</td>
<td>
<?php echo $lists['published']; ?>
</td>
</tr>
<tr>
<td class="key">
<label for="section">
<?php echo JText::_( 'Section' ); ?>:
</label>
</td>
<td colspan="2">
<?php echo $lists['section']; ?>
</td>
</tr>
<tr>
<td class="key">
<label for="ordering">
<?php echo JText::_( 'Ordering' ); ?>:
</label>
</td>
<td colspan="2">
<?php echo $lists['ordering']; ?>
</td>
</tr>
<tr>
<td valign="top" class="key">
<label for="access">
<?php echo JText::_( 'Access Level' ); ?>:
</label>
</td>
<td>
<?php echo $lists['access']; ?>
</td>
</tr>
<tr>
<td class="key">
<label for="image">
<?php echo JText::_( 'Image' ); ?>:
</label>
</td>
<td>
<?php echo $lists['image']; ?>
</td>
</tr>
<tr>
<td class="key">
<label for="image_position">
<?php echo JText::_( 'Image Position' ); ?>:
</label>
</td>
<td>
<?php echo $lists['image_position']; ?>
</td>
</tr>
<tr>
<td> </td>
<td>
<script language="javascript" type="text/javascript">
if (document.forms[0].image.options.value!=''){
jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'image' );
} else {
jsimg='../images/M_images/blank.png';
}
document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview' ); ?>" />');
</script>
</td>
</tr>
</table>
</fieldset>
<fieldset class="adminform">
<legend><?php echo JText::_( 'Details' ); ?></legend>
<table class="admintable">
<tr>
<td valign="top" colspan="3">
<?php
// parameters : areaname, content, width, height, cols, rows
echo $editor->display( 'description', $row->description, '100%', '300', '60', '20' ) ;
?>
</td>
</tr>
</table>
</fieldset>
</div>
<div class="col40">
<fieldset class="adminform">
<legend><?php echo JText::_( 'Link to Menu' ); ?></legend>
</fieldset>
</div>
<div class="clr"></div>
<input type="hidden" name="option" value="com_categories" />
<input type="hidden" name="oldtitle" value="<?php echo $row->title ; ?>" />
<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
<input type="hidden" name="sectionid" value="<?php echo $row->section; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
<input type="hidden" name="hidemainmenu" value="0" />
</form>
<?php
}
/**
* Form to select Section to move Category to
*/
function moveCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ) {
?>
<form action="index.php" method="post" name="adminForm">
<br />
<table class="adminform">
<tr>
<td width="3%"></td>
<td valign="top" width="30%">
<strong><?php echo JText::_( 'Move to Section' ); ?>:</strong>
<br />
<?php echo $SectionList ?>
<br /><br />
</td>
<td valign="top" width="20%">
<strong><?php echo JText::_( 'Categories being moved' ); ?>:</strong>
<br />
<?php
echo "<ol>";
foreach ( $items as $item ) {
echo "<li>". $item->name ."</li>";
}
echo "</ol>";
?>
</td>
<td valign="top" width="20%">
<strong><?php echo JText::_( 'Articles being moved' ); ?>:</strong>
<br />
<?php
echo "<ol>";
foreach ( $contents as $content ) {
echo "<li>". $content->title ."</li>";
}
echo "</ol>";
?>
</td>
<td valign="top">
<?php echo JText::_( 'This will move the Categories listed' ); ?>
<br />
<?php echo JText::_( 'and all the items within the category (also listed)' ); ?>
<br />
<?php echo JText::_( 'to the selected Section' ); ?>.
</td>.
</tr>
</table>
<br /><br />
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="section" value="<?php echo $sectionOld;?>" />
<input type="hidden" name="boxchecked" value="1" />
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
<input type="hidden" name="task" value="" />
<?php
foreach ( $cid as $id ) {
echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />";
}
?>
</form>
<?php
}
/**
* Form to select Section to copy Category to
*/
function copyCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ) {
?>
<form action="index.php" method="post" name="adminForm">
<br />
<table class="adminform">
<tr>
<td width="3%"></td>
<td valign="top" width="30%">
<strong><?php echo JText::_( 'Copy to Section' ); ?>:</strong>
<br />
<?php echo $SectionList ?>
<br /><br />
</td>
<td valign="top" width="20%">
<strong><?php echo JText::_( 'Categories being copied' ); ?>:</strong>
<br />
<?php
echo "<ol>";
foreach ( $items as $item ) {
echo "<li>". $item->name ."</li>";
}
echo "</ol>";
?>
</td>
<td valign="top" width="20%">
<strong><?php echo JText::_( 'Articles being copied' ); ?>:</strong>
<br />
<?php
echo "<ol>";
foreach ( $contents as $content ) {
echo "<li>". $content->title ."</li>";
echo "\n <input type=\"hidden\" name=\"item[]\" value=\"$content->id\" />";
}
echo "</ol>";
?>
</td>
<td valign="top">
<?php echo JText::_( 'This will copy the Categories listed' ); ?>
<br />
<?php echo JText::_( 'and all the items within the category (also listed)' ); ?>
<br />
<?php echo JText::_( 'to the selected Section' ); ?>.
</td>.
</tr>
</table>
<br /><br />
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="section" value="<?php echo $sectionOld;?>" />
<input type="hidden" name="boxchecked" value="1" />
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
<input type="hidden" name="task" value="" />
<?php
foreach ( $cid as $id ) {
echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />";
}
?>
</form>
<?php
}
}
?>