| [ 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 Content 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 require_once( $GLOBALS['mosConfig_absolute_path'] . '/includes/HTML_toolbar.php' ); 21 22 /** 23 * Utility class for writing the HTML for content 24 */ 25 class HTML_content { 26 /** 27 * Draws a Content List 28 * Used by Content Category & Content Section 29 */ 30 function showContentList( $title, $items, $access, $id=0, $sectionid=NULL, $gid, $params, $pageNav=NULL, $other_categories, $lists ) { 31 global $Itemid, $mosConfig_live_site; 32 33 if ( $sectionid ) { 34 $id = $sectionid; 35 } 36 37 if ( strtolower(get_class( $title )) == 'mossection' ) { 38 $catid = 0; 39 } else { 40 $catid = $title->id; 41 } 42 43 if ( $params->get( 'page_title' ) ) { 44 ?> 45 <div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>"> 46 <?php echo $title->name; ?> 47 </div> 48 <?php 49 } 50 ?> 51 <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>"> 52 <tr> 53 <td width="60%" valign="top" class="contentdescription<?php echo $params->get( 'pageclass_sfx' ); ?>" colspan="2"> 54 <?php 55 if ( $params->get( 'description' ) || $params->get( 'description_image' ) ) { 56 if ( $title->image ) { 57 $link = $mosConfig_live_site .'/images/stories/'. $title->image; 58 ?> 59 <img src="<?php echo $link;?>" align="<?php echo $title->image_position;?>" hspace="6" alt="<?php echo $title->image;?>" /> 60 <?php 61 } 62 if ( $params->get( 'description' ) ) { 63 echo $title->description; 64 } 65 } 66 ?> 67 </td> 68 </tr> 69 <tr> 70 <td> 71 <?php 72 // Displays the Table of Items in Category View 73 if ( $items ) { 74 HTML_content::showTable( $params, $items, $gid, $catid, $id, $pageNav, $access, $sectionid, $lists ); 75 } else if ( $catid ) { 76 ?> 77 <br /> 78 <?php echo T_('This Category is currently empty'); ?> 79 <br /><br /> 80 <?php 81 } 82 ?> 83 </td> 84 </tr> 85 <tr> 86 <td colspan="2"> 87 <?php 88 // Displays listing of Categories 89 if (is_array($other_categories) AND (count($other_categories) > 1 OR count($items) < 1)) { 90 $paramtype = $params->get('type'); 91 if (($paramtype == 'category' AND $params->get('other_cat')) OR ($paramtype == 'section' AND $params->get('other_cat_section'))) { 92 HTML_content::showCategories( $params, $items, $gid, $other_categories, $catid, $id, $Itemid ); 93 } 94 } 95 ?> 96 </td> 97 </tr> 98 </table> 99 <?php 100 // displays back button 101 mosHTML::BackButton ( $params ); 102 } 103 104 105 /** 106 * Display links to categories 107 */ 108 function showCategories( &$params, &$items, $gid, &$other_categories, $catid, $id, $Itemid ) { 109 $menuhandler =& mosMenuHandler::getInstance(); 110 ?> 111 <ul> 112 <?php 113 foreach ( $other_categories as $row ) { 114 if ( $catid != $row->id ) { 115 if ( $row->access <= $gid ) { 116 $_Itemid = $menuhandler->getCategoryItemId($row->id); 117 $link = sefRelToAbs( 'index.php?option=com_content&task=category&sectionid='. $id .'&id='. $row->id .'&Itemid='. $_Itemid ); 118 ?> 119 <li> 120 <a href="<?php echo $link; ?>" class="category"> 121 <?php echo $row->name;?> 122 </a> 123 <?php 124 if ( $params->get( 'cat_items' ) ) { 125 ?> 126 <i>( <?php printf(Tn_('%d item','%d items', $row->numitems), $row->numitems)?> )</i> 127 <?php 128 } 129 // Writes Category Description 130 if ( $params->get( 'cat_description' ) && $row->description ) { 131 echo "<br />"; 132 echo $row->description; 133 } 134 ?> 135 </li> 136 <?php 137 } else { 138 ?> 139 <li> 140 <?php echo $row->name; ?> 141 <a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&task=register' ); ?>"> 142 ( <?php echo T_('Registered Users Only'); ?> ) 143 </a> 144 <?php 145 } 146 } 147 } 148 ?> 149 </ul> 150 <?php 151 } 152 153 154 /** 155 * Display Table of items 156 */ 157 function showTable( &$params, &$items, &$gid, $catid, $id, &$pageNav, &$access, &$sectionid, &$lists ) { 158 global $mosConfig_live_site, $Itemid; 159 $link = 'index.php?option=com_content&task=category&sectionid='. $sectionid .'&id='. $catid .'&Itemid='. $Itemid; 160 ?> 161 <form action="<?php echo sefRelToAbs($link); ?>" method="post" name="adminForm"> 162 <table width="100%" border="0" cellspacing="0" cellpadding="0"> 163 <?php 164 if ( $params->get( 'filter' ) | $params->get( 'order_select' ) | $params->get( 'display' ) ) { 165 ?> 166 <tr> 167 <td colspan="4"> 168 <table> 169 <tr> 170 <?php 171 if ( $params->get( 'filter' ) ) { 172 ?> 173 <td align="right" width="100%" nowrap="nowrap"> 174 <?php 175 echo T_('Filter') .' '; 176 ?> 177 <input type="text" name="filter" value="<?php echo $lists['filter'];?>" class="inputbox" onchange="document.adminForm.submit();" /> 178 </td> 179 <?php 180 } 181 182 if ( $params->get( 'order_select' ) ) { 183 ?> 184 <td align="right" width="100%" nowrap="nowrap"> 185 <?php 186 echo ' '. T_('Order') .' '; 187 echo $lists['order']; 188 ?> 189 </td> 190 <?php 191 } 192 193 if ( $params->get( 'display' ) ) { 194 ?> 195 <td align="right" width="100%" nowrap="nowrap"> 196 <?php 197 echo ' '. T_('Display #') .' '; 198 $link = 'index.php?option=com_content&task=category&sectionid='. $sectionid .'&id='. $catid .'&Itemid='. $Itemid; 199 echo $pageNav->getLimitBox( $link ); 200 ?> 201 </td> 202 <?php 203 } 204 ?> 205 </tr> 206 </table> 207 </td> 208 </tr> 209 <?php 210 } 211 if ( $params->get( 'headings' ) ) { 212 ?> 213 <tr> 214 <?php 215 if ( $params->get( 'date' ) ) { 216 ?> 217 <td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" width="35%"> 218 <?php echo T_('Date'); ?> 219 </td> 220 <?php 221 } 222 if ( $params->get( 'title' ) ) { 223 ?> 224 <td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" width="45%"> 225 <?php echo T_('Item Title'); ?> 226 </td> 227 <?php 228 } 229 if ( $params->get( 'author' ) ) { 230 ?> 231 <td class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" align="left" width="25%"> 232 <?php echo T_('Author'); ?> 233 </td> 234 <?php 235 } 236 if ( $params->get( 'hits' ) ) { 237 ?> 238 <td align="center" class="sectiontableheader<?php echo $params->get( 'pageclass_sfx' ); ?>" width="5%"> 239 <?php echo T_('Hits'); ?> 240 </td> 241 <?php 242 } 243 ?> 244 </tr> 245 <?php 246 } 247 248 $k = 0; 249 foreach ( $items as $row ) { 250 $row->created = mosFormatDate ($row->created, $params->get( 'date_format' )); 251 ?> 252 <tr class="sectiontableentry<?php echo ($k+1) . $params->get( 'pageclass_sfx' ); ?>" > 253 <?php 254 if ( $params->get( 'date' ) ) { 255 ?> 256 <td> 257 <?php echo $row->created; ?> 258 </td> 259 <?php 260 } 261 if ( $params->get( 'title' ) ) { 262 if( $row->access <= $gid ){ 263 $link = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id .'&Itemid='. $Itemid ); 264 ?> 265 <td> 266 <a href="<?php echo $link; ?>"><?php echo $row->title; ?></a> 267 <?php 268 HTML_content::EditIcon( $row, $params, $access ); 269 ?> 270 </td> 271 <?php 272 } else { 273 ?> 274 <td> 275 <?php 276 echo $row->title .' : '; 277 $link = sefRelToAbs( 'index.php?option=com_registration&task=register' ); 278 ?> 279 <a href="<?php echo $link; ?>"><?php echo T_('Register to read more...'); ?></a> 280 </td> 281 <?php 282 } 283 } 284 if ( $params->get( 'author' ) ) { 285 ?> 286 <td align="left"> 287 <?php echo $row->created_by_alias ? $row->created_by_alias : $row->author; ?> 288 </td> 289 <?php 290 } 291 if ( $params->get( 'hits' ) ) { 292 ?> 293 <td align="center"> 294 <?php echo $row->hits ? $row->hits : '-'; ?> 295 </td> 296 <?php 297 } ?> 298 </tr> 299 <?php 300 $k = 1 - $k; 301 } 302 if ( $params->get( 'navigation' ) ) { 303 ?> 304 <tr> 305 <td colspan="4"> </td> 306 </tr> 307 <tr> 308 <td align="center" colspan="4" class="sectiontablefooter<?php echo $params->get( 'pageclass_sfx' ); ?>"> 309 <?php 310 $link = 'index.php?option=com_content&task=category&sectionid='. $sectionid .'&id='. $catid .'&Itemid='. $Itemid; 311 echo $pageNav->writePagesLinks( $link ); 312 ?> 313 </td> 314 </tr> 315 <tr> 316 <td colspan="4" align="right"> 317 <?php echo $pageNav->writePagesCounter(); ?> 318 </td> 319 </tr> 320 <?php 321 } 322 ?> 323 <?php 324 if ( $access->canEdit || $access->canEditOwn ) { 325 $link = sefRelToAbs( 'index.php?option=com_content&task=new&sectionid='. $id .'&cid='. $row->id .'&Itemid='. $Itemid ); 326 ?> 327 <tr> 328 <td colspan="4"> 329 <a href="<?php echo $link; ?>"> 330 <img src="<?php echo $mosConfig_live_site;?>/images/M_images/new.png" width="13" height="14" align="middle" border="0" alt="<?php echo T_('New');?>" /> 331 <?php echo T_('New');?> 332 </a> 333 </td> 334 </tr> 335 <?php 336 } 337 ?> 338 </table> 339 <input type="hidden" name="id" value="<?php echo $catid; ?>" /> 340 <input type="hidden" name="sectionid" value="<?php echo $sectionid; ?>" /> 341 <input type="hidden" name="task" value="<?php echo $lists['task']; ?>" /> 342 <input type="hidden" name="option" value="com_content" /> 343 </form> 344 <?php 345 } 346 347 348 /** 349 * Display links to content items 350 */ 351 function showLinks( &$rows, $links, $total, $i=0, $show=1 ) { 352 global $mainframe; 353 354 if ( $show ) { 355 ?> 356 <div> 357 <strong> 358 <?php echo T_('More...'); ?> 359 </strong> 360 </div> 361 <ul> 362 <?php 363 } 364 for ( $z = 0; $z < $links; $z++ ) { 365 if ( $i >= $total ) { 366 // stops loop if total number of items is less than the number set to display as intro + leading 367 break; 368 } 369 // needed to reduce queries used by getItemid 370 $_Itemid = $mainframe->getItemid( $rows[$i]->id); 371 $link = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $rows[$i]->id .'&Itemid='. $_Itemid ) 372 ?> 373 <li> 374 <a class="blogsection" href="<?php echo $link; ?>"> 375 <?php echo $rows[$i]->title; ?> 376 </a> 377 </li> 378 <?php 379 $i++; 380 } 381 ?> 382 </ul> 383 <?php 384 } 385 386 387 /** 388 * Show a content item 389 * @param object An object with the record data 390 * @param boolean If <code>false</code>, the print button links to a popup window. If <code>true</code> then the print button invokes the browser print method. 391 */ 392 function show( $row, $params, $access, $page=0, $option, $ItemidCount=NULL ) { 393 global $mainframe, $my, $hide_js; 394 global $mosConfig_sitename, $Itemid, $mosConfig_live_site, $task; 395 global $_MAMBOTS; 396 397 if (!$ItemidCount) { 398 $mainframe->appendMetaTag( 'description', $row->metadesc ); 399 $mainframe->appendMetaTag( 'keywords', $row->metakey ); 400 } 401 402 $gid = $my->gid; 403 $_Itemid = $Itemid; 404 $link_on = ''; 405 $link_text = ''; 406 407 // process the new bots 408 $_MAMBOTS->loadBotGroup( 'content' ); 409 $results = $_MAMBOTS->trigger( 'onPrepareContent', array( &$row, &$params, $page ), true ); 410 411 // adds mospagebreak heading or title to <site> Title 412 if ( @$row->page_title ) { 413 $mainframe->SetPageTitle( $row->title .': '. $row->page_title ); 414 } 415 416 // determines the link and link text of the readmore button 417 if ( $params->get( 'intro_only' ) ) { 418 // checks if the item is a public or registered/special item 419 if ( $row->access <= $gid ) { 420 $_Itemid = $mainframe->getItemid( $row->id); 421 $link_on = sefRelToAbs("index.php?option=com_content&task=view&id=".$row->id."&Itemid=".$_Itemid); 422 if ( strlen( trim( $row->fulltext ) )) { 423 $link_text = T_('Read more...'); 424 } 425 } else { 426 $link_on = sefRelToAbs("index.php?option=com_registration&task=register"); 427 if (strlen( trim( $row->fulltext ) )) { 428 $link_text = T_('Register to read more...'); 429 } 430 } 431 } 432 433 $no_html = mosGetParam( $_REQUEST, 'no_html', null); 434 435 // for pop-up page 436 if ( $params->get( 'popup' ) && $no_html == 0) { 437 ?> 438 <title> 439 <?php echo $mosConfig_sitename .' :: '. $row->title; ?> 440 </title> 441 <?php 442 } 443 444 // determines links to next and prev content items within category 445 if ( $params->get( 'item_navigation' ) ) { 446 if ( $row->prev ) { 447 $row->prev = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->prev .'&Itemid='. $_Itemid ); 448 } else { 449 $row->prev = 0; 450 } 451 if ( $row->next ) { 452 $row->next = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->next .'&Itemid='. $_Itemid ); 453 } else { 454 $row->next = 0; 455 } 456 } 457 458 if ( $params->get( 'item_title' ) || $params->get( 'pdf' ) || $params->get( 'print' ) || $params->get( 'email' ) ) { 459 // link used by print button 460 $print_link = $mosConfig_live_site. '/index2.php?option=com_content&task=view&id='. $row->id .'&Itemid='. $Itemid .'&pop=1&page='. @$page; 461 ?> 462 <table class="contentpaneopen<?php echo $params->get( 'pageclass_sfx' ); ?>"> 463 <tr> 464 <?php 465 // displays Item Title 466 HTML_content::Title( $row, $params, $link_on, $access ); 467 468 // displays PDF Icon 469 HTML_content::PdfIcon( $row, $params, $link_on, $hide_js ); 470 471 // displays Print Icon 472 mosHTML::PrintIcon( $row, $params, $hide_js, $print_link ); 473 474 // displays Email Icon 475 HTML_content::EmailIcon( $row, $params, $hide_js ); 476 ?> 477 </tr> 478 </table> 479 <?php 480 } else if ( $access->canEdit ) { 481 // edit icon when item title set to hide 482 ?> 483 <table class="contentpaneopen<?php echo $params->get( 'pageclass_sfx' ); ?>"> 484 <tr> 485 <td> 486 <?php 487 HTML_content::EditIcon( $row, $params, $access ); 488 ?> 489 </td> 490 </tr> 491 </table> 492 <?php 493 } 494 495 if ( !$params->get( 'intro_only' ) ) { 496 $results = $_MAMBOTS->trigger( 'onAfterDisplayTitle', array( &$row, &$params, $page ) ); 497 echo trim( implode( "\n", $results ) ); 498 } 499 500 $results = $_MAMBOTS->trigger( 'onBeforeDisplayContent', array( &$row, &$params, $page ) ); 501 echo trim( implode( "\n", $results ) ); 502 ?> 503 504 <table class="contentpaneopen<?php echo $params->get( 'pageclass_sfx' ); ?>"> 505 <?php 506 // displays Section & Category 507 HTML_content::Section_Category( $row, $params ); 508 509 // displays Author Name 510 HTML_content::Author( $row, $params ); 511 512 // displays Created Date 513 HTML_content::CreateDate( $row, $params ); 514 515 // displays Urls 516 HTML_content::URL( $row, $params ); 517 ?> 518 <tr> 519 <td valign="top" colspan="2"> 520 <?php 521 // displays Table of Contents 522 HTML_content::TOC( $row ); 523 524 // displays Item Text 525 echo $row->text; 526 ?> 527 </td> 528 </tr> 529 <?php 530 531 // displays Modified Date 532 HTML_content::ModifiedDate( $row, $params ); 533 534 // displays Readmore button 535 HTML_content::ReadMore( $params, $link_on, $link_text ); 536 ?> 537 </table> 538 <?php 539 $results = $_MAMBOTS->trigger( 'onAfterDisplayContent', array( &$row, &$params, $page ) ); 540 echo trim( implode( "\n", $results ) ); 541 542 // displays the next & previous buttons 543 HTML_content::Navigation ( $row, $params ); 544 545 // displays close button in pop-up window 546 mosHTML::CloseButton ( $params, $hide_js ); 547 548 // displays back button in pop-up window 549 mosHTML::BackButton ( $params, $hide_js ); 550 } 551 552 553 /** 554 * Writes Title 555 */ 556 function Title( $row, $params, $link_on, $access ) { 557 global $mosConfig_live_site, $Itemid; 558 if ( $params->get( 'item_title' ) ) { 559 if ( $params->get( 'link_titles' ) && $link_on != '' ) { 560 ?> 561 <td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%"> 562 <a href="<?php echo $link_on;?>" class="contentpagetitle<?php echo $params->get( 'pageclass_sfx' ); ?>"> 563 <?php echo $row->title;?> 564 </a> 565 <?php HTML_content::EditIcon( $row, $params, $access ); ?> 566 </td> 567 <?php 568 } else { 569 ?> 570 <td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%"> 571 <?php echo $row->title;?> 572 <?php HTML_content::EditIcon( $row, $params, $access ); ?> 573 </td> 574 <?php 575 } 576 } 577 } 578 579 /** 580 * Writes Edit icon that links to edit page 581 */ 582 function EditIcon( $row, $params, $access ) { 583 global $mosConfig_live_site, $Itemid, $my; 584 if ( $params->get( 'popup' ) ) { 585 return; 586 } 587 if ( $row->state < 0 ) { 588 return; 589 } 590 if ( !$access->canEdit && !( $access->canEditOwn && $row->created_by == $my->id ) ) { 591 return; 592 } 593 $link = 'index.php?option=com_content&task=edit&id='. $row->id; 594 $mainframe =& mosMainFrame::getInstance(); 595 $image = $mainframe->ImageCheck( 'edit.png', '/images/M_images/', NULL, NULL, T_('Edit') ); 596 ?> 597 <a href="<?php echo sefRelToAbs( $link ); ?>" title="<?php echo T_('Edit');?>"> 598 <?php echo $image; ?> 599 </a> 600 <?php 601 if ( $row->state == 0 ) { 602 echo '( '. T_('Unpublished') .' )'; 603 } 604 echo ' ( '. $row->groups .' )'; 605 } 606 607 608 /** 609 * Writes PDF icon 610 */ 611 function PdfIcon( $row, $params, $link_on, $hide_js ) { 612 global $mosConfig_live_site; 613 if ( $params->get( 'pdf' ) && !$params->get( 'popup' ) && !$hide_js ) { 614 $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; 615 $link = $mosConfig_live_site. '/index2.php?option=com_content&do_pdf=1&id='. $row->id; 616 if ( $params->get( 'icons' ) ) { 617 $mainframe =& mosMainFrame::getInstance(); 618 $image = $mainframe->ImageCheck( 'pdf_button.png', '/images/M_images/', NULL, NULL, T_('PDF') ); 619 } else { 620 $image = T_('PDF') .' '; 621 } 622 ?> 623 <td align="right" class="buttonheading"> 624 <a href="javascript:void window.open('<?php echo $link; ?>', 'win2', '<?php echo $status; ?>');" title="<?php echo T_('PDF');?>"> 625 <?php echo $image; ?> 626 </a> 627 </td> 628 <?php 629 } 630 } 631 632 633 /** 634 * Writes Email icon 635 */ 636 function EmailIcon( $row, $params, $hide_js ) { 637 global $mosConfig_live_site; 638 if ( $params->get( 'email' ) && !$params->get( 'popup' ) && !$hide_js ) { 639 $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=400,height=250,directories=no,location=no'; 640 $link = $mosConfig_live_site .'/index2.php?option=com_content&task=emailform&id='. $row->id; 641 if ( $params->get( 'icons' ) ) { 642 $mainframe =& mosMainFrame::getInstance(); 643 $image = $mainframe->ImageCheck( 'emailButton.png', '/images/M_images/', NULL, NULL, T_('E-mail') ); 644 } else { 645 $image = ' '. T_('E-mail'); 646 } 647 ?> 648 <td align="right" class="buttonheading"> 649 <a href="javascript:void window.open('<?php echo $link; ?>', 'win2', '<?php echo $status; ?>');" title="<?php echo T_('E-mail');?>"> 650 <?php echo $image; ?> 651 </a> 652 </td> 653 <?php 654 } 655 } 656 657 /** 658 * Writes Container for Section & Category 659 */ 660 function Section_Category( $row, $params ) { 661 if ( $params->get( 'section' ) || $params->get( 'category' ) ) { 662 ?> 663 <tr> 664 <td> 665 <?php 666 } 667 668 // displays Section Name 669 HTML_content::Section( $row, $params ); 670 671 // displays Section Name 672 HTML_content::Category( $row, $params ); 673 674 if ( $params->get( 'section' ) || $params->get( 'category' ) ) { 675 ?> 676 </td> 677 </tr> 678 <?php 679 } 680 } 681 682 /** 683 * Writes Section 684 */ 685 function Section( $row, $params ) { 686 if ( $params->get( 'section' ) ) { 687 ?> 688 <span> 689 <?php 690 echo $row->section; 691 // writes dash between section & Category Name when both are active 692 if ( $params->get( 'category' ) ) { 693 echo ' - '; 694 } 695 ?> 696 </span> 697 <?php 698 } 699 } 700 701 /** 702 * Writes Category 703 */ 704 function Category( $row, $params ) { 705 if ( $params->get( 'category' ) ) { 706 ?> 707 <span> 708 <?php 709 echo $row->category; 710 ?> 711 </span> 712 <?php 713 } 714 } 715 716 /** 717 * Writes Author name 718 */ 719 function Author( $row, $params ) { 720 global $acl; 721 if ( ( $params->get( 'author' ) ) && ( $row->author != "" ) ) { 722 $grp = $acl->getAroGroup( $row->created_by ); 723 $is_frontend_user = $acl->is_group_child_of( intval( $grp->group_id ), 'Public Frontend', 'ARO' ); 724 $by = $is_frontend_user ? T_('Contributed by') : T_('Written by'); 725 ?> 726 <tr> 727 <td width="70%" align="left" valign="top" colspan="2"> 728 <span class="small"> 729 <?php echo $by. ' '.( $row->created_by_alias ? $row->created_by_alias : $row->author ); ?> 730 </span> 731 732 </td> 733 </tr> 734 <?php 735 } 736 } 737 738 739 /** 740 * Writes Create Date 741 */ 742 function CreateDate( $row, $params ) { 743 $create_date = null; 744 if ( intval( $row->created ) != 0 ) { 745 $create_date = mosFormatDate( $row->created ); 746 } 747 if ( $params->get( 'createdate' ) ) { 748 ?> 749 <tr> 750 <td valign="top" colspan="2" class="createdate"> 751 <?php echo $create_date; ?> 752 </td> 753 </tr> 754 <?php 755 } 756 } 757 758 /** 759 * Writes URL's 760 */ 761 function URL( $row, $params ) { 762 if ( $params->get( 'url' ) && $row->urls ) { 763 ?> 764 <tr> 765 <td valign="top" colspan="2"> 766 <a href="http://<?php echo $row->urls ; ?>" target="_blank"> 767 <?php echo $row->urls; ?> 768 </a> 769 </td> 770 </tr> 771 <?php 772 } 773 } 774 775 /** 776 * Writes TOC 777 */ 778 function TOC( $row ) { 779 if ( @$row->toc ) { 780 echo $row->toc; 781 } 782 } 783 784 /** 785 * Writes Modified Date 786 */ 787 function ModifiedDate( $row, $params ) { 788 $mod_date = null; 789 if ( intval( $row->modified ) != 0) { 790 $mod_date = mosFormatDate( $row->modified ); 791 } 792 if ( ( $mod_date != '' ) && $params->get( 'modifydate' ) ) { 793 ?> 794 <tr> 795 <td colspan="2" align="left" class="modifydate"> 796 <?php echo T_('Last Updated'); ?> ( <?php echo $mod_date; ?> ) 797 </td> 798 </tr> 799 <?php 800 } 801 } 802 803 /** 804 * Writes Readmore Button 805 */ 806 function ReadMore ( $params, $link_on, $link_text ) { 807 if ( $params->get( 'readmore' ) ) { 808 if ( $params->get( 'intro_only' ) && $link_text ) { 809 ?> 810 <tr> 811 <td align="left" colspan="2"> 812 <a href="<?php echo $link_on;?>" class="readon<?php echo $params->get( 'pageclass_sfx' ); ?>"> 813 <?php echo $link_text;?> 814 </a> 815 </td> 816 </tr> 817 <?php 818 } 819 } 820 } 821 822 /** 823 * Writes Next & Prev navigation button 824 */ 825 function Navigation( $row, $params ) { 826 $task = mosGetParam( $_REQUEST, 'task', '' ); 827 if ( $params->get( 'item_navigation' ) && ( $task == "view" ) && !$params->get( 'popup' ) ) { 828 ?> 829 <table align="center" style="margin-top: 25px;"> 830 <tr> 831 <?php 832 if ( $row->prev ) { 833 ?> 834 <th class="pagenav_prev"> 835 <a href="<?php echo $row->prev; ?>"> 836 <<?php echo T_('Previous'); ?> 837 </a> 838 </th> 839 <?php 840 } 841 if ( $row->prev && $row->next ) { 842 ?> 843 <td width="50"> 844 845 </td> 846 <?php 847 } 848 if ( $row->next ) { 849 ?> 850 <th class="pagenav_next"> 851 <a href="<?php echo $row->next; ?>"> 852 <?php echo T_('Next'); ?>> 853 </a> 854 </th> 855 <?php 856 } 857 ?> 858 </tr> 859 </table> 860 <?php 861 } 862 } 863 864 /** 865 * Writes the edit form for new and existing content item 866 * 867 * A new record is defined when <var>$row</var> is passed with the <var>id</var> 868 * property set to 0. 869 * @param mosContent The category object 870 * @param string The html for the groups select list 871 */ 872 function editContent( &$row, $section, &$lists, &$images, &$access, $myid, $sectionid, $task, $Itemid ) { 873 global $mosConfig_live_site; 874 mosMakeHtmlSafe( $row ); 875 $Returnid = intval( mosGetParam( $_REQUEST, 'Returnid', $Itemid ) ); 876 ?> 877 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> 878 <link rel="stylesheet" type="text/css" media="all" href="includes/js/calendar/calendar-mos.css" title="green" /> 879 <!-- import the calendar script --> 880 <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/calendar.js"></script> 881 <!-- import the language module --> 882 <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/lang/calendar-en.js"></script> 883 <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script> 884 <script type="text/javascript"> 885 onunload = WarnUser; 886 var folderimages = new Array; 887 <?php 888 $i = 0; 889 foreach ($images as $k=>$items) { 890 foreach ($items as $v) { 891 echo "\n folderimages[".$i++."] = new Array( '$k','".addslashes( $v->value )."','".addslashes( $v->text )."' );"; 892 } 893 } 894 ?> 895 function submitbutton(pressbutton) { 896 var form = document.adminForm; 897 if (pressbutton == 'cancel') { 898 submitform( pressbutton ); 899 return; 900 } 901 902 // var goodexit=false; 903 // assemble the images back into one field 904 form.goodexit.value=1 905 var temp = new Array; 906 for (var i=0, n=form.imagelist.options.length; i < n; i++) { 907 temp[i] = form.imagelist.options[i].value; 908 } 909 form.images.value = temp.join( '\n' ); 910 try { 911 form.onsubmit(); 912 } 913 catch(e){} 914 // do field validation 915 if (form.title.value == "") { 916 alert ( "<?php echo T_('Content item must have a title'); ?>" ); 917 } else if (parseInt('<?php echo $row->sectionid;?>')) { 918 // for content items 919 if (getSelectedValue('adminForm','catid') < 1) { 920 alert ( "<?php echo T_('Please select a category'); ?>" ); 921 //} else if (form.introtext.value == "") { 922 // alert ( "<?php echo T_('Content item must have intro text'); ?>" ); 923 } else { 924 <?php 925 getEditorContents( 'editor1', 'introtext' ); 926 getEditorContents( 'editor2', 'fulltext' ); 927 ?> 928 submitform(pressbutton); 929 } 930 //} else if (form.introtext.value == "") { 931 // alert ( "<?php echo T_('Content item must have intro text'); ?>" ); 932 } else { 933 // for static content 934 <?php 935 getEditorContents( 'editor1', 'introtext' ) ; 936 ?> 937 submitform(pressbutton); 938 } 939 } 940 941 function setgood(){ 942 document.adminForm.goodexit.value=1; 943 } 944 945 function WarnUser(){ 946 if (document.adminForm.goodexit.value==0) { 947 alert('<?php echo T_('Please either Cancel or Save the current change');?>'); 948 window.location="<?php echo sefRelToAbs("index.php?option=com_content&task=".$task."§ionid=".$sectionid."&id=".$row->id."&Itemid=".$Itemid); ?>" 949 } 950 } 951 </script> 952 953 <?php 954 //$docinfo = "<strong>".T_('Subject:')."</strong> "; 955 //$docinfo .= $row->title."<br />"; 956 $docinfo = "<strong>".T_('Expiry Date:')."</strong> "; 957 $docinfo .= $row->publish_down."<br />"; 958 $docinfo .= "<strong>".T_('Version:')."</strong> "; 959 $docinfo .= $row->version."<br />"; 960 $docinfo .= "<strong>".T_('Created:')."</strong> "; 961 $docinfo .= $row->created."<br />"; 962 $docinfo .= "<strong>".T_('Last Modified:')."</strong> "; 963 $docinfo .= $row->modified."<br />"; 964 $docinfo .= "<strong>".T_('Hits:')."</strong> "; 965 $docinfo .= $row->hits."<br />"; 966 ?> 967 <table cellspacing="0" cellpadding="0" border="0" width="100%"> 968 <tr> 969 <td class="contentheading" > 970 <?php echo $section;?> / <?php echo $row->id ? T_('Edit') : T_('Add');?> 971 <?php echo T_('Content');?> 972 <a href="javascript: void(0);" onMouseOver="return overlib('<table><?php echo $docinfo; ?></table>', CAPTION, '<?php echo T_('Item Information');?>', BELOW, RIGHT);" onMouseOut="return nd();"> 973 <strong>[<?php echo T_('Info')?>]</strong> 974 </a> 975 </td> 976 <td width="10%"> 977 <?php 978 mosToolBar::startTable(); 979 mosToolBar::save(); 980 mosToolBar::spacer(25); 981 mosToolBar::cancel(); 982 mosToolBar::endtable(); 983 $tabs = new mosTabs(0); 984 ?> 985 </td> 986 </tr> 987 </table> 988 989 <form action="index.php" method="post" name="adminForm" onSubmit="javascript:setgood();"> 990 <input type="hidden" name="images" value="" /> 991 <table class="adminform"> 992 <tr> 993 <td> 994 <?php echo T_('Title:'); ?> 995 </td> 996 </tr> 997 <tr> 998 <td> 999 <input class="inputbox" type="text" name="title" size="50" maxlength="100" value="<?php echo $row->title; ?>" /> 1000 </td> 1001 </tr> 1002 <?php 1003 if ($row->sectionid) { 1004 ?> 1005 <tr> 1006 <td> 1007 <?php echo T_('Category:'); ?> 1008 </td> 1009 </tr> 1010 <tr> 1011 <td> 1012 <?php echo $lists['catid']; ?> 1013 </td> 1014 </tr> 1015 <?php 1016 } 1017 ?> 1018 <tr> 1019 <?php 1020 if (intval( $row->sectionid ) > 0) { 1021 ?> 1022 <td> 1023 <?php echo T_('Intro Text').' ('.T_('Required').')'; ?>: 1024 </td> 1025 <?php 1026 } else { 1027 ?> 1028 <td> 1029 <?php echo T_('Main Text').' ('.T_('Required').')'; ?>: 1030 </td> 1031 <?php 1032 } ?> 1033 </tr> 1034 <tr> 1035 <td> 1036 <?php 1037 // parameters : areaname, content, hidden field, width, height, rows, cols 1038 editorArea( 'editor1', $row->introtext , 'introtext', '500', '200', '65', '20' ) ; 1039 ?> 1040 </td> 1041 </tr> 1042 <?php 1043 if (intval( $row->sectionid ) > 0) { 1044 ?> 1045 <tr> 1046 <td> 1047 <?php echo T_('Main Text').' ('.T_('Optional').')'; ?>: 1048 </td> 1049 </tr> 1050 <tr> 1051 <td> 1052 <?php 1053 // parameters : areaname, content, hidden field, width, height, rows, cols 1054 editorArea( 'editor2', $row->fulltext , 'fulltext', '500', '400', '65', '20' ) ; 1055 ?> 1056 </td> 1057 </tr> 1058 <?php 1059 } 1060 ?> 1061 </table> 1062 <?php 1063 $tabs->startPane( 'content-pane' ); 1064 $tabs->startTab( T_('Images'), 'images-page' ); 1065 ?> 1066 <table class="adminform"> 1067 <tr> 1068 <td colspan="6"> 1069 <?php echo T_('Sub-folder'); ?> :: <?php echo $lists['folders'];?> 1070 </td> 1071 </tr> 1072 <tr> 1073 <td align="top"> 1074 <?php echo T_('Gallery Images'); ?> 1075 </td> 1076 <td align="top"> 1077 <?php echo T_('Content Images'); ?> 1078 </td> 1079 <td align="top"> 1080 <?php echo T_('Edit Image'); ?> 1081 </td> 1082 <tr> 1083 <td valign="top"> 1084 <?php echo $lists['imagefiles'];?> 1085 <br /> 1086 <input class="button" type="button" value="<?php echo T_('Insert'); ?>" onclick="addSelectedToList('adminForm','imagefiles','imagelist')" /> 1087 </td> 1088 <td valign="top"> 1089 <?php echo $lists['imagelist'];?> 1090 <br /> 1091 <input class="button" type="button" value="<?php echo T_('Up'); ?>" onclick="moveInList('adminForm','imagelist',adminForm.imagelist.selectedIndex,-1)" /> 1092 <input class="button" type="button" value="<?php echo T_('Down'); ?>" onclick="moveInList('adminForm','imagelist',adminForm.imagelist.selectedIndex,+1)" /> 1093 <input class="button" type="button" value="<?php echo T_('Remove'); ?>" onclick="delSelectedFromList('adminForm','imagelist')" /> 1094 </td> 1095 <td valign="top"> 1096 <table> 1097 <tr> 1098 <td align="right"> 1099 <?php echo T_('Source:'); ?> 1100 </td> 1101 <td> 1102 <input class="inputbox" type="text" name= "_source" value="" size="15" /> 1103 </td> 1104 </tr> 1105 <tr> 1106 <td align="right" valign="top"> 1107 <?php echo T_('Align:'); ?> 1108 </td> 1109 <td> 1110 <?php echo $lists['_align']; ?> 1111 </td> 1112 </tr> 1113 <tr> 1114 <td align="right"> 1115 <?php echo T_('Alt Text:'); ?> 1116 </td> 1117 <td> 1118 <input class="inputbox" type="text" name="_alt" value="" size="15" /> 1119 </td> 1120 </tr> 1121 <tr> 1122 <td align="right"> 1123 <?php echo T_('Border:'); ?> 1124 </td> 1125 <td> 1126 <input class="inputbox" type="text" name="_border" value="" size="3" maxlength="1" /> 1127 </td> 1128 </tr> 1129 1130 <tr> 1131 <td align="right"> 1132 <?php echo T_('Caption');?>: 1133 </td> 1134 <td> 1135 <input class="text_area" type="text" name="_caption" value="" size="30" /> 1136 </td> 1137 </tr> 1138 <tr> 1139 <td align="right"> 1140 <?php echo T_('Caption Position');?>: 1141 </td> 1142 <td> 1143 <?php echo $lists['_caption_position']; ?> 1144 </td> 1145 </tr> 1146 <tr> 1147 <td align="right"> 1148 <?php echo T_('Caption Align');?>: 1149 </td> 1150 <td> 1151 <?php echo $lists['_caption_align']; ?> 1152 </td> 1153 </tr> 1154 <tr> 1155 <td align="right"> 1156 <?php echo T_('Width');?>: 1157 </td> 1158 <td> 1159 <input class="text_area" type="text" name="_width" value="" size="5" maxlength="5" /> 1160 </td> 1161 </tr> 1162 <tr> 1163 <td align="right"></td> 1164 <td> 1165 <input class="button" type="button" value="<?php echo T_('Apply'); ?>" onclick="applyImageProps()" /> 1166 </td> 1167 </tr> 1168 </table> 1169 </td> 1170 </tr> 1171 <tr> 1172 <td> 1173 <img name="view_imagefiles" src="<?php echo $mosConfig_live_site;?>/images/M_images/blank.png" width="50" alt="<?php echo T_('No Image'); ?>" /> 1174 </td> 1175 <td> 1176 <img name="view_imagelist" src="<?php echo $mosConfig_live_site;?>/images/M_images/blank.png" width="50" alt="<?php echo T_('No Image'); ?>" /> 1177 </td> 1178 </tr> 1179 </table> 1180 <?php 1181 $tabs->endTab(); 1182 $tabs->startTab( T_('Publishing'), 'publish-page' ); 1183 ?> 1184 <table class="adminform"> 1185 <?php 1186 if ($access->canPublish) { 1187 ?> 1188 <tr> 1189 <td align="left"> 1190 <?php echo T_('State:'); ?> 1191 </td> 1192 <td> 1193 <?php echo $lists['state']; ?> 1194 </td> 1195 </tr> 1196 <?php 1197 } ?> 1198 <tr> 1199 <td align="left"> 1200 <?php echo T_('Access Level:'); ?> 1201 </td> 1202 <td> 1203 <?php echo $lists['access']; ?> 1204 </td> 1205 </tr> 1206 <tr> 1207 <td align="left"> 1208 <?php echo T_('Author Alias:'); ?> 1209 </td> 1210 <td> 1211 <input type="text" name="created_by_alias" size="50" maxlength="100" value="<?php echo $row->created_by_alias; ?>" class="inputbox" /> 1212 </td> 1213 </tr> 1214 <tr> 1215 <td align="left"> 1216 <?php echo T_('Ordering:'); ?> 1217 </td> 1218 <td> 1219 <?php echo $lists['ordering']; ?> 1220 </td> 1221 </tr> 1222 <tr> 1223 <td align="left"> 1224 <?php echo T_('Start Publishing:'); ?> 1225 </td> 1226 <td> 1227 <input class="inputbox" type="text" name="publish_up" id="publish_up" size="25" maxlength="19" value="<?php echo $row->publish_up; ?>" /> 1228 <input type="reset" class="button" value="..." onclick="return showCalendar('publish_up', 'y-mm-dd');" /> 1229 </td> 1230 </tr> 1231 <tr> 1232 <td align="left"> 1233 <?php echo T_('Finish Publishing:'); ?> 1234 </td> 1235 <td> 1236 <input class="inputbox" type="text" name="publish_down" id="publish_down" size="25" maxlength="19" value="<?php echo $row->publish_down; ?>" /> 1237 <input type="reset" class="button" value="..." onclick="return showCalendar('publish_down', 'y-mm-dd');" /> 1238 </td> 1239 </tr> 1240 <tr> 1241 <td align="left"> 1242 <?php echo T_('Show on Front Page:'); ?> 1243 </td> 1244 <td> 1245 <input type="checkbox" name="frontpage" value="1" <?php echo $row->frontpage ? 'checked="checked"' : ''; ?> /> 1246 </td> 1247 </tr> 1248 </table> 1249 <?php 1250 $tabs->endTab(); 1251 $tabs->startTab( T_('Metadata'), 'meta-page' ); 1252 ?> 1253 <table class="adminform"> 1254 <tr> 1255 <td align="left" valign="top"> 1256 <?php echo T_('Description:'); ?> 1257 </td> 1258 <td> 1259 <textarea class="inputbox" cols="45" rows="3" name="metadesc"><?php echo str_replace('&','&',$row->metadesc); ?></textarea> 1260 </td> 1261 </tr> 1262 <tr> 1263 <td align="left" valign="top"> 1264 <?php echo T_('Keywords:'); ?> 1265 </td> 1266 <td> 1267 <textarea class="inputbox" cols="45" rows="3" name="metakey"><?php echo str_replace('&','&',$row->metakey); ?></textarea> 1268 </td> 1269 </tr> 1270 </table> 1271 <input type="hidden" name="goodexit" value="0" /> 1272 <input type="hidden" name="option" value="com_content" /> 1273 <input type="hidden" name="Returnid" value="<?php echo $Returnid; ?>" /> 1274 <input type="hidden" name="id" value="<?php echo $row->id; ?>" /> 1275 <input type="hidden" name="version" value="<?php echo $row->version; ?>" /> 1276 <input type="hidden" name="sectionid" value="<?php echo $row->sectionid; ?>" /> 1277 <input type="hidden" name="created_by" value="<?php echo $row->created_by; ?>" /> 1278 <input type="hidden" name="task" value="" /> 1279 </form> 1280 <?php 1281 $tabs->endTab(); 1282 $tabs->endPane(); 1283 ?> 1284 <div style="clear:both;"></div> 1285 <?php 1286 } 1287 1288 /** 1289 * Writes Email form for filling in the send destination 1290 */ 1291 function emailForm( $uid, $title, $template='' ) { 1292 global $mosConfig_sitename; 1293 1294 mos_session_start(); 1295 $_SESSION['_form_check_']['com_content'] = crypt(time()); 1296 $form_check = $_SESSION['_form_check_']['com_content']; 1297 ?> 1298 <script type="text/javascript"> 1299 function submitbutton() { 1300 var form = document.frontendForm; 1301 // do field validation 1302 if (form.email.value == "" || form.youremail.value == "") { 1303 alert( '<?php echo addslashes( T_('You must enter valid e-mail addresses for both yourself and your recipient.') ); ?>' ); 1304 return false; 1305 } 1306 return true; 1307 } 1308 </script> 1309 1310 <title><?php echo $mosConfig_sitename; ?> :: <?php echo $title; ?></title> 1311 <link rel="stylesheet" href="templates/<?php echo $template; ?>/css/template_css.css" type="text/css" /> 1312 <form action="index2.php?option=com_content&task=emailsend" name="frontendForm" method="post" onSubmit="return submitbutton();"> 1313 <input type="hidden" name="form_check" value="<?php echo $form_check;?>"> 1314 <table cellspacing="0" cellpadding="0" border="0"> 1315 <tr> 1316 <td colspan="2"> 1317 <?php echo T_('E-mail this to a friend.'); ?> 1318 </td> 1319 </tr> 1320 <tr> 1321 <td colspan="2"> </td> 1322 </tr> 1323 <tr> 1324 <td width="130"> 1325 <?php echo T_("Your friend's E-mail:"); ?> 1326 </td> 1327 <td> 1328 <input type="text" name="email" class="inputbox" size="25"> 1329 </td> 1330 </tr> 1331 <tr> 1332 <td height="27"> 1333 <?php echo T_('Your Name:'); ?> 1334 </td> 1335 <td> 1336 <input type="text" name="yourname" class="inputbox" size="25"> 1337 </td> 1338 </tr> 1339 <tr> 1340 <td> 1341 <?php echo T_('Your E-mail:'); ?> 1342 </td> 1343 <td> 1344 <input type="text" name="youremail" class="inputbox" size="25"> 1345 </td> 1346 </tr> 1347 <tr> 1348 <td> 1349 <?php echo T_('Message subject:'); ?> 1350 </td> 1351 <td> 1352 <input type="text" name="subject" class="inputbox" maxlength="100" size="40"> 1353 </td> 1354 </tr> 1355 <tr> 1356 <td colspan="2"> </td> 1357 </tr> 1358 <tr> 1359 <td colspan="2"> 1360 <input type="submit" name="submit" class="button" value="<?php echo T_('Send e-mail'); ?>"> 1361 <input type="button" name="cancel" value="<?php echo T_('Cancel'); ?>" class="button" onclick="window.close();"> 1362 </td> 1363 </tr> 1364 </table> 1365 1366 <input type="hidden" name="id" value="<?php echo $uid; ?>"> 1367 </form> 1368 <?php 1369 } 1370 1371 /** 1372 * Writes Email sent popup 1373 * @param string Who it was sent to 1374 * @param string The current template 1375 */ 1376 function emailSent( $to, $template='' ) { 1377 global $mosConfig_sitename; 1378 ?> 1379 <title><?php echo $mosConfig_sitename; ?></title> 1380 <link rel="stylesheet" href="templates/<?php echo $template; ?>/css/template_css.css" type="text/css" /> 1381 <span class="contentheading"><?php printf(T_('This item has been sent to %s'), $to);?></span> <br /> 1382 <br /> 1383 <br /> 1384 <a href='javascript:window.close();'> 1385 <span class="small"><?php echo T_('Close Window');?></span> 1386 </a> 1387 <?php 1388 } 1389 } 1390 ?>
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 |