[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_menumanager/ -> admin.menumanager.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Menus
   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  /**
  21  * HTML class for all menumanager component output
  22  */
  23  class HTML_menumanager {
  24      /**
  25      * Writes a list of the menumanager items
  26      */
  27  	function show ( $option, $menus, $pageNav ) {
  28          global $mosConfig_live_site;
  29          ?>
  30          <script type="text/javascript">
  31  		function menu_listItemTask( id, task, option ) {
  32              var f = document.adminForm;
  33              cb = eval( 'f.' + id );
  34              if (cb) {
  35                  cb.checked = true;
  36                  submitbutton(task);
  37              }
  38              return false;
  39          }
  40          </script>
  41  
  42          <form action="index2.php" method="post" name="adminForm">
  43          <table class="adminheading">
  44          <tr>
  45              <th class="menus">
  46              <?php echo T_('Menu Manager'); ?>
  47              </th>
  48          </tr>
  49          </table>
  50  
  51          <table class="adminlist">
  52          <tr>
  53              <th width="20">#</th>
  54              <th width="20px">
  55              </th>
  56              <th class="title" nowrap="nowrap">
  57              <?php echo T_('Menu Name'); ?>
  58              </th>
  59              <th width="5%" nowrap="nowrap">
  60              <?php echo T_('Menu Items'); ?>
  61              </th>
  62              <th width="10%">
  63              <?php echo T_('# Published'); ?>
  64              </th>
  65              <th width="15%">
  66              <?php echo T_('# Unpublished'); ?>
  67              </th>
  68              <th width="15%">
  69              <?php echo T_('# Trash'); ?>
  70              </th>
  71              <th width="15%">
  72              <?php echo T_('# Modules'); ?>
  73              </th>
  74          </tr>
  75          <?php
  76          $k = 0;
  77          $i = 0;
  78          $start = 0;
  79          if ($pageNav->limitstart)
  80              $start = $pageNav->limitstart;
  81          $count = count($menus)-$start;
  82          if ($pageNav->limit)
  83              if ($count > $pageNav->limit)
  84                  $count = $pageNav->limit;
  85          for ($m = $start; $m < $start+$count; $m++) {
  86              $menu = $menus[$m];
  87              $link     = 'index2.php?option=com_menumanager&task=edit&hidemainmenu=1&menu='. $menu->type;
  88              $linkA     = 'index2.php?option=com_menus&menutype='. $menu->type;
  89              ?>
  90              <tr class="<?php echo "row". $k; ?>">
  91                  <td align="center" width="30px">
  92                  <?php echo $i + 1 + $pageNav->limitstart;?>
  93                  </td>
  94                  <td width="30px" align="center">
  95                  <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $menu->type; ?>" onclick="isChecked(this.checked);" />
  96                  </td>
  97                  <td>
  98                  <a href="<?php echo $link; ?>" title="<?php echo T_('Edit Menu Name'); ?>">
  99                  <?php echo $menu->type; ?>
 100                  </a>
 101                  </td>
 102                  <td align="center">
 103                  <a href="<?php echo $linkA; ?>" title="<?php echo T_('Edit Menu Items'); ?>">
 104                  <img src="<?php echo $mosConfig_live_site; ?>/includes/js/ThemeOffice/mainmenu.png" border="0"/>
 105                  </a>
 106                  </td>
 107                  <td align="center">
 108                  <?php
 109                  echo $menu->published;
 110                  ?>
 111                  </td>
 112                  <td align="center">
 113                  <?php
 114                  echo $menu->unpublished;
 115                  ?>
 116                  </td>
 117                  <td align="center">
 118                  <?php
 119                  echo $menu->trash;
 120                  ?>
 121                  </td>
 122                  <td align="center">
 123                  <?php
 124                  echo $menu->modules;
 125                  ?>
 126                  </td>
 127              </tr>
 128              <?php
 129              $k = 1 - $k;
 130              $i++;
 131          }
 132          ?>
 133          </table>
 134          <?php echo $pageNav->getListFooter(); ?>
 135  
 136          <input type="hidden" name="option" value="<?php echo $option; ?>" />
 137          <input type="hidden" name="task" value="" />
 138          <input type="hidden" name="boxchecked" value="0" />
 139          <input type="hidden" name="hidemainmenu" value="0" />
 140          </form>
 141          <?php
 142      }
 143  
 144  
 145      /**
 146      * writes a form to take the name of the menu you would like created
 147      * @param option    display options for the form
 148      */
 149  	function edit ( &$row, $option ) {
 150          global $mosConfig_live_site;
 151  
 152          $new = $row->menutype ? 0 : 1;
 153          ?>
 154          <script type="text/javascript">
 155  		function submitbutton(pressbutton) {
 156              var form = document.adminForm;
 157  
 158              if (pressbutton == 'savemenu') {
 159                  if ( form.menutype.value == '' ) {
 160                      alert( '<?php echo T_('Please enter a menu name'); ?>' );
 161                      form.menutype.focus();
 162                      return;
 163                  }
 164                  <?php
 165                  if ( $new ) {
 166                      ?>
 167                      if ( form.title.value == '' ) {
 168                          alert( '<?php echo T_('Please enter a module name for your menu'); ?>' );
 169                          form.title.focus();
 170                          return;
 171                      }
 172                      <?php
 173                  }
 174                  ?>
 175                  submitform( 'savemenu' );
 176              } else {
 177                  submitform( pressbutton );
 178              }
 179          }
 180          </script>
 181          <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
 182          <form action="index2.php" method="post" name="adminForm">
 183          <table class="adminheading">
 184          <tr>
 185              <th class="menus">
 186              <?php echo T_('Menu Details'); ?>
 187              </th>
 188          </tr>
 189          </table>
 190  
 191          <table class="adminform">
 192          <tr height="45px;">
 193              <td width="100px" align="left">
 194              <strong><?php echo T_('Menu Name:'); ?></strong>
 195              </td>
 196              <td>
 197              <input class="inputbox" type="text" name="menutype" size="30" value="<?php echo isset( $row->menutype ) ? $row->menutype : ''; ?>" />
 198              <?php
 199              $tip = T_('This is the identification name used by mambo to identify this menu within the code - it must be unique. It is recommended that you do not have any spaces in your Menu Name');
 200              echo mosToolTip( $tip );
 201              ?>
 202              </td>
 203          </tr>
 204          <?php
 205          if ( $new ) {
 206              ?>
 207              <tr>
 208                  <td width="100px" align="left" valign="top">
 209                  <strong><?php echo T_('Module Title:'); ?></strong>
 210                  </td>
 211                  <td>
 212                  <input class="inputbox" type="text" name="title" size="30" value="<?php echo $row->title ? $row->title : '';?>" />
 213                  <?php
 214                  $tip = T_('Title of the mod_mainmenu module required to show this Menu');
 215                  echo mosToolTip( $tip );
 216                  ?>
 217                  <br /><br /><br />
 218                  <strong>
 219  
 220                  * <?php echo T_('A new mod_mainmenu module, with the Title you have entered above will automatically be created when you save this menu.'); ?> *
 221                  <br /><br />
 222                  <?php echo T_('Parameters for the module created are to be edited through the "Modules Manager [site]": Modules -> Site Modules'); ?>
 223                  </strong>
 224                  </td>
 225              </tr>
 226              <?php
 227          }
 228          ?>
 229          <tr>
 230              <td colspan="2">
 231              </td>
 232          </tr>
 233          </table>
 234          <br /><br />
 235  
 236          <script src="<?php echo $mosConfig_live_site; ?>/includes/js/overlib_mini.js" type="text/javascript"></script>
 237          <?php
 238          if ( $new ) {
 239              ?>
 240              <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
 241              <input type="hidden" name="iscore" value="<?php echo $row->iscore; ?>" />
 242              <input type="hidden" name="published" value="<?php echo $row->published; ?>" />
 243              <input type="hidden" name="position" value="<?php echo $row->position; ?>" />
 244              <input type="hidden" name="module" value="mod_mainmenu" />
 245              <input type="hidden" name="params" value="<?php echo $row->params; ?>" />
 246              <?php
 247          }
 248          ?>
 249  
 250          <input type="hidden" name="new" value="<?php echo $new; ?>" />
 251          <input type="hidden" name="old_menutype" value="<?php echo $row->menutype; ?>" />
 252          <input type="hidden" name="option" value="<?php echo $option; ?>" />
 253          <input type="hidden" name="task" value="savemenu" />
 254          <input type="hidden" name="boxchecked" value="0" />
 255          </form>
 256          <?php
 257          }
 258  
 259  
 260      /**
 261      * A delete confirmation page
 262      * Writes list of the items that have been selected for deletion
 263      */
 264  	function showDelete( $option, $type, $items, $modules ) {
 265          ?>
 266          <form action="index2.php" method="post" name="adminForm">
 267          <table class="adminheading">
 268          <tr>
 269              <th>
 270              <?php printf(T_('Delete Menu: %s'), $type) ?>
 271              </th>
 272          </tr>
 273          </table>
 274  
 275          <br />
 276          <table class="adminform">
 277          <tr>
 278              <td width="3%"></td>
 279              <td align="left" valign="top" width="20%">
 280              <?php
 281              if ( $modules ) {
 282                  ?>
 283                  <strong><?php echo T_('Module(s) being Deleted:'); ?></strong>
 284                  <ol>
 285                  <?php
 286                  foreach ( $modules as $module ) {
 287                      ?>
 288                      <li>
 289                      <font color="#000066">
 290                      <strong>
 291                      <?php echo $module->title; ?>
 292                      </strong>
 293                      </font>
 294                      </li>
 295                      <input type="hidden" name="cid[]" value="<?php echo $module->id; ?>" />
 296                      <?php
 297                  }
 298                  ?>
 299                  </ol>
 300                  <?php
 301              }
 302              ?>
 303              </td>
 304              <td align="left" valign="top" width="25%">
 305              <strong><?php echo T_('Menu Items being Deleted:'); ?></strong>
 306              <br />
 307              <ol>
 308              <?php
 309              if (is_array($items)) {
 310              foreach ( $items as $item ) {
 311                  ?>
 312                  <li>
 313                  <font color="#000066">
 314                  <?php echo $item->name; ?>
 315                  </font>
 316                  </li>
 317                  <input type="hidden" name="mids[]" value="<?php echo $item->id; ?>" />
 318                  <?php
 319              }
 320              }
 321              ?>
 322              </ol>
 323              </td>
 324              <td>
 325              * <?php echo T_('This will <span style="font-weight:bold;color:#FF0000">Delete</span> this Menu, <br />ALL its Menu Items and the Module(s) associated with it'); ?>  *
 326              <br /><br /><br />
 327              <div style="border: 1px dotted gray; width: 70px; padding: 10px; margin-left: 100px;">
 328              <a class="toolbar" href="javascript:if (confirm('<?php echo T_('Are you sure you want to Delete this menu? \nThis will Delete the Menu, its Items and the Module(s).'); ?>')){ submitbutton('deletemenu');}" onmouseout="MM_swapImgRestore();"  onmouseover="MM_swapImage('remove','','images/delete_f2.png',1);">
 329              <img name="remove" src="images/delete.png" alt="<?php echo T_('Delete'); ?>" border="0" align="middle" />
 330              &nbsp;<?php echo T_('Delete'); ?>
 331              </a>
 332              </div>
 333              </td>
 334          </tr>
 335          <tr>
 336              <td>&nbsp;</td>
 337          </tr>
 338          </table>
 339          <br /><br />
 340  
 341          <input type="hidden" name="option" value="<?php echo $option;?>" />
 342          <input type="hidden" name="task" value="" />
 343          <input type="hidden" name="type" value="<?php echo $type; ?>" />
 344          <input type="hidden" name="boxchecked" value="1" />
 345          </form>
 346          <?php
 347      }
 348  
 349  
 350      /**
 351      * A copy confirmation page
 352      * Writes list of the items that have been selected for copy
 353      */
 354  	function showCopy( $option, $type, $items ) {
 355      ?>
 356          <script type="text/javascript">
 357  		function submitbutton(pressbutton) {
 358              if (pressbutton == 'copymenu') {
 359                  if ( document.adminForm.menu_name.value == '' ) {
 360                      alert( '<?php echo T_('Please enter a name for the copy of the Menu'); ?>' );
 361                      return;
 362                  } else if ( document.adminForm.module_name.value == '' ) {
 363                      alert( '<?php echo T_('Please enter a name for the new Module'); ?>' );
 364                      return;
 365                  } else {
 366                      submitform( 'copymenu' );
 367                  }
 368              } else {
 369                  submitform( pressbutton );
 370              }
 371          }
 372          </script>
 373          <form action="index2.php" method="post" name="adminForm">
 374          <table class="adminheading">
 375          <tr>
 376              <th>
 377              <?php echo T_('Copy Menu'); ?>
 378              </th>
 379          </tr>
 380          </table>
 381  
 382          <br />
 383          <table class="adminform">
 384          <tr>
 385              <td width="3%"></td>
 386              <td align="left" valign="top" width="30%">
 387              <strong><?php echo T_('New Menu Name:'); ?></strong>
 388              <br />
 389              <input class="inputbox" type="text" name="menu_name" size="30" value="" />
 390              <br /><br /><br />
 391              <strong><?php echo T_('New Module Name:'); ?></strong>
 392              <br />
 393              <input class="inputbox" type="text" name="module_name" size="30" value="" />
 394              <br /><br />
 395              </td>
 396              <td align="left" valign="top" width="25%">
 397              <strong>
 398              <?php echo T_('Menu being copied:'); ?>
 399              </strong>
 400              <br />
 401              <font color="#000066">
 402              <strong>
 403              <?php echo $type; ?>
 404              </strong>
 405              </font>
 406              <br /><br />
 407              <strong>
 408              <?php echo T_('Menu Items being copied:'); ?>
 409              </strong>
 410              <br />
 411              <ol>
 412              <?php
 413              foreach ( $items as $item ) {
 414                  ?>
 415                  <li>
 416                  <font color="#000066">
 417                  <?php echo $item->name; ?>
 418                  </font>
 419                  </li>
 420                  <input type="hidden" name="mids[]" value="<?php echo $item->id; ?>" />
 421                  <?php
 422              }
 423              ?>
 424              </ol>
 425              </td>
 426              <td valign="top">
 427              </td>
 428          </tr>
 429          <tr>
 430              <td>&nbsp;</td>
 431          </tr>
 432          </table>
 433          <br /><br />
 434  
 435          <input type="hidden" name="option" value="<?php echo $option;?>" />
 436          <input type="hidden" name="task" value="" />
 437          <input type="hidden" name="type" value="<?php echo $type; ?>" />
 438          </form>
 439          <?php
 440      }
 441  }
 442  ?>