[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_sections/ -> admin.sections.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Sections
   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 sections_html {
  21      /**
  22      * Writes a list of the categories for a section
  23      * @param array An array of category objects
  24      * @param string The name of the category section
  25      */
  26  	function show( &$rows, $scope, $myid, &$pageNav, $option ) {
  27          global $my;
  28  
  29          mosCommonHTML::loadOverlib();
  30          ?>
  31          <form action="index2.php" method="post" name="adminForm">
  32          <table class="adminheading">
  33          <tr>
  34               <th class="sections">
  35              <?php echo T_('Section Manager'); ?>
  36              </th>
  37          </tr>
  38          </table>
  39  
  40          <table class="adminlist">
  41          <tr>
  42              <th width="20">
  43              #
  44              </th>
  45              <th width="20">
  46              <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $rows );?>);" />
  47              </th>
  48              <th class="title">
  49              <?php echo T_('Section Name'); ?>
  50              </th>
  51              <th width="10%">
  52              <?php echo T_('Published'); ?>
  53              </th>
  54              <th colspan="2" width="5%">
  55              <?php echo T_('Reorder'); ?>
  56              </th>
  57              <th width="2%">
  58              <?php echo T_('Order'); ?>
  59              </th>
  60              <th width="1%">
  61              <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>
  62              </th>
  63              <th width="8%">
  64              <?php echo T_('Access'); ?>
  65              </th>
  66              <th width="12%" nowrap>
  67              <?php echo T_('Section ID'); ?>
  68              </th>
  69              <th width="12%" nowrap>
  70              <?php echo T_('# Categories'); ?>
  71              </th>
  72              <th width="12%" nowrap>
  73              <?php echo T_('# Active'); ?>
  74              </th>
  75              <th width="12%" nowrap>
  76              <?php echo T_('# Trash'); ?>
  77              </th>
  78  
  79          </tr>
  80          <?php
  81          $k = 0;
  82          for ( $i=0, $n=count( $rows ); $i < $n; $i++ ) {
  83              $row = &$rows[$i];
  84  
  85              $link = 'index2.php?option=com_sections&scope=content&task=editA&hidemainmenu=1&id='. $row->id;
  86  
  87              $access     = mosCommonHTML::AccessProcessing( $row, $i );
  88              $checked     = mosCommonHTML::CheckedOutProcessing( $row, $i );
  89              $published     = mosCommonHTML::PublishedProcessing( $row, $i );
  90              ?>
  91              <tr class="<?php echo "row$k"; ?>">
  92                  <td width="20" align="right">
  93                  <?php echo $pageNav->rowNumber( $i ); ?>
  94                  </td>
  95                  <td width="20">
  96                  <?php echo $checked; ?>
  97                  </td>
  98                  <td width="35%">
  99                  <?php
 100                  if ( $row->checked_out && ( $row->checked_out != $my->id ) ) {
 101                      echo $row->name. " ( ". $row->title ." )";
 102                  } else {
 103                      ?>
 104                      <a href="<?php echo $link; ?>">
 105                      <?php echo $row->name. " ( ". $row->title ." )"; ?>
 106                      </a>
 107                      <?php
 108                  }
 109                  ?>
 110                  </td>
 111                  <td align="center">
 112                  <?php echo $published;?>
 113                  </td>
 114                  <td>
 115                  <?php echo $pageNav->orderUpIcon( $i ); ?>
 116                  </td>
 117                  <td>
 118                  <?php echo $pageNav->orderDownIcon( $i, $n ); ?>
 119                  </td>
 120                  <td align="center" colspan="2">
 121                  <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align: center" />
 122                  </td>
 123                  <td align="center">
 124                  <?php echo $access;?>
 125                  </td>
 126                  <td align="center">
 127                  <?php echo $row->id; ?>
 128                  </td>
 129                  <td align="center">
 130                  <?php echo $row->categories; ?>
 131                  </td>
 132                  <td align="center">
 133                  <?php echo $row->active; ?>
 134                  </td>
 135                  <td align="center">
 136                  <?php echo $row->trash; ?>
 137                  </td>
 138                  <?php
 139                  $k = 1 - $k;
 140                  ?>
 141              </tr>
 142              <?php
 143          }
 144          ?>
 145          </table>
 146  
 147          <?php echo $pageNav->getListFooter(); ?>
 148  
 149          <input type="hidden" name="option" value="<?php echo $option;?>" />
 150          <input type="hidden" name="scope" value="<?php echo $scope;?>" />
 151          <input type="hidden" name="task" value="" />
 152          <input type="hidden" name="chosen" value="" />
 153          <input type="hidden" name="act" value="" />
 154          <input type="hidden" name="boxchecked" value="0" />
 155          <input type="hidden" name="hidemainmenu" value="0" />
 156          </form>
 157          <?php
 158      }
 159  
 160      /**
 161      * Writes the edit form for new and existing categories
 162      *
 163      * A new record is defined when <var>$row</var> is passed with the <var>id</var>
 164      * property set to 0.  Note that the <var>section</var> property <b>must</b> be defined
 165      * even for a new record.
 166      * @param mosCategory The category object
 167      * @param string The html for the image list select list
 168      * @param string The html for the image position select list
 169      * @param string The html for the ordering list
 170      * @param string The html for the groups select list
 171      */
 172  	function edit( &$row, $option, &$lists, &$menus ) {
 173          global $mosConfig_live_site;
 174          if ( $row->name != '' ) {
 175              $name = $row->name;
 176          } else {
 177              $name = T_("New Section");
 178          }
 179          if ($row->image == "") {
 180              $row->image = 'blank.png';
 181          }
 182          ?>
 183          <script type="text/javascript">
 184  		function submitbutton(pressbutton) {
 185              var form = document.adminForm;
 186              if (pressbutton == 'cancel') {
 187                  submitform( pressbutton );
 188                  return;
 189              }
 190  
 191              if ( pressbutton == 'menulink' ) {
 192                  if ( form.menuselect.value == "" ) {
 193                      alert( "<?php echo T_('Please select a Menu'); ?>" );
 194                      return;
 195                  } else if ( form.link_type.value == "" ) {
 196                      alert( "<?php echo T_('Please select a menu type'); ?>" );
 197                      return;
 198                  } else if ( form.link_name.value == "" ) {
 199                      alert( "<?php echo T_('Please enter a Name for this menu item'); ?>" );
 200                      return;
 201                  }
 202              }
 203  
 204              if (form.name.value == ""){
 205                  alert("<?php echo T_('Section must have a name'); ?>");
 206              } else if (form.title.value ==""){
 207                  alert("<?php echo T_('Section must have a title'); ?>");
 208              } else {
 209                  <?php getEditorContents( 'editor1', 'description' ) ; ?>
 210                  submitform(pressbutton);
 211              }
 212          }
 213          // show / hide publishing information
 214  			function displayParameterInfo()
 215              {
 216  
 217                  if(document.getElementById('simpleediting').style.display == 'block')
 218                  {
 219                      document.getElementById('simpleediting').style.display = 'none';
 220                      document.getElementById('show').style.display = 'block';
 221                      document.getElementById('hide').style.display = 'none';
 222                      document.adminForm.simple_editing.value ='on';
 223                  }
 224                  else
 225                  {
 226                      document.getElementById('simpleediting').style.display = 'block';
 227                      document.getElementById('show').style.display = 'none';
 228                      document.getElementById('hide').style.display = 'block';
 229                      document.adminForm.simple_editing.value ='off';
 230                  }
 231  
 232              }
 233          </script>
 234          <?php
 235          if($_SESSION['simple_editing'] == 'on')
 236          {
 237              $simpleediting ='none';
 238              $simple = 'block';
 239              $advanced = 'none';
 240          }
 241          else
 242          {
 243  
 244              $advanced = 'block';
 245              $simple = 'none';
 246              $simpleediting ='block';
 247          }
 248  
 249          ?>
 250          <form action="index2.php" method="post" name="adminForm">
 251          <input type ="hidden" name="simple_editing" value='' />
 252          <table class="adminheading">
 253          <tr>
 254              <th class="sections">
 255              <?php echo T_('Section:'); ?>
 256              <small>
 257              <?php echo $row->id ? T_('Edit') : T_('New');?>
 258              </small>
 259              <small><small>
 260              [ <?php echo $name ; ?> ]
 261              </small></small>
 262              </th>
 263          </tr>
 264          </table>
 265          <table width="100%">
 266              <tr>
 267                  <td valign="top" align="right">
 268                  <div id = "show" style="display:<?php echo $simple;?>">
 269                  <a href="javascript:displayParameterInfo();"><?php echo T_('Show Advanced Details'); ?></a>
 270                  </div>
 271                  <div id = "hide" style="display:<?php echo $advanced;?>">
 272                  <a href="javascript:displayParameterInfo();"><?php echo T_('Hide Advanced Details'); ?></a>
 273                  </div>
 274                  </td>
 275              </tr>
 276          </table>
 277          <table width="100%">
 278          <tr>
 279              <td valign="top" >
 280                  <table class="adminform">
 281                  <tr>
 282                      <th colspan="3">
 283                      <?php echo T_('Section Details'); ?>
 284                      </th>
 285                  </tr>
 286                  <tr>
 287                      <td width="150">
 288                      <?php echo T_('Scope:'); ?>
 289                      </td>
 290                      <td width="85%" colspan="2">
 291                      <strong>
 292                      <?php echo $row->scope; ?>
 293                      </strong>
 294                      </td>
 295                  </tr>
 296                  <tr>
 297                      <td>
 298                      <?php echo T_('Title:'); ?>
 299                      </td>
 300                      <td colspan="2">
 301                      <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'); ?>" />
 302                      </td>
 303                  </tr>
 304                  <tr>
 305                      <td>
 306                      <?php echo (isset($row->section) ? T_("Category") : T_("Section"));?> <?php echo T_('Name:'); ?>
 307                      </td>
 308                      <td colspan="2">
 309                      <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'); ?>" />
 310                      </td>
 311                  </tr>
 312                  <tr>
 313                      <td>
 314                      <?php echo T_('Image:'); ?>
 315                      </td>
 316                      <td>
 317                      <?php echo $lists['image']; ?>
 318                      </td>
 319                      <td rowspan="4" width="50%">
 320                      <?php
 321                          $path = $mosConfig_live_site . "/images/";
 322                          if ($row->image != "blank.png") {
 323                              $path.= "stories/";
 324                          }
 325                      ?>
 326                      <img src="<?php echo $path;?><?php echo $row->image;?>" name="imagelib" width="80" height="80" border="2" alt="<?php echo T_('Preview'); ?>" />
 327                      </td>
 328                  </tr>
 329                  <tr>
 330                      <td>
 331                      <?php echo T_('Image Position:'); ?>
 332                      </td>
 333                      <td>
 334                      <?php echo $lists['image_position']; ?>
 335                      </td>
 336                  </tr>
 337                  <tr>
 338                      <td>
 339                      <?php echo T_('Ordering:'); ?>
 340                      </td>
 341                      <td>
 342                      <?php echo $lists['ordering']; ?>
 343                      </td>
 344                  </tr>
 345                  <tr>
 346                      <td>
 347                      <?php echo T_('Access Level:'); ?>
 348                      </td>
 349                      <td>
 350                      <?php echo $lists['access']; ?>
 351                      </td>
 352                  </tr>
 353                  <tr>
 354                      <td>
 355                      <?php echo T_('Published:'); ?>
 356                      </td>
 357                      <td>
 358                      <?php echo $lists['published']; ?>
 359                      </td>
 360                  </tr>
 361                  <tr>
 362                      <td valign="top">
 363                      <?php echo T_('Description:'); ?>
 364                      </td>
 365                      <td colspan="2">
 366                      <?php
 367                      // parameters : areaname, content, hidden field, width, height, rows, cols
 368                      editorArea( 'editor1',  $row->description , 'description', '100%;', '300', '60', '20' ) ; ?>
 369                      </td>
 370                  </tr>
 371                  </table>
 372              </td>
 373              <td valign="top" align="right">
 374              <div id="simpleediting" style="display:<?php echo $simpleediting;?>">
 375              <table cellspacing="0" cellpadding="0" border="0" width="100%" >
 376                  <tr>
 377                      <td width="40%">
 378              <?php
 379              if ( $row->id > 0 ) {
 380                      ?>
 381                  <table class="adminform">
 382                  <tr>
 383                      <th colspan="2">
 384                      <?php echo T_('Link to Menu'); ?>
 385                      </th>
 386                  </tr>
 387                  <tr>
 388                      <td colspan="2">
 389                      <?php echo T_('This will create a new menu item in the menu you select'); ?>
 390                      <br /><br />
 391                      </td>
 392                  </tr>
 393                  <tr>
 394                      <td valign="top" width="100px">
 395                      <?php echo T_('Select a Menu'); ?>
 396                      </td>
 397                      <td>
 398                      <?php echo $lists['menuselect']; ?>
 399                      </td>
 400                  </tr>
 401                  <tr>
 402                      <td valign="top" width="100px">
 403                      <?php echo T_('Select Menu Type'); ?>
 404                      </td>
 405                      <td>
 406                      <?php echo $lists['link_type']; ?>
 407                      </td>
 408                  </tr>
 409                  <tr>
 410                      <td valign="top" width="100px">
 411                      <?php echo T_('Menu Item Name'); ?>
 412                      </td>
 413                      <td>
 414                      <input type="text" name="link_name" class="inputbox" value="" size="25" />
 415                      </td>
 416                  </tr>
 417                  <tr>
 418                      <td>
 419                      </td>
 420                      <td>
 421                      <input name="menu_link" type="button" class="button" value="<?php echo T_('Link to Menu'); ?>" onClick="submitbutton('menulink');" />
 422                      </td>
 423                  </tr>
 424                  <tr>
 425                      <th colspan="2">
 426                      <?php echo T_('Existing Menu Links'); ?>
 427                      </th>
 428                  </tr>
 429                  <?php
 430                  if ( $menus == NULL ) {
 431                      ?>
 432                      <tr>
 433                          <td colspan="2">
 434                          <?php echo T_('None'); ?>
 435                          </td>
 436                      </tr>
 437                      <?php
 438                  } else {
 439                      mosCommonHTML::menuLinksSecCat( $menus );
 440                  }
 441                  ?>
 442                  <tr>
 443                      <td colspan="2">
 444                      </td>
 445                  </tr>
 446                  </table>
 447              <?php
 448              } else {
 449              ?>
 450  
 451              <table class="adminform" width="40%">
 452                  <tr><th>&nbsp;</th></tr>
 453                  <tr><td><?php echo T_('Menu links available when saved'); ?></td></tr>
 454              </table>
 455              <?php
 456              }
 457              ?>
 458              </td>
 459          </tr>
 460          </table>
 461          </div>
 462          </td>
 463          </tr>
 464          </table>
 465          <input type="hidden" name="option" value="<?php echo $option;?>" />
 466          <input type="hidden" name="scope" value="<?php echo $row->scope; ?>" />
 467          <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
 468          <input type="hidden" name="task" value="" />
 469          <input type="hidden" name="hidemainmenu" value="0" />
 470          <input type="hidden" name="oldtitle" value="<?php echo $row->title ; ?>" />
 471          </form>
 472          </td>
 473          </tr>
 474          </table>
 475          <?php
 476      }
 477  
 478  
 479      /**
 480      * Form to select Section to copy Category to
 481      */
 482  	function copySectionSelect( $option, $cid, $categories, $contents, $section ) {
 483          ?>
 484          <form action="index2.php" method="post" name="adminForm">
 485          <br />
 486          <table class="adminheading">
 487          <tr>
 488              <th class="sections">
 489              <?php echo T_('Copy Section'); ?>
 490              </th>
 491          </tr>
 492          </table>
 493  
 494          <br />
 495          <table class="adminform">
 496          <tr>
 497              <td width="3%"></td>
 498              <td align="left" valign="top" width="30%">
 499              <strong><?php echo T_('Copy to Section:'); ?></strong>
 500              <br />
 501              <input class="text_area" type="text" name="title" value="" size="35" maxlength="50" title="<?php echo T_('The new Section name'); ?>" />
 502              <br /><br />
 503              </td>
 504              <td align="left" valign="top" width="20%">
 505              <strong><?php echo T_('Categories being copied:'); ?></strong>
 506              <br />
 507              <?php
 508              echo "<ol>";
 509              if ($categories) {
 510                  foreach ( $categories as $category ) {
 511                      echo "<li>". $category->name ."</li>";
 512                      echo "\n <input type=\"hidden\" name=\"category[]\" value=\"$category->id\" />";
 513                  }
 514              } else {
 515                  echo 'none';
 516              }
 517              echo "</ol>";
 518              ?>
 519              </td>
 520              <td valign="top" width="20%">
 521              <strong><?php echo T_('Content Items being copied:'); ?></strong>
 522              <br />
 523              <?php
 524              echo "<ol>";
 525              if ($contents) {
 526                  foreach ( $contents as $content ) {
 527                      echo "<li>". $content->title ."</li>";
 528                      echo "\n <input type=\"hidden\" name=\"content[]\" value=\"$content->id\" />";
 529                  }
 530              } else {
 531                  echo 'none';
 532              }
 533              echo "</ol>";
 534              ?>
 535              </td>
 536              <td valign="top">
 537              <?php echo T_('This will copy the Categories listed
 538              <br />
 539              and all the items within the category (also listed)
 540              <br />
 541              to the new Section created.'); ?>
 542              </td>.
 543          </tr>
 544          </table>
 545          <br /><br />
 546  
 547          <input type="hidden" name="option" value="<?php echo $option;?>" />
 548          <input type="hidden" name="section" value="<?php echo $section;?>" />
 549          <input type="hidden" name="boxchecked" value="1" />
 550          <input type="hidden" name="task" value="" />
 551          <input type="hidden" name="scope" value="content" />
 552          <?php
 553          foreach ( $cid as $id ) {
 554              echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />";
 555          }
 556          ?>
 557          </form>
 558          <?php
 559      }
 560  
 561  }
 562  ?>