[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_templates/ -> admin.templates.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Templates
   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 HTML_templates {
  21      /**
  22      * @param array An array of data objects
  23      * @param object A page navigation object
  24      * @param string The option
  25      */
  26  	function showTemplates( &$rows, &$pageNav, $option, $client ) {
  27          global $my, $mosConfig_live_site;
  28  
  29          if ( isset( $row->authorUrl) && $row->authorUrl != '' ) {
  30              $row->authorUrl = str_replace( 'http://', '', $row->authorUrl );
  31          }
  32  
  33          mosCommonHTML::loadOverlib();
  34          ?>
  35          <script type="text/javascript">
  36          <!--
  37  		function showInfo(name) {
  38              var pattern = /\b \b/ig;
  39              name = name.replace(pattern,'_');
  40              name = name.toLowerCase();
  41              if (document.adminForm.doPreview.checked) {
  42                  var src = '<?php echo $mosConfig_live_site . ($client == 'admin' ? '/administrator' : '');?>/templates/'+name+'/template_thumbnail.png';
  43                  var html=name;
  44                  html = '<br /><img border="1" src="'+src+'" name="imagelib" alt="<?php echo T_('No preview available'); ?>" width="206" height="145" />';
  45                  return overlib(html, CAPTION, name)
  46              } else {
  47                  return false;
  48              }
  49          }
  50          -->
  51          </script>
  52  
  53          <form action="index2.php" method="post" name="adminForm">
  54          <table class="adminheading">
  55          <tr>
  56              <th class="templates">
  57              <?php echo T_('Template Manager'); ?> <small><small>[ <?php echo $client == 'admin' ? T_('Administrator') : T_('Site');?> ]</small></small>
  58              </th>
  59              <td align="right" nowrap="true">
  60              <?php echo T_('Preview Template'); ?>
  61              </td>
  62              <td align="right">
  63              <input type="checkbox" name="doPreview" checked="checked"/>
  64              </td>
  65          </tr>
  66          </table>
  67          <table class="adminlist">
  68          <tr>
  69              <th width="5%">#</th>
  70              <th width="5%">&nbsp;</th>
  71              <th width="25%" class="title">
  72              <?php echo T_('Name'); ?>
  73              </th>
  74              <?php
  75              if ( $client == 'admin' ) {
  76                  ?>
  77                  <th width="10%">
  78                  <?php echo T_('Default'); ?>
  79                  </th>
  80                  <?php
  81              } else {
  82                  ?>
  83                  <th width="5%">
  84                  <?php echo T_('Default'); ?>
  85                  </th>
  86                  <th width="5%">
  87                  <?php echo T_('Assigned'); ?>
  88                  </th>
  89                  <?php
  90              }
  91              ?>
  92              <th width="20%" align="left">
  93              <?php echo T_('Author'); ?>
  94              </th>
  95              <th width="5%" align="center">
  96              <?php echo T_('Version'); ?>
  97              </th>
  98              <th width="10%" align="center">
  99              <?php echo T_('Date'); ?>
 100              </th>
 101              <th width="20%" align="left">
 102              <?php echo T_('Author URL'); ?>
 103              </th>
 104          </tr>
 105          <?php
 106          $k = 0;
 107          for ( $i=0, $n = count( $rows ); $i < $n; $i++ ) {
 108              $row = &$rows[$i];
 109              ?>
 110              <tr class="<?php echo 'row'. $k; ?>">
 111                  <td>
 112                  <?php echo $pageNav->rowNumber( $i ); ?>
 113                  </td>
 114                  <td>
 115                  <?php
 116                  if ( $row->checked_out && $row->checked_out != $my->id ) {
 117                      ?>
 118                      &nbsp;
 119                      <?php
 120                  } else {
 121                      ?>
 122                      <input type="radio" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->directory; ?>" onClick="isChecked(this.checked);" />
 123                      <?php
 124                  }
 125                  ?>
 126                  </td>
 127                  <td>
 128                  <a href="#info" onmouseover="showInfo('<?php echo $row->name;?>')" onmouseout="return nd();">
 129                  <?php echo $row->name;?>
 130                  </a>
 131                  </td>
 132                  <?php
 133                  if ( $client == 'admin' ) {
 134                      ?>
 135                      <td align="center">
 136                      <?php
 137                      if ( $row->published == 1 ) {
 138                          ?>
 139                      <img src="images/tick.png" alt="<?php echo T_('Published'); ?>">
 140                          <?php
 141                      } else {
 142                          ?>
 143                          &nbsp;
 144                          <?php
 145                      }
 146                      ?>
 147                      </td>
 148                      <?php
 149                  } else {
 150                      ?>
 151                      <td align="center">
 152                      <?php
 153                      if ( $row->published == 1 ) {
 154                          ?>
 155                          <img src="images/tick.png" alt="<?php echo T_('Default'); ?>">
 156                          <?php
 157                      } else {
 158                          ?>
 159                          &nbsp;
 160                          <?php
 161                      }
 162                      ?>
 163                      </td>
 164                      <td align="center">
 165                      <?php
 166                      if ( $row->assigned == 1 ) {
 167                          ?>
 168                          <img src="images/tick.png" alt="<?php echo T_('Assigned'); ?>" />
 169                          <?php
 170                      } else {
 171                          ?>
 172                          &nbsp;
 173                          <?php
 174                      }
 175                      ?>
 176                      </td>
 177                      <?php
 178                  }
 179                  ?>
 180                  <td>
 181                  <?php echo $row->authorEmail ? '<a href="mailto:'. $row->authorEmail .'">'. $row->author .'</a>' : $row->author; ?>
 182                  </td>
 183                  <td align="center">
 184                  <?php echo $row->version; ?>
 185                  </td>
 186                  <td align="center">
 187                  <?php echo $row->creationdate; ?>
 188                  </td>
 189                  <td>
 190                  <a href="<?php echo substr( $row->authorUrl, 0, 7) == 'http://' ? $row->authorUrl : 'http://'.$row->authorUrl; ?>" target="_blank">
 191                  <?php echo $row->authorUrl; ?>
 192                  </a>
 193                  </td>
 194              </tr>
 195              <?php
 196          }
 197          ?>
 198          </table>
 199          <?php echo $pageNav->getListFooter(); ?>
 200  
 201          <input type="hidden" name="option" value="<?php echo $option;?>" />
 202          <input type="hidden" name="task" value="" />
 203          <input type="hidden" name="boxchecked" value="0" />
 204          <input type="hidden" name="hidemainmenu" value="0" />
 205          <input type="hidden" name="client" value="<?php echo $client;?>" />
 206          </form>
 207          <?php
 208      }
 209  
 210  
 211      /**
 212      * @param string Template name
 213      * @param string Source code
 214      * @param string The option
 215      */
 216  	function editTemplateSource( $template, &$content, $option, $client ) {
 217          global $mosConfig_absolute_path;
 218          $template_path =
 219              $mosConfig_absolute_path . ($client == 'admin' ? '/administrator':'') .
 220              '/templates/' . $template . '/index.php';
 221          ?>
 222          <form action="index2.php" method="post" name="adminForm">
 223          <table cellpadding="1" cellspacing="1" border="0" width="100%">
 224          <tr>
 225              <td width="290"><table class="adminheading"><tr><th class="templates"><?php echo T_('Template HTML Editor'); ?></th></tr></table></td>
 226              <td width="220">
 227                  <span class="componentheading">index.php is :
 228                  <strong><?php echo is_writable($template_path) ? '<span class="green">'.T_('Writeable').'</span>' : '<span class="red">'.T_('Unwriteable').'</span>' ?></strong>
 229                  </span>
 230              </td>
 231  <?php
 232              if (mosIsChmodable($template_path)) {
 233                  if (is_writable($template_path)) {
 234  ?>
 235              <td>
 236                  <input type="checkbox" id="disable_write" name="disable_write" value="1"/>
 237                  <label for="disable_write"><?php echo T_('Make unwriteable after saving'); ?></label>
 238              </td>
 239  <?php
 240                  } else {
 241  ?>
 242              <td>
 243                  <input type="checkbox" id="enable_write" name="enable_write" value="1"/>
 244                  <label for="enable_write"><?php echo T_('Override write protection while saving'); ?></label>
 245              </td>
 246  <?php
 247                  } // if
 248              } // if
 249  ?>
 250          </tr>
 251          </table>
 252          <table class="adminform">
 253              <tr><th><?php echo $template_path; ?></th></tr>
 254              <tr><td><textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox"><?php echo $content; ?></textarea></td></tr>
 255          </table>
 256          <input type="hidden" name="template" value="<?php echo $template; ?>" />
 257          <input type="hidden" name="option" value="<?php echo $option;?>" />
 258          <input type="hidden" name="task" value="" />
 259          <input type="hidden" name="client" value="<?php echo $client;?>" />
 260          </form>
 261          <?php
 262      }
 263  
 264  
 265      /**
 266      * @param string Template name
 267      * @param string Source code
 268      * @param string The option
 269      */
 270  	function editCSSSource( $template, &$content, $option, $client ) {
 271          global $mosConfig_absolute_path;
 272          $css_path =
 273              $mosConfig_absolute_path . ($client == 'admin' ? '/administrator' : '')
 274              . '/templates/' . $template . '/css/template_css.css';
 275          ?>
 276          <form action="index2.php" method="post" name="adminForm">
 277          <table cellpadding="1" cellspacing="1" border="0" width="100%">
 278          <tr>
 279              <td width="280"><table class="adminheading"><tr><th class="templates"><?php echo T_('Template CSS Editor'); ?></th></tr></table></td>
 280              <td width="260">
 281                  <span class="componentheading">template_css.css is :
 282                  <strong><?php echo is_writable($css_path) ? '<span class="green">'.T_('Writeable').'</span>' : '<span class="red">'.T_('Unwriteable').'</span>' ?></strong>
 283                  </span>
 284              </td>
 285  <?php
 286              if (mosIsChmodable($css_path)) {
 287                  if (is_writable($css_path)) {
 288  ?>
 289              <td>
 290                  <input type="checkbox" id="disable_write" name="disable_write" value="1"/>
 291                  <label for="disable_write"><?php echo T_('Make unwriteable after saving'); ?></label>
 292              </td>
 293  <?php
 294                  } else {
 295  ?>
 296              <td>
 297                  <input type="checkbox" id="enable_write" name="enable_write" value="1"/>
 298                  <label for="enable_write"><?php echo T_('Override write protection while saving'); ?></label>
 299              </td>
 300  <?php
 301                  } // if
 302              } // if
 303  ?>
 304          </tr>
 305          </table>
 306          <table class="adminform">
 307              <tr><th><?php echo $css_path; ?></th></tr>
 308              <tr><td><textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox"><?php echo $content; ?></textarea></td></tr>
 309          </table>
 310          <input type="hidden" name="template" value="<?php echo $template; ?>" />
 311          <input type="hidden" name="option" value="<?php echo $option;?>" />
 312          <input type="hidden" name="task" value="" />
 313          <input type="hidden" name="client" value="<?php echo $client;?>" />
 314          </form>
 315          <?php
 316      }
 317  
 318  
 319      /**
 320      * @param string Template name
 321      * @param string Menu list
 322      * @param string The option
 323      */
 324  	function assignTemplate( $template, &$menulist, $option ) {
 325          ?>
 326          <form action="index2.php" method="post" name="adminForm">
 327          <table class="adminform">
 328          <tr>
 329              <th class="left" colspan="2">
 330              <?php printf(T_('Assign template %s to menu items'), $template)?>
 331              </th>
 332          </tr>
 333          <tr>
 334              <td valign="top" align="left">
 335              <?php echo T_('Page(s):'); ?>
 336              </td>
 337              <td width="90%">
 338              <?php echo $menulist; ?>
 339              </td>
 340          </tr>
 341          </table>
 342          <input type="hidden" name="template" value="<?php echo $template; ?>" />
 343          <input type="hidden" name="option" value="<?php echo $option;?>" />
 344          <input type="hidden" name="task" value="" />
 345          </form>
 346          <?php
 347      }
 348  
 349  
 350      /**
 351      * @param array
 352      * @param string The option
 353      */
 354  	function editPositions( &$positions, $option ) {
 355          $rows = 25;
 356          $cols = 2;
 357          $n = $rows * $cols;
 358          ?>
 359          <form action="index2.php" method="post" name="adminForm">
 360          <table class="adminheading">
 361          <tr>
 362              <th class="templates">
 363              <?php echo T_('Module Positions'); ?>
 364              </th>
 365          </tr>
 366          </table>
 367  
 368          <table class="adminlist">
 369          <tr>
 370          <?php
 371          for ( $c = 0; $c < $cols; $c++ ) {
 372              ?>
 373              <th width="25">
 374              #
 375              </th>
 376              <th align="left">
 377              <?php echo T_('Position'); ?>
 378              </th>
 379              <th align="left">
 380              <?php echo T_('Description'); ?>
 381              </th>
 382              <?php
 383          }
 384          ?>
 385          </tr>
 386          <?php
 387          $i = 1;
 388          for ( $r = 0; $r < $rows; $r++ ) {
 389              ?>
 390              <tr>
 391              <?php
 392              for ( $c = 0; $c < $cols; $c++ ) {
 393                  ?>
 394                  <td>(<?php echo $i; ?>)</td>
 395                  <td>
 396                  <input type="text" name="position[<?php echo $i; ?>]" value="<?php echo @$positions[$i-1]->position; ?>" size="10" maxlength="10" />
 397                  </td>
 398                  <td>
 399                  <input type="text" name="description[<?php echo $i; ?>]" value="<?php echo htmlspecialchars( @$positions[$i-1]->description ); ?>" size="50" maxlength="255" />
 400                  </td>
 401                  <?php
 402                  $i++;
 403              }
 404              ?>
 405              </tr>
 406              <?php
 407          }
 408          ?>
 409          </table>
 410          <input type="hidden" name="option" value="<?php echo $option;?>" />
 411          <input type="hidden" name="task" value="" />
 412          </form>
 413          <?php
 414      }
 415  }
 416  ?>