| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Categories 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 /** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 class categories_html { 21 22 /** 23 * Writes a list of the categories for a section 24 * @param array An array of category objects 25 * @param string The name of the category section 26 */ 27 function show( &$rows, $section, $section_name, &$pageNav, &$lists, $type ) { 28 global $my, $mosConfig_live_site; 29 30 mosCommonHTML::loadOverlib(); 31 ?> 32 <form action="index2.php" method="post" name="adminForm"> 33 <table class="adminheading"> 34 <tr> 35 <?php 36 if ( $section == 'content') { 37 ?> 38 <th class="categories"> 39 <?php echo T_('Category Manager'); ?> <small><small>[ <?php echo T_('Content: All'); ?> ]</small></small> 40 </th> 41 <td width="right"> 42 <?php echo $lists['sectionid'];?> 43 </td> 44 <?php 45 } else { 46 if ( is_numeric( $section ) ) { 47 $query = 'com_content§ionid=' . $section; 48 } else { 49 if ( $section == 'com_contact_details' ) { 50 $query = 'com_contact'; 51 } else { 52 $query = $section; 53 } 54 } 55 ?> 56 <th class="categories"> 57 <?php echo T_('Category Manager'); ?> <small><small>[ <?php echo $section_name;?> ]</small></small> 58 </th> 59 <?php 60 } 61 ?> 62 </tr> 63 </table> 64 65 <table class="adminlist"> 66 <tr> 67 <th width="10" align="left"> 68 # 69 </th> 70 <th width="20"> 71 <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $rows );?>);" /> 72 </th> 73 <th class="title"> 74 <?php echo T_('Category Name'); ?> 75 </th> 76 <th width="10%"> 77 <?php echo T_('Published'); ?> 78 </th> 79 <?php 80 if ( $section <> 'content') { 81 ?> 82 <th colspan="2" width="5%"> 83 <?php echo T_('Reorder'); ?> 84 </th> 85 <?php 86 } 87 ?> 88 <th width="2%"> 89 <?php echo T_('Order'); ?> 90 </th> 91 <th width="1%"> 92 <a href="javascript: saveorder( <?php echo count( $rows )-1; ?> )"><img src="images/filesave.png" border="0" width="16" height="16" alt="<?php echo T_('Save Order'); ?>" /></a> 93 </th> 94 <th width="10%"> 95 <?php echo T_('Access'); ?> 96 </th> 97 <?php 98 if ( $section == 'content') { 99 ?> 100 <th width="12%" align="left"> 101 <?php echo T_('Section'); ?> 102 </th> 103 <?php 104 } 105 ?> 106 <th width="5%" nowrap> 107 <?php echo T_('Category ID'); ?> 108 </th> 109 <?php 110 if ( $type == 'content') { 111 ?> 112 <th width="5%"> 113 # <?php echo T_('Active'); ?> 114 </th> 115 <th width="5%"> 116 # <?php echo T_('Trash'); ?> 117 </th> 118 <?php 119 } else { 120 ?> 121 <th width="20%"> 122 </th> 123 <?php 124 } 125 ?> 126 </tr> 127 <?php 128 $k = 0; 129 for ($i=0, $n=count( $rows ); $i < $n; $i++) { 130 $row = &$rows[$i]; 131 132 $row->sect_link = 'index2.php?option=com_sections&task=editA&hidemainmenu=1&id='. $row->section; 133 134 $link = 'index2.php?option=com_categories§ion='. $section .'&task=editA&hidemainmenu=1&id='. $row->id; 135 136 $access = mosCommonHTML::AccessProcessing( $row, $i ); 137 $checked = mosCommonHTML::CheckedOutProcessing( $row, $i ); 138 $published = mosCommonHTML::PublishedProcessing( $row, $i ); 139 ?> 140 <tr class="<?php echo "row$k"; ?>"> 141 <td> 142 <?php echo $pageNav->rowNumber( $i ); ?> 143 </td> 144 <td> 145 <?php echo $checked; ?> 146 </td> 147 <td> 148 <?php 149 if ( $row->checked_out_contact_category && ( $row->checked_out_contact_category != $my->id ) ) { 150 echo $row->name .' ( '. $row->title .' )'; 151 } else { 152 ?> 153 <a href="<?php echo $link; ?>"> 154 <?php echo $row->name .' ( '. $row->title .' )'; ?> 155 </a> 156 <?php 157 } 158 ?> 159 </td> 160 <td align="center"> 161 <?php echo $published;?> 162 </td> 163 <?php 164 if ( $section <> 'content' ) { 165 ?> 166 <td> 167 <?php echo $pageNav->orderUpIcon( $i ); ?> 168 </td> 169 <td> 170 <?php echo $pageNav->orderDownIcon( $i, $n ); ?> 171 </td> 172 <?php 173 } 174 ?> 175 <td align="center" colspan="2"> 176 <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align: center" /> 177 </td> 178 <td align="center"> 179 <?php echo $access;?> 180 </td> 181 <?php 182 if ( $section == 'content' ) { 183 ?> 184 <td align="left"> 185 <a href="<?php echo $row->sect_link; ?>" title="<?php echo T_('Edit Section'); ?>"> 186 <?php echo $row->section_name; ?> 187 </a> 188 </td> 189 <?php 190 } 191 ?> 192 <td align="center"> 193 <?php echo $row->id; ?> 194 </td> 195 <?php 196 if ( $type == 'content') { 197 ?> 198 <td align="center"> 199 <?php echo $row->active; ?> 200 </td> 201 <td align="center"> 202 <?php echo $row->trash; ?> 203 </td> 204 <?php 205 } else { 206 ?> 207 <td> 208 </td> 209 <?php 210 } 211 $k = 1 - $k; 212 ?> 213 </tr> 214 <?php 215 } 216 ?> 217 </table> 218 219 <?php echo $pageNav->getListFooter(); ?> 220 221 <input type="hidden" name="option" value="com_categories" /> 222 <input type="hidden" name="section" value="<?php echo $section;?>" /> 223 <input type="hidden" name="task" value="" /> 224 <input type="hidden" name="chosen" value="" /> 225 <input type="hidden" name="act" value="" /> 226 <input type="hidden" name="boxchecked" value="0" /> 227 <input type="hidden" name="type" value="<?php echo $type; ?>" /> 228 <input type="hidden" name="hidemainmenu" value="0" /> 229 </form> 230 <?php 231 } 232 233 /** 234 * Writes the edit form for new and existing categories 235 * @param mosCategory The category object 236 * @param string 237 * @param array 238 */ 239 function edit( &$row, &$lists, $redirect, $menus ) { 240 if ($row->image == "") { 241 $row->image = 'blank.png'; 242 } 243 244 if ( $redirect == 'content' ) { 245 $component = T_('Content'); 246 } else { 247 $component = ucfirst( substr( $redirect, 4 ) ); 248 if ( $redirect == 'com_contact_details' ) { 249 $component = T_('Contact'); 250 } 251 } 252 mosMakeHtmlSafe( $row, ENT_QUOTES, 'description' ); 253 ?> 254 <script type="text/javascript"> 255 function submitbutton(pressbutton, section) { 256 var form = document.adminForm; 257 if (pressbutton == 'cancel') { 258 submitform( pressbutton ); 259 return; 260 } 261 262 if ( pressbutton == 'menulink' ) { 263 if ( form.menuselect.value == "" ) { 264 alert( "<?php echo T_('Please select a Menu'); ?>" ); 265 return; 266 } else if ( form.link_type.value == "" ) { 267 alert( "<?php echo T_('Please select a menu type'); ?>" ); 268 return; 269 } else if ( form.link_name.value == "" ) { 270 alert( "<?php echo T_('Please enter a Name for this menu item'); ?>" ); 271 return; 272 } 273 } 274 275 if ( form.name.value == "" ) { 276 alert("<?php echo T_('Category must have a name'); ?>"); 277 } else { 278 <?php getEditorContents( 'editor1', 'description' ) ; ?> 279 submitform(pressbutton); 280 } 281 } 282 // show / hide publishing information 283 function displayParameterInfo() 284 { 285 286 if(document.getElementById('simpleediting').style.display == 'block') 287 { 288 document.getElementById('simpleediting').style.display = 'none'; 289 document.getElementById('show').style.display = 'block'; 290 document.getElementById('hide').style.display = 'none'; 291 document.adminForm.simple_editing.value ='on'; 292 } 293 else 294 { 295 document.getElementById('simpleediting').style.display = 'block'; 296 document.getElementById('show').style.display = 'none'; 297 document.getElementById('hide').style.display = 'block'; 298 document.adminForm.simple_editing.value ='off'; 299 } 300 301 } 302 </script> 303 <?php 304 if($_SESSION['simple_editing'] == 'on') 305 { 306 $simpleediting ='none'; 307 $simple = 'block'; 308 $advanced = 'none'; 309 } 310 else 311 { 312 313 $advanced = 'block'; 314 $simple = 'none'; 315 $simpleediting ='block'; 316 } 317 318 ?> 319 <form action="index2.php" method="post" name="adminForm"> 320 <input type ="hidden" name="simple_editing" value='' /> 321 <table class="adminheading"> 322 <tr> 323 <th class="categories"> 324 <?php echo T_('Category:'); ?> 325 <small> 326 <?php echo $row->id ? T_('Edit') : T_('New');?> 327 </small> 328 <small><small> 329 [ <?php echo $component; ?>: <?php echo $row->name; ?> ] 330 </small></small> 331 </th> 332 </tr> 333 </table> 334 <table width="100%"> 335 <tr> 336 <td valign="top" align="right"> 337 <div id = "show" style="display:<?php echo $simple;?>"> 338 <a href="javascript:displayParameterInfo();"><?php echo T_('Show Advanced Details'); ?></a> 339 </div> 340 <div id = "hide" style="display:<?php echo $advanced;?>"> 341 <a href="javascript:displayParameterInfo();"><?php echo T_('Hide Advanced Details'); ?></a> 342 </div> 343 </td> 344 </tr> 345 </table> 346 <table width="100%"> 347 <tr> 348 <td valign="top" > 349 <table class="adminform"> 350 <tr> 351 <th colspan="3"> 352 <?php echo T_('Category Details'); ?> 353 </th> 354 </tr> 355 <tr> 356 <td> 357 <?php echo T_('Category Title:'); ?> 358 </td> 359 <td colspan="2"> 360 <input class="text_area" type="text" name="title" value="<?php echo $row->title; ?>" size="50" maxlength="50" title="<?php echo T_('A short name to appear in menus'); ?>" /> 361 </td> 362 </tr> 363 <tr> 364 <td> 365 <?php echo T_('Category Name:'); ?> 366 </td> 367 <td colspan="2"> 368 <input class="text_area" type="text" name="name" value="<?php echo $row->name; ?>" size="50" maxlength="255" title="<?php echo T_('A long name to be displayed in headings'); ?>" /> 369 </td> 370 </tr> 371 <tr> 372 <td> 373 <?php echo T_('Section:'); ?> 374 </td> 375 <td colspan="2"> 376 <?php echo $lists['section']; ?> 377 </td> 378 </tr> 379 <tr> 380 <td> 381 <?php echo T_('Image:'); ?> 382 </td> 383 <td> 384 <?php echo $lists['image']; ?> 385 </td> 386 <td rowspan="4" width="50%"> 387 <script type="text/javascript"> 388 if (document.forms[0].image.options.value!=''){ 389 jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'image' ); 390 } else { 391 jsimg='../images/M_images/blank.png'; 392 } 393 document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo T_('Preview'); ?>" />'); 394 </script> 395 </td> 396 </tr> 397 <tr> 398 <td> 399 <?php echo T_('Image Position:'); ?> 400 </td> 401 <td> 402 <?php echo $lists['image_position']; ?> 403 </td> 404 </tr> 405 <tr> 406 <td> 407 <?php echo T_('Ordering:'); ?> 408 </td> 409 <td> 410 <?php echo $lists['ordering']; ?> 411 </td> 412 </tr> 413 <tr> 414 <td> 415 <?php echo T_('Access Level:'); ?> 416 </td> 417 <td> 418 <?php echo $lists['access']; ?> 419 </td> 420 </tr> 421 <tr> 422 <td> 423 <?php echo T_('Published:'); ?> 424 </td> 425 <td> 426 <?php echo $lists['published']; ?> 427 </td> 428 </tr> 429 <tr> 430 <td valign="top"> 431 <?php echo T_('Description:'); ?> 432 </td> 433 <td colspan="2"> 434 <?php 435 // parameters : areaname, content, hidden field, width, height, rows, cols 436 editorArea( 'editor1', $row->description , 'description', '100%;', '300', '60', '20' ) ; ?> 437 </td> 438 </tr> 439 </table> 440 </td> 441 <td valign="top" align="right"> 442 <div id="simpleediting" style="display:<?php echo $simpleediting;?>"> 443 <table cellspacing="0" cellpadding="0" border="0" width="100%" > 444 <tr> 445 <td width="40%"> 446 <?php 447 if ( $row->id > 0 ) { 448 ?> 449 <table class="adminform"> 450 <tr> 451 <th colspan="2"> 452 <?php echo T_('Link to Menu'); ?> 453 </th> 454 </tr> 455 <tr> 456 <td colspan="2"> 457 <?php echo T_('This will create a new menu item in the menu you select'); ?> 458 <br /><br /> 459 </td> 460 </tr> 461 <tr> 462 <td valign="top" width="100px"> 463 <?php echo T_('Select a Menu'); ?> 464 </td> 465 <td> 466 <?php echo $lists['menuselect']; ?> 467 </td> 468 </tr> 469 <tr> 470 <td valign="top" width="100px"> 471 <?php echo T_('Select Menu Type'); ?> 472 </td> 473 <td> 474 <?php echo $lists['link_type']; ?> 475 </td> 476 </tr> 477 <tr> 478 <td valign="top" width="100px"> 479 <?php echo T_('Menu Item Name'); ?> 480 </td> 481 <td> 482 <input type="text" name="link_name" class="inputbox" value="" size="25" /> 483 </td> 484 </tr> 485 <tr> 486 <td> 487 </td> 488 <td> 489 <input name="menu_link" type="button" class="button" value="<?php echo T_('Link to Menu'); ?>" onClick="submitbutton('menulink');" /> 490 </td> 491 </tr> 492 <tr> 493 <th colspan="2"> 494 <?php echo T_('Existing Menu Links'); ?> 495 </th> 496 </tr> 497 <?php 498 if ( $menus == NULL ) { 499 ?> 500 <tr> 501 <td colspan="2"> 502 <?php echo T_('None'); ?> 503 </td> 504 </tr> 505 <?php 506 } else { 507 mosCommonHTML::menuLinksSecCat( $menus ); 508 } 509 ?> 510 <tr> 511 <td colspan="2"> 512 </td> 513 </tr> 514 </table> 515 <?php 516 } else { 517 ?> 518 <table class="adminform" width="40%"> 519 <tr><th> </th></tr> 520 <tr><td><?php echo T_('Menu links available when saved'); ?></td></tr> 521 </table> 522 <?php 523 } 524 ?> 525 </td> 526 </tr> 527 </table> 528 </div> 529 </td> 530 </tr> 531 </table> 532 <input type="hidden" name="option" value="com_categories" /> 533 <input type="hidden" name="oldtitle" value="<?php echo $row->title ; ?>" /> 534 <input type="hidden" name="id" value="<?php echo $row->id; ?>" /> 535 <input type="hidden" name="sectionid" value="<?php echo $row->section; ?>" /> 536 <input type="hidden" name="task" value="" /> 537 <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" /> 538 <input type="hidden" name="hidemainmenu" value="0" /> 539 </form> 540 </td> 541 </tr> 542 </table> 543 <?php 544 } 545 546 547 /** 548 * Form to select Section to move Category to 549 */ 550 function moveCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ) { 551 ?> 552 <form action="index2.php" method="post" name="adminForm"> 553 <br /> 554 <table class="adminheading"> 555 <tr> 556 <th class="categories"> 557 <?php echo T_('Move Category'); ?> 558 </th> 559 </tr> 560 </table> 561 562 <br /> 563 <table class="adminform"> 564 <tr> 565 <td width="3%"></td> 566 <td align="left" valign="top" width="30%"> 567 <strong><?php echo T_('Move to Section:'); ?></strong> 568 <br /> 569 <?php echo $SectionList ?> 570 <br /><br /> 571 </td> 572 <td align="left" valign="top" width="20%"> 573 <strong><?php echo T_('Categories being moved:'); ?></strong> 574 <br /> 575 <?php 576 echo "<ol>"; 577 foreach ( $items as $item ) { 578 echo "<li>". $item->name ."</li>"; 579 } 580 echo "</ol>"; 581 ?> 582 </td> 583 <td valign="top" width="20%"> 584 <strong><?php echo T_('Content Items being moved:'); ?></strong> 585 <br /> 586 <?php 587 if ($contents) { 588 echo "<ol>"; 589 foreach ( $contents as $content ) { 590 echo "<li>". $content->title ."</li>"; 591 } 592 echo "</ol>"; 593 } else { 594 echo '<br />None'; 595 } 596 ?> 597 </td> 598 <td valign="top"> 599 <?php echo T_('This will move the Categories listed <br />and all the items within the category (also listed) <br />to the selected Section.'); ?> 600 </td>. 601 </tr> 602 </table> 603 <br /><br /> 604 605 <input type="hidden" name="option" value="<?php echo $option;?>" /> 606 <input type="hidden" name="section" value="<?php echo $sectionOld;?>" /> 607 <input type="hidden" name="boxchecked" value="1" /> 608 <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" /> 609 <input type="hidden" name="task" value="" /> 610 <?php 611 foreach ( $cid as $id ) { 612 echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />"; 613 } 614 ?> 615 </form> 616 <?php 617 } 618 619 620 /** 621 * Form to select Section to copy Category to 622 */ 623 function copyCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ) { 624 ?> 625 <form action="index2.php" method="post" name="adminForm"> 626 <br /> 627 <table class="adminheading"> 628 <tr> 629 <th class="categories"> 630 <?php echo T_('Copy Category'); ?> 631 </th> 632 </tr> 633 </table> 634 635 <br /> 636 <table class="adminform"> 637 <tr> 638 <td width="3%"></td> 639 <td align="left" valign="top" width="30%"> 640 <strong><?php echo T_('Copy to Section:'); ?></strong> 641 <br /> 642 <?php echo $SectionList ?> 643 <br /><br /> 644 </td> 645 <td align="left" valign="top" width="20%"> 646 <strong><?php echo T_('Categories being copied:'); ?></strong> 647 <br /> 648 <?php 649 echo "<ol>"; 650 foreach ( $items as $item ) { 651 echo "<li>". $item->name ."</li>"; 652 } 653 echo "</ol>"; 654 ?> 655 </td> 656 <td valign="top" width="20%"> 657 <strong><?php echo T_('Content Items being copied:'); ?></strong> 658 <br /> 659 <?php 660 echo "<ol>"; 661 foreach ( $contents as $content ) { 662 echo "<li>". $content->title ."</li>"; 663 echo "\n <input type=\"hidden\" name=\"item[]\" value=\"$content->id\" />"; 664 } 665 echo "</ol>"; 666 ?> 667 </td> 668 <td valign="top"><?php echo T_(' 669 This will copy the Categories listed 670 <br /> 671 and all the items within the category (also listed) 672 <br /> 673 to the selected Section.'); ?> 674 </td>. 675 </tr> 676 </table> 677 <br /><br /> 678 679 <input type="hidden" name="option" value="<?php echo $option;?>" /> 680 <input type="hidden" name="section" value="<?php echo $sectionOld;?>" /> 681 <input type="hidden" name="boxchecked" value="1" /> 682 <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" /> 683 <input type="hidden" name="task" value="" /> 684 <?php 685 foreach ( $cid as $id ) { 686 echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />"; 687 } 688 ?> 689 </form> 690 <?php 691 } 692 693 } 694 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |