[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

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

   1  <?php
   2  /**
   3  * @version        $Id: admin.templates.html.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @subpackage    Templates
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined('_JEXEC') or die('Restricted access');
  17  
  18  /**
  19  * @package        Joomla
  20  * @subpackage    Templates
  21  */
  22  class TemplatesView
  23  {
  24      /**
  25      * @param array An array of data objects
  26      * @param object A page navigation object
  27      * @param string The option
  28      */
  29  	function showTemplates(& $rows, & $lists, & $page, $option, & $client)
  30      {
  31          global $mainframe;
  32  
  33          $limitstart = JRequest :: getVar('limitstart', '0', '', 'int');
  34  
  35          $user = & JFactory :: getUser();
  36  
  37          if (isset ($row->authorUrl) && $row->authorUrl != '') {
  38              $row->authorUrl = str_replace('http://', '', $row->authorUrl);
  39          }
  40  
  41          JHTML::_('behavior.tooltip');
  42  ?>
  43          <form action="index.php" method="post" name="adminForm">
  44  
  45              <table class="adminlist">
  46              <thead>
  47                  <tr>
  48                      <th width="5" class="title">
  49                          <?php echo JText::_( 'Num' ); ?>
  50                      </th>
  51                      <th class="title" colspan="2">
  52                          <?php echo JText::_( 'Template Name' ); ?>
  53                      </th>
  54                      <?php
  55  
  56          if ($client->id == 1) {
  57  ?>
  58                          <th width="5%">
  59                              <?php echo JText::_( 'Default' ); ?>
  60                          </th>
  61                          <?php
  62  
  63          } else {
  64  ?>
  65                          <th width="5%">
  66                              <?php echo JText::_( 'Default' ); ?>
  67                          </th>
  68                          <th width="5%">
  69                              <?php echo JText::_( 'Assigned' ); ?>
  70                          </th>
  71                          <?php
  72  
  73          }
  74  ?>
  75                      <th width="10%" align="center">
  76                          <?php echo JText::_( 'Version' ); ?>
  77                      </th>
  78                      <th width="15%" class="title">
  79                          <?php echo JText::_( 'Date' ); ?>
  80                      </th>
  81                      <th width="25%"  class="title">
  82                          <?php echo JText::_( 'Author' ); ?>
  83                      </th>
  84                  </tr>
  85              </thead>
  86              <tfoot>
  87                  <tr>
  88                      <td colspan="8">
  89                          <?php echo $page->getListFooter(); ?>
  90                      </td>
  91                  </tr>
  92              </tfoot>
  93              <tbody>
  94              <?php
  95  
  96          $k = 0;
  97          for ($i = 0, $n = count($rows); $i < $n; $i++) {
  98              $row = & $rows[$i];
  99  
 100              $author_info = @ $row->authorEmail . '<br />' . @ $row->authorUrl;
 101  ?>
 102                  <tr class="<?php echo 'row'. $k; ?>">
 103                      <td>
 104                          <?php echo $page->getRowOffset( $i ); ?>
 105                      </td>
 106                      <td width="5">
 107                      <?php
 108  
 109              if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out )) {
 110  ?>
 111                              &nbsp;
 112                              <?php
 113  
 114              } else {
 115  ?>
 116                              <input type="radio" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->directory; ?>" onclick="isChecked(this.checked);" />
 117                              <?php
 118  
 119              }
 120  ?>
 121                      </td>
 122                      <td><?php $img_path = ($client->id == 1 ? JURI::root().'administrator' : $mainframe->getSiteURL() ).'/templates/'.$row->directory.'/template_thumbnail.png'; ?>
 123                          <span class="editlinktip hasTip" title="<?php echo $row->name;?>::
 124  <img border=&quot;1&quot; src=&quot;<?php echo $img_path; ?>&quot; name=&quot;imagelib&quot; alt=&quot;<?php echo JText::_( 'No preview available' ); ?>&quot; width=&quot;206&quot; height=&quot;145&quot; />"><a href="index.php?option=com_templates&amp;task=edit&amp;cid[]=<?php echo $row->directory;?>&amp;client=<?php echo $client->id;?>">
 125                              <?php echo $row->name;?></a></span>
 126                      </td>
 127                      <?php
 128  
 129              if ($client->id == 1) {
 130  ?>
 131                          <td align="center">
 132                              <?php
 133  
 134                  if ($row->published == 1) {
 135  ?>
 136                              <img src="templates/khepri/images/menu/icon-16-default.png" alt="<?php echo JText::_( 'Published' ); ?>" />
 137                                  <?php
 138  
 139                  } else {
 140  ?>
 141                                  &nbsp;
 142                                  <?php
 143  
 144                  }
 145  ?>
 146                          </td>
 147                          <?php
 148  
 149              } else {
 150  ?>
 151                          <td align="center">
 152                              <?php
 153  
 154                  if ($row->published == 1) {
 155  ?>
 156                                  <img src="templates/khepri/images/menu/icon-16-default.png" alt="<?php echo JText::_( 'Default' ); ?>" />
 157                                  <?php
 158  
 159                  } else {
 160  ?>
 161                                  &nbsp;
 162                                  <?php
 163  
 164                  }
 165  ?>
 166                          </td>
 167                          <td align="center">
 168                              <?php
 169  
 170                  if ($row->assigned == 1) {
 171  ?>
 172                                  <img src="images/tick.png" alt="<?php echo JText::_( 'Assigned' ); ?>" />
 173                                  <?php
 174  
 175                  } else {
 176  ?>
 177                                  &nbsp;
 178                                  <?php
 179  
 180                  }
 181  ?>
 182                          </td>
 183                          <?php
 184  
 185              }
 186  ?>
 187                      <td align="center">
 188                          <?php echo $row->version; ?>
 189                      </td>
 190                      <td>
 191                          <?php echo $row->creationdate; ?>
 192                      </td>
 193                      <td>
 194                          <span class="editlinktip hasTip" title="<?php echo JText::_( 'Author Information' );?>::<?php echo $author_info; ?>">
 195                              <?php echo @$row->author != '' ? $row->author : '&nbsp;'; ?>
 196                          </span>
 197                      </td>
 198                  </tr>
 199                  <?php
 200  
 201          }
 202  ?>
 203              </tbody>
 204              </table>
 205  
 206      <input type="hidden" name="option" value="<?php echo $option;?>" />
 207      <input type="hidden" name="client" value="<?php echo $client->id;?>" />
 208      <input type="hidden" name="task" value="" />
 209      <input type="hidden" name="boxchecked" value="0" />
 210      <?php echo JHTML::_( 'form.token' ); ?>
 211      </form>
 212      <?php
 213  
 214      }
 215  
 216  	function previewTemplate($template, $showPositions, $client, $option)
 217      {
 218          global $mainframe;
 219  
 220          $tp = intval($showPositions);
 221          $url = $client->id ? JURI::base() : $mainframe->getSiteURL();
 222  ?>
 223          <style type="text/css">
 224          .previewFrame {
 225              border: none;
 226              width: 95%;
 227              height: 600px;
 228              padding: 0px 5px 0px 10px;
 229          }
 230          </style>
 231  
 232          <table class="adminform">
 233              <tr>
 234                  <th width="50%" class="title">
 235                      <?php echo JText::_( 'Site Preview' ); ?>
 236                  </th>
 237                  <th width="50%" style="text-align:right">
 238                      <?php echo JHTML::_('link', $url.'index.php?tp='.$tp.'&amp;template='.$template, JText::_( 'Open in new window' ), array('target' => '_blank')); ?>
 239                  </th>
 240              </tr>
 241              <tr>
 242                  <td width="100%" valign="top" colspan="2">
 243                      <?php echo JHTML::_('iframe', $url.'index.php?tp='.$tp.'&amp;template='.$template,'previewFrame',  array('class' => 'previewFrame')) ?>
 244                  </td>
 245              </tr>
 246          </table>
 247          <?php
 248  
 249      }
 250  
 251      /**
 252      * @param string Template name
 253      * @param string Source code
 254      * @param string The option
 255      */
 256  	function editTemplate($row, $lists, & $params, $option, & $client, & $ftp, & $template)
 257      {
 258          JRequest::setVar( 'hidemainmenu', 1 );
 259  
 260          JHTML::_('behavior.tooltip');
 261  ?>
 262          <form action="index.php" method="post" name="adminForm">
 263  
 264          <?php if($ftp): ?>
 265          <fieldset title="<?php echo JText::_('DESCFTPTITLE'); ?>" class="adminform">
 266              <legend><?php echo JText::_('DESCFTPTITLE'); ?></legend>
 267  
 268              <?php echo JText::_('DESCFTP'); ?>
 269  
 270              <?php if(JError::isError($ftp)): ?>
 271                  <p><?php echo JText::_($ftp->message); ?></p>
 272              <?php endif; ?>
 273  
 274              <table class="adminform nospace">
 275              <tbody>
 276              <tr>
 277                  <td width="120">
 278                      <label for="username"><?php echo JText::_('Username'); ?>:</label>
 279                  </td>
 280                  <td>
 281                      <input type="text" id="username" name="username" class="input_box" size="70" value="" />
 282                  </td>
 283              </tr>
 284              <tr>
 285                  <td width="120">
 286                      <label for="password"><?php echo JText::_('Password'); ?>:</label>
 287                  </td>
 288                  <td>
 289                      <input type="password" id="password" name="password" class="input_box" size="70" value="" />
 290                  </td>
 291              </tr>
 292              </tbody>
 293              </table>
 294          </fieldset>
 295          <?php endif; ?>
 296  
 297          <div class="col width-50">
 298              <fieldset class="adminform">
 299                  <legend><?php echo JText::_( 'Details' ); ?></legend>
 300  
 301                  <table class="admintable">
 302                  <tr>
 303                      <td valign="top" class="key">
 304                          <?php echo JText::_( 'Name' ); ?>:
 305                      </td>
 306                      <td>
 307                          <strong>
 308                              <?php echo JText::_($row->name); ?>
 309                          </strong>
 310                      </td>
 311                  </tr>
 312                  <tr>
 313                      <td valign="top" class="key">
 314                          <?php echo JText::_( 'Description' ); ?>:
 315                      </td>
 316                      <td>
 317                          <?php echo JText::_($row->description); ?>
 318                      </td>
 319                  </tr>
 320                  </table>
 321              </fieldset>
 322  
 323              <fieldset class="adminform">
 324                  <legend><?php echo JText::_( 'Menu Assignment' ); ?></legend>
 325                  <script type="text/javascript">
 326  					function allselections() {
 327                          var e = document.getElementById('selections');
 328                              e.disabled = true;
 329                          var i = 0;
 330                          var n = e.options.length;
 331                          for (i = 0; i < n; i++) {
 332                              e.options[i].disabled = true;
 333                              e.options[i].selected = true;
 334                          }
 335                      }
 336  					function disableselections() {
 337                          var e = document.getElementById('selections');
 338                              e.disabled = true;
 339                          var i = 0;
 340                          var n = e.options.length;
 341                          for (i = 0; i < n; i++) {
 342                              e.options[i].disabled = true;
 343                              e.options[i].selected = false;
 344                          }
 345                      }
 346  					function enableselections() {
 347                          var e = document.getElementById('selections');
 348                              e.disabled = false;
 349                          var i = 0;
 350                          var n = e.options.length;
 351                          for (i = 0; i < n; i++) {
 352                              e.options[i].disabled = false;
 353                          }
 354                      }
 355                  </script>
 356                  <table class="admintable" cellspacing="1">
 357                      <tr>
 358                          <td valign="top" class="key">
 359                              <?php echo JText::_( 'Menus' ); ?>:
 360                          </td>
 361                          <td>
 362                              <?php if ($client->id == 1) {
 363                                      echo JText::_('Cannot assign administrator template');
 364                                    } elseif ($row->pages == 'all') {
 365                                      echo JText::_('Cannot assign default template');
 366                                      echo '<input type="hidden" name="default" value="1" />';
 367                                    } elseif ($row->pages == 'none') { ?>
 368                              <label for="menus-none"><input id="menus-none" type="radio" name="menus" value="none" onclick="disableselections();" checked="checked" /><?php echo JText::_( 'None' ); ?></label>
 369                              <label for="menus-select"><input id="menus-select" type="radio" name="menus" value="select" onclick="enableselections();" /><?php echo JText::_( 'Select From List' ); ?></label>
 370                              <?php } else { ?>
 371                              <label for="menus-none"><input id="menus-none" type="radio" name="menus" value="none" onclick="disableselections();" /><?php echo JText::_( 'None' ); ?></label>
 372                              <label for="menus-select"><input id="menus-select" type="radio" name="menus" value="select" onclick="enableselections();" checked="checked" /><?php echo JText::_( 'Select From List' ); ?></label>
 373                              <?php } ?>
 374                          </td>
 375                      </tr>
 376                      <?php if ($row->pages != 'all' && $client->id != 1) : ?>
 377                      <tr>
 378                          <td valign="top" class="key">
 379                              <?php echo JText::_( 'Menu Selection' ); ?>:
 380                          </td>
 381                          <td>
 382                              <?php echo $lists['selections']; ?>
 383                              <?php if ($row->pages == 'none') { ?>
 384                              <script type="text/javascript">disableselections();</script>
 385                              <?php } ?>
 386                          </td>
 387                      </tr>
 388                      <?php endif; ?>
 389                  </table>
 390              </fieldset>
 391          </div>
 392  
 393          <div class="col width-50">
 394              <fieldset class="adminform">
 395                  <legend><?php echo JText::_( 'Parameters' ); ?></legend>
 396                  <?php $templatefile = DS.'templates'.DS.$template.DS.'params.ini';
 397                  echo is_writable($client->path.$templatefile) ? JText::sprintf('PARAMSWRITABLE', $templatefile):JText::sprintf('PARAMSUNWRITABLE', $templatefile); ?>
 398                  <table class="admintable">
 399                  <tr>
 400                      <td>
 401                          <?php
 402  
 403          if (!is_null($params)) {
 404              echo $params->render();
 405          } else {
 406              echo '<i>' . JText :: _('No Parameters') . '</i>';
 407          }
 408  ?>
 409                      </td>
 410                  </tr>
 411                  </table>
 412              </fieldset>
 413          </div>
 414          <div class="clr"></div>
 415  
 416          <input type="hidden" name="id" value="<?php echo $row->directory; ?>" />
 417          <input type="hidden" name="option" value="<?php echo $option;?>" />
 418          <input type="hidden" name="task" value="" />
 419          <input type="hidden" name="client" value="<?php echo $client->id;?>" />
 420          <?php echo JHTML::_( 'form.token' ); ?>
 421          </form>
 422          <?php
 423      }
 424  
 425  	function editTemplateSource($template, & $content, $option, & $client, & $ftp)
 426      {
 427          JRequest::setVar( 'hidemainmenu', 1 );
 428  
 429          $template_path = $client->path .DS. 'templates' .DS. $template .DS. 'index.php';
 430  ?>
 431          <form action="index.php" method="post" name="adminForm">
 432  
 433          <?php if($ftp): ?>
 434          <fieldset title="<?php echo JText::_('DESCFTPTITLE'); ?>">
 435              <legend><?php echo JText::_('DESCFTPTITLE'); ?></legend>
 436  
 437              <?php echo JText::_('DESCFTP'); ?>
 438  
 439              <?php if(JError::isError($ftp)): ?>
 440                  <p><?php echo JText::_($ftp->message); ?></p>
 441              <?php endif; ?>
 442  
 443              <table class="adminform nospace">
 444              <tbody>
 445              <tr>
 446                  <td width="120">
 447                      <label for="username"><?php echo JText::_('Username'); ?>:</label>
 448                  </td>
 449                  <td>
 450                      <input type="text" id="username" name="username" class="input_box" size="70" value="" />
 451                  </td>
 452              </tr>
 453              <tr>
 454                  <td width="120">
 455                      <label for="password"><?php echo JText::_('Password'); ?>:</label>
 456                  </td>
 457                  <td>
 458                      <input type="password" id="password" name="password" class="input_box" size="70" value="" />
 459                  </td>
 460              </tr>
 461              </tbody>
 462              </table>
 463          </fieldset>
 464          <?php endif; ?>
 465  
 466          <table class="adminform">
 467          <tr>
 468              <th>
 469                  <?php echo $template_path; ?>
 470              </th>
 471          </tr>
 472          <tr>
 473              <td>
 474                  <textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox"><?php echo $content; ?></textarea>
 475              </td>
 476          </tr>
 477          </table>
 478  
 479          <div class="clr"></div>
 480  
 481          <input type="hidden" name="id" value="<?php echo $template; ?>" />
 482          <input type="hidden" name="cid[]" value="<?php echo $template; ?>" />
 483          <input type="hidden" name="option" value="<?php echo $option;?>" />
 484          <input type="hidden" name="task" value="" />
 485          <input type="hidden" name="client" value="<?php echo $client->id;?>" />
 486          <?php echo JHTML::_( 'form.token' ); ?>
 487          </form>
 488          <?php
 489      }
 490  
 491  	function chooseCSSFiles($template, $t_dir, $t_files, $option, & $client)
 492      {
 493          JRequest::setVar( 'hidemainmenu', 1 );
 494  ?>
 495          <form action="index.php" method="post" name="adminForm">
 496  
 497          <table cellpadding="1" cellspacing="1" border="0" width="100%">
 498          <tr>
 499              <td width="220">
 500                  <span class="componentheading">&nbsp;</span>
 501              </td>
 502          </tr>
 503          </table>
 504          <table class="adminlist">
 505          <tr>
 506              <th width="5%" align="left">
 507                  <?php echo JText::_( 'Num' ); ?>
 508              </th>
 509              <th width="85%" align="left">
 510                  <?php echo $t_dir; ?>
 511              </th>
 512              <th width="10%">
 513                  <?php echo JText::_( 'Writable' ); ?>/<?php echo JText::_( 'Unwritable' ); ?>
 514              </th>
 515          </tr>
 516          <?php
 517  
 518          $k = 0;
 519          for ($i = 0, $n = count($t_files); $i < $n; $i++) {
 520              $file = & $t_files[$i];
 521  ?>
 522              <tr class="<?php echo 'row'. $k; ?>">
 523                  <td width="5%">
 524                      <input type="radio" id="cb<?php echo $i;?>" name="filename" value="<?php echo htmlspecialchars( $file, ENT_COMPAT, 'UTF-8' ); ?>" onClick="isChecked(this.checked);" />
 525                  </td>
 526                  <td width="85%">
 527                      <?php echo $file; ?>
 528                  </td>
 529                  <td width="10%">
 530                      <?php echo is_writable($t_dir.DS.$file) ? '<font color="green"> '. JText::_( 'Writable' ) .'</font>' : '<font color="red"> '. JText::_( 'Unwritable' ) .'</font>' ?>
 531                  </td>
 532              </tr>
 533          <?php
 534  
 535              $k = 1 - $k;
 536          }
 537  ?>
 538          </table>
 539          <input type="hidden" name="id" value="<?php echo $template; ?>" />
 540          <input type="hidden" name="cid[]" value="<?php echo $template; ?>" />
 541          <input type="hidden" name="option" value="<?php echo $option;?>" />
 542          <input type="hidden" name="task" value="" />
 543          <input type="hidden" name="boxchecked" value="0" />
 544          <input type="hidden" name="client" value="<?php echo $client->id;?>" />
 545          </form>
 546          <?php
 547  
 548      }
 549  
 550      /**
 551      * @param string Template name
 552      * @param string Source code
 553      * @param string The option
 554      */
 555  	function editCSSSource($template, $filename, & $content, $option, & $client, & $ftp)
 556      {
 557          JRequest::setVar( 'hidemainmenu', 1 );
 558  
 559          $css_path = $client->path.DS.'templates'.DS.$template.DS.'css'.DS.$filename;
 560  
 561  ?>
 562          <form action="index.php" method="post" name="adminForm">
 563  
 564          <?php if($ftp): ?>
 565          <fieldset title="<?php echo JText::_('DESCFTPTITLE'); ?>">
 566              <legend><?php echo JText::_('DESCFTPTITLE'); ?></legend>
 567  
 568              <?php echo JText::_('DESCFTP'); ?>
 569  
 570              <?php if(JError::isError($ftp)): ?>
 571                  <p><?php echo JText::_($ftp->message); ?></p>
 572              <?php endif; ?>
 573  
 574              <table class="adminform nospace">
 575              <tbody>
 576              <tr>
 577                  <td width="120">
 578                      <label for="username"><?php echo JText::_('Username'); ?>:</label>
 579                  </td>
 580                  <td>
 581                      <input type="text" id="username" name="username" class="input_box" size="70" value="" />
 582                  </td>
 583              </tr>
 584              <tr>
 585                  <td width="120">
 586                      <label for="password"><?php echo JText::_('Password'); ?>:</label>
 587                  </td>
 588                  <td>
 589                      <input type="password" id="password" name="password" class="input_box" size="70" value="" />
 590                  </td>
 591              </tr>
 592              </tbody>
 593              </table>
 594          </fieldset>
 595          <?php endif; ?>
 596  
 597          <table class="adminform">
 598          <tr>
 599              <th>
 600                  <?php echo $css_path; ?>
 601              </th>
 602          </tr>
 603          <tr>
 604              <td>
 605                  <textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox"><?php echo $content; ?></textarea>
 606              </td>
 607          </tr>
 608          </table>
 609  
 610          <input type="hidden" name="id" value="<?php echo $template; ?>" />
 611          <input type="hidden" name="cid[]" value="<?php echo $template; ?>" />
 612          <input type="hidden" name="filename" value="<?php echo $filename; ?>" />
 613          <input type="hidden" name="option" value="<?php echo $option;?>" />
 614          <input type="hidden" name="task" value="" />
 615          <input type="hidden" name="client" value="<?php echo $client->id;?>" />
 616          <?php echo JHTML::_( 'form.token' ); ?>
 617          </form>
 618          <?php
 619      }
 620  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1